コード例 #1
0
ファイル: lms-monitoring.php プロジェクト: Kliwer/lms
                    $strtmp = $nodeslist[$i]['ptime'] . " ms";
                }
                $info = "";
                $info .= sprintf("%-16s", "Urz. sieciowe");
                $info .= sprintf("%-16s", $nodeslist[$i]['ipaddr']);
                $info .= " czas: ";
                $info .= sprintf("%12s", $strtmp);
                $info .= " " . sprintf("%-10s", $nodeslist[$i]['test_type']);
                print $info . "\n";
            }
        }
        if (!$test) {
            for ($i = 0; $i < $count; $i++) {
                $ptime = str_replace(' ', '', str_replace(',', '.', sprintf("%.2f", $nodeslist[$i]['ptime'])));
                $DB->Execute('INSERT INTO monittime (nodeid, ownid, cdate, ptime) VALUES (?,?,?,?) ;', array($nodeslist[$i]['id'], 0, $currenttime, $ptime));
                $LMS->RRD_UpdatePingFile('node.' . $nodeslist[$i]['id'], $ptime, $currenttime, STEP_NETDEV);
                if (get_conf('monit.autocreate_chart', 0)) {
                    $LMS->RRD_CreateSmallPingImage('node.' . $nodeslist[$i]['id'], '-1d', 'now');
                }
                if ($nodeslist[$i]['ptime'] == '-1') {
                    $mid = $DB->GetLastInsertID('monittime');
                    $DB->Execute('INSERT INTO monitwarn (nodeid, ownid, monitid, cdate, backtime, sendwarn, sendback) VALUES (?,?,?,?,?,?,?) ;', array($nodeslist[$i]['id'], !empty($netdevlist[$i]['netdev']) ? 1 : 0, $mid, $currenttime, 0, 0, 0));
                }
            }
        }
    }
}
if ($test_nodes) {
    $nodeslist = $DB->GetAll('SELECT id, test_type, test_port, ipaddr, netdev 
				FROM  monit_vnodes WHERE netdev=0 AND pingtest=1 ' . (!empty($noping) ? 'AND id NOT IN (' . $noping . ') ' : '') . ' ORDER BY ipaddr ASC;');
    if (get_conf('monit.nodes_test') && $nodeslist) {