How to create two or more lines in one Line Chart?

0

Hi,

i try to create performance graph for Zabbix monitoring tool (host performance), but don't know how to do it. With two separate graphs it's work, but not both lines in one graph.

Zabbix key for Free RAM is "vm.memory.size[free]", for Total RAM is
"vm.memory.size[total]".

I use two sql query like:

mysql> SELECT items.name AS item_name, trends_uint.clock AS  trends_clock, trends_uint.`value_avg` AS mem_total_value_avg FROM items, hosts, trends_uint WHERE  items.itemid = trends_uint.itemid AND items.hostid=hosts.hostid AND  hosts.host='vsrvlab02' AND items.key_='vm.memory.size[total]';
+--------------+--------------+---------------------+
| item_name    | trends_clock | mem_total_value_avg |
+--------------+--------------+---------------------+
| Total memory |   1355230800 |         52976156672 |
| Total memory |   1355234400 |         52976156672 |
| Total memory |   1355238000 |         52976156672 |
| Total memory |   1355241600 |         52976156672 |
| Total memory |   1355245200 |         52976156672 |
| Total memory |   1355248800 |         52976156672 |

and

mysql> SELECT items.name AS item_name, trends_uint.clock AS  trends_clock, trends_uint.`value_avg` AS mem_total_value_avg FROM items, hosts, trends_uint WHERE  items.itemid = trends_uint.itemid AND items.hostid=hosts.hostid AND  hosts.host='vsrvlab02' AND items.key_='vm.memory.size[available]';
+------------------+--------------+---------------------+
| item_name        | trends_clock | mem_total_value_avg |
+------------------+--------------+---------------------+
| Available memory |   1355227200 |         49191104253 |
| Available memory |   1355230800 |         49189984722 |
| Available memory |   1355234400 |         49189881979 |
| Available memory |   1355238000 |         49188418544 |
| Available memory |   1355241600 |         49187489093 |
| Available memory |   1355245200 |         49186475540 |

I've tried retrieve data from subreport, but it not worked for the graphs

p.s. i'm not sql or BI guru, pls explain more detailed

Thanks!

Alex-R's picture
2
Joined: Feb 28 2013 - 12:01am
Last seen: 6 years 1 month ago

1 Answer:

0

The quickest solution is to do everything in a single SQL query:

SELECT items.name AS item_name, trends_uint.clock AS  trends_clock, trends_uint.`value_avg` AS mem_total_value_avg 
FROM items, hosts, trends_uint 
WHERE  items.itemid = trends_uint.itemid AND items.hostid=hosts.hostid AND  hosts.host='vsrvlab02' AND items.key_='vm.memory.size[total]'
UNION ALL
SELECT items.name AS item_name, trends_uint.clock AS  trends_clock, trends_uint.`value_avg` AS mem_total_value_avg 
FROM items, hosts, trends_uint 
WHERE  items.itemid = trends_uint.itemid AND items.hostid=hosts.hostid AND  hosts.host='vsrvlab02' AND items.key_='vm.memory.size[available]'

There are other (better?) ways to write the SQL. But this one is certain to work since it just UNIONs your 2 existing queries together.

mdahlman's picture
8980
Joined: Mar 13 2007 - 2:43am
Last seen: 4 years 8 months ago
Feedback