Привет всем, изучал даташит БД, не смог разобраться, нужен селект, который бы выбирал все хосты, которые в дауне. Так же как в дашборде последние 20 проблем, только не 20, а все активные. Помогите пожалуйста, очень нужно.
$query="select distinct h.ip, hp.location, DATE_FORMAT(FROM_UNIXTIME(t.lastchange),'%M:%D:%H:%i:%s')
from
triggers t, hosts h, items i, functions f, hosts_groups hg, hosts_profiles hp where f.itemid=i.itemid and
hg.hostid=h.hostid and hp.hostid=i.hostid and t.triggerid=f.triggerid and hp.hostid=h.hostid and t.status=0 and
i.status=0
and exists (SELECT 1 FROM `groups` g, `rights` r, `users_groups` ug, `users` u
where g.groupid=hg.groupid and r.id=g.groupid and ug.usrgrpid=r.groupid and ug.userid=u.userid and
u.alias like 'vash_user' and r.permission in (1,2,3)) and
h.status=0 and t.value=1 order by t.lastchange DESC";
$query="select distinct h.ip, hp.location, date_format(from_unixtime(t.lastchange),'%m:%d:%h:%i:%s')
from
triggers t, hosts h, items i, functions f, hosts_groups hg, hosts_profiles hp where f.itemid=i.itemid and
hg.hostid=h.hostid and hp.hostid=i.hostid and t.triggerid=f.triggerid and hp.hostid=h.hostid and t.status=0 and
i.status=0
and exists (select 1 from `groups` g, `rights` r, `users_groups` ug, `users` u
where g.groupid=hg.groupid and r.id=g.groupid and ug.usrgrpid=r.groupid and ug.userid=u.userid and
u.alias like 'vash_user' and r.permission in (1,2,3)) and
h.status=0 and t.value=1 order by t.lastchange desc";
Comment