Hi,
I wrote a query to find out the screens which are not populated with data for more than a day. I need the name of the screen, name of the host, name of the metric and number of days without data in the output.
Could you please verify the script? The script is given below.
(select s.name Category, h.host, g.name Metric,
(TIME_TO_SEC(TIMEDIFF( now(),'1970:01:01 00:00:00'))- i.lastclock) DIV 86400 DaysWithoutData
from graphs_items gi,screens_items si,graphs g, screens s,hosts h, items i
where
gi.graphid =si.resourceid
and gi.graphid=g.graphid
and si.screenid=s.screenid
and gi.itemid=i.itemid
and i.hostid=h.hostid
and i.lastclock < (TIME_TO_SEC(TIMEDIFF(( now() - INTERVAL 1 DAY),'1970:01:01 00:00:00')))
and gi.sortorder=0)
union
(select s2.name Category, h2.host ,ii.description Metric,
(TIME_TO_SEC(TIMEDIFF( now(),'1970:01:01 00:00:00'))- ii.lastclock) DIV 86400 DaysWithoutData
from items ii, screens_items si2, screens s2, hosts h2
where ii.itemid =si2.resourceid
and si2.screenid=s2.screenid
and ii.hostid=h2.hostid
and ii.lastclock < (TIME_TO_SEC(TIMEDIFF(( now() - INTERVAL 1 DAY),'1970:01:01 00:00:00')))
)
order by 1,2,3;
Thanks,
Rana
I wrote a query to find out the screens which are not populated with data for more than a day. I need the name of the screen, name of the host, name of the metric and number of days without data in the output.
Could you please verify the script? The script is given below.
(select s.name Category, h.host, g.name Metric,
(TIME_TO_SEC(TIMEDIFF( now(),'1970:01:01 00:00:00'))- i.lastclock) DIV 86400 DaysWithoutData
from graphs_items gi,screens_items si,graphs g, screens s,hosts h, items i
where
gi.graphid =si.resourceid
and gi.graphid=g.graphid
and si.screenid=s.screenid
and gi.itemid=i.itemid
and i.hostid=h.hostid
and i.lastclock < (TIME_TO_SEC(TIMEDIFF(( now() - INTERVAL 1 DAY),'1970:01:01 00:00:00')))
and gi.sortorder=0)
union
(select s2.name Category, h2.host ,ii.description Metric,
(TIME_TO_SEC(TIMEDIFF( now(),'1970:01:01 00:00:00'))- ii.lastclock) DIV 86400 DaysWithoutData
from items ii, screens_items si2, screens s2, hosts h2
where ii.itemid =si2.resourceid
and si2.screenid=s2.screenid
and ii.hostid=h2.hostid
and ii.lastclock < (TIME_TO_SEC(TIMEDIFF(( now() - INTERVAL 1 DAY),'1970:01:01 00:00:00')))
)
order by 1,2,3;
Thanks,
Rana
Comment