Jump to content
We've recently updated our Privacy Statement, available here ×

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


Alex-R

Recommended Posts

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!

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...