Hi,
I'm trying to build a sql query to calculate hard disk space consumption. I thought that I could search the "trends" table and search for the data that I want.
I was planning to get the oldest data for a specific item, then the newest data to this same item. Through the difference between this two values divided by the time gap (in days), I could determine the amount of space consumed.
But the problem is that the table trends doesn't have any data to the itemid that I need...
First I searched the hosts table and identified the hostid. Then I searched the items table and discovered the itemid.
Finally I'm searching the trends table with: SELECT * FROM trends t where t.itemid = 23944; (this item represents vfs.fs.size[c:,free])
Any advice? I thought that every monitored item should have data in trends table.
Thanks,
Bob.
Obs.: Just to share something: the following sql query displays a table with the available disk drive spaces in all monitored servers (windows).
I'm trying to build a sql query to calculate hard disk space consumption. I thought that I could search the "trends" table and search for the data that I want.
I was planning to get the oldest data for a specific item, then the newest data to this same item. Through the difference between this two values divided by the time gap (in days), I could determine the amount of space consumed.
But the problem is that the table trends doesn't have any data to the itemid that I need...
First I searched the hosts table and identified the hostid. Then I searched the items table and discovered the itemid.
Finally I'm searching the trends table with: SELECT * FROM trends t where t.itemid = 23944; (this item represents vfs.fs.size[c:,free])
Any advice? I thought that every monitored item should have data in trends table.
Thanks,
Bob.
Obs.: Just to share something: the following sql query displays a table with the available disk drive spaces in all monitored servers (windows).
PHP Code:
SELECT h.host, MAX(IF(i.key_='vfs.fs.size[c:,pfree]', i.lastvalue, '')) AS 'c:',
MAX(IF(i.key_='vfs.fs.size[d:,pfree]', i.lastvalue, '')) AS 'd:',
MAX(IF(i.key_='vfs.fs.size[e:,pfree]', i.lastvalue, '')) AS 'e:'
FROM `hosts` h, hosts_groups hg, items i
WHERE h.hostid = hg.hostid AND h.hostid = i.hostid
AND hg.groupid = 3 AND i.key_ LIKE '%pfree%'
GROUP BY h.host
Comment