How to calculate average items, received from trapper, in zabbix? - zabbix

For example, I get value with key "myTag.some_total_time" by zabbix trapper. I want to see on graph average time of all values for last 5 minute. I know that there are "calculated items" and aggregate functions, but it can not be used with trapper values?

Calculated values can be used with trappers. To do this, you create a calculated element for the element you need.
Ex:
avg(//your_trap_item,5m)

Related

zabbix trigger for difference between 2 values from 2 fields

I am trying to figure out how to have Zabbix pull values from 2 fields, compare them and trigger if the difference between them exceeds a certain value
If one is always larger than the other and using a threshold of 13:
{host:item1.last()}-{host:item2.last()}>13
If their relative sizes are unknown, cannot think of anything nicer but this:
({host:item1.last()}-{host:item2.last()}>13) or ({host:item2.last()}-{host:item1.last()}>13)
You can collect the two fields as standard items (snmp values, agent values etc), then create a calculated item with their difference and appy to it your triggers.

Derive a column value in parent groups using values from child groups in SSRS

I'm tracking active and deactive counts for 3 months(child group) based on acquisition month(parent group)
My Matrix design
Preview
I want to calculate 2nd month deact rate (see picture for formula used)
I know about variables but how can i use child variables in parent group ?
or is there any other way to achieve that 2nd month deact value ?
best way is to calculate the required values by self joining (in my case ) reporting table and also have dedicated column for total for groups and use those columns in SSRS.

SSRS: Calculating the average (mean) in a table missing values instead of zeros

I am trying to calculate the average of six machines in the following table.
The first column represents the machines, the second column is the good pieces and the third column is performance.
In the last row I want to calculate the average (the mean) of the rows but the result is not correct here. It should be 33,6%.
This is the expression I used:
=iif(AVG(Fields!Oee.Value)=0, "-", AVG(Fields!Oee.Value))
How can I calculate this without zeros?
For the calculation you need to divide the sum of the column with the count of non zero rows
= SUM(Fields!Fields!Oee.Value)/ SUM(Iif(Fields!Fields!Oee.Value=0,0,1))
Also if you want to output something else for zero values you can use formatting eg. 0,0;-0,0;"-" (first part is for positive numbers, second for negative and third for zero)
I found this solution:
I used the filter option:
But now in the tablix you can see only the machines which run.

how to populate column from the content of other columns after a row is inserted in the same table in mysql

I have a table traffic with 7 columns, namely toll_id, date1, shift, car_single, car_return, car_local and car_total.
How could I populate first 5 columns manually, and then store a value in column car_total, which will be the sum of car_single and car_return?
Here is the image of my table:
Just to add a 3rd and 4th ways of achieving the desired outcome:
If you have at least MySQL v5.7.6, you can use a generated column as car_total.
Alternatively, you can choose not to store car_total at all, but calculate this value on the fly while querying the table.
Having a column to store the results of the calculation is good if you regularly have search based on that field because you can use indexes to speed up the searches. Calculating the results on the fly may be better, if you just need to display the result of the calculation, but there is no need to filter on it.
There are two ways to do this:
Add the logic in the application itself, so that it calculates total before inserting the record. (Recommended)
Write an after insert trigger (http://dev.mysql.com/doc/refman/5.7/en/trigger-syntax.html) which calculates the count when record is inserted.

DBGrid - how to show the differnce between a column value in two adjacent rows as another column?

Let's say I record my car's latitude & longitude every minute or so, adding a row to a table each time.
I want to have a DB grid with 4 columns
latitude
longitude
distance since last measurment
curent street address, if known
Number 4, I can try to retrieve from Google Maps and I either get a text or blank, so let's ignore that.
How do I get #3? Should I calculate it in my application or in MySql (using a stored procedure or just a complicated SELECT)?
Whichever answer, can someone provide some sample code, or a link to an example? Google is not my friend today :-(
You can do it either way:
Calculate it in your query, and display it in a calculated column (such as when showing line totals where you're displaying ITEM_PRICE, QUANTITY, ITEM_PRICE * QUANTITY AS LINE_COST.
Calculate it in your application, using a calculated field (double-click the TTable component to open the Fields Editor, add field, set the type to ftCalculated, and write code in the OnCalcEvent for that calculated field.
The first choice is usually preferable, because the DB is usually more efficient at doing those sorts of thing on sets of data than when your code does it by row instead. (Set operations are obviously more efficient than row operations.)
Ken’s answer is goes far as it goes, because the most difficult task of solving your problem is getting data from two rows at the same time in SQL. If you were using Oracle or SQL Server, you could use the analytical/windowing LAG function. With MySQL you have to do it yourself. Here are 2 articles on how to simulate LAG in MySQL
http://www.onlamp.com/pub/a/mysql/2007/03/29/emulating-analytic-aka-ranking-functions-with-mysql.html?page=1
http://explainextended.com/2009/03/12/analytic-functions-optimizing-lag-lead-first_value-last_value/
Plus there are StackOverflow questions on how to get data from the previous row.
How do I lag columns in MySQL?
Calculate delta(difference of current and previous row) in sql
I cannot offer any opinion on any of them because I seldom work with MySQL.