コード例 #1
0
function update_services_status_all()
{
    $result = DBselect('SELECT s.serviceid,s.algorithm,s.triggerid' . ' FROM services s' . ' WHERE s.serviceid NOT IN (' . 'SELECT DISTINCT sl.serviceupid' . ' FROM services_links sl' . ')');
    while ($row = DBfetch($result)) {
        $status = get_service_status($row['serviceid'], $row['algorithm'], $row['triggerid']);
        DBexecute('UPDATE services SET status=' . zbx_dbstr($status) . ' WHERE serviceid=' . $row['serviceid']);
        add_service_alarm($row['serviceid'], $status, time());
    }
    $result = DBselect('SELECT MAX(sl.servicedownid) AS serviceid,sl.serviceupid' . ' FROM services_links sl' . ' WHERE sl.servicedownid NOT IN (' . 'SELECT DISTINCT sl.serviceupid FROM services_links sl' . ')' . ' GROUP BY sl.serviceupid');
    while ($row = DBfetch($result)) {
        update_services_rec($row['serviceid']);
    }
}
コード例 #2
0
ファイル: services.inc.php プロジェクト: phedders/zabbix
function update_services_status_all()
{
    clear_parents_from_trigger();
    $result = DBselect('SELECT s.serviceid,s.algorithm,s.triggerid ' . ' FROM services s ' . ' WHERE s.serviceid NOT IN (select distinct sl.serviceupid from services_links sl)');
    while ($rows = DBfetch($result)) {
        $status = get_service_status($rows['serviceid'], $rows['algorithm'], $rows['triggerid']);
        DBexecute('UPDATE services SET status = ' . $status . ' WHERE serviceid=' . $rows['serviceid']);
        add_service_alarm($rows['serviceid'], $status, time());
    }
    $result = DBselect('SELECT MAX(sl.servicedownid) as serviceid, sl.serviceupid ' . ' FROM services_links sl ' . ' WHERE sl.servicedownid NOT IN (select distinct sl.serviceupid from services_links sl) ' . ' GROUP BY sl.serviceupid');
    while ($rows = DBfetch($result)) {
        update_services_rec($rows['serviceid']);
    }
}