Alex-R Posted May 20, 2013 Share Posted May 20, 2013 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 |andmysql> 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 graphsp.s. i'm not sql or BI guru, pls explain more detailedThanks! Link to comment Share on other sites More sharing options...
mdahlman Posted May 30, 2013 Share Posted May 30, 2013 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 ALLSELECT 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now