コード例 #1
0
ファイル: freenats.inc.php プロジェクト: purplepixie/freenats
 function InvalidateNode($nodeid, $rightnow = false, $testsaswell = false)
 {
     if ($rightnow) {
         $nextx = time();
         $q = "UPDATE fnnode SET nextrunx=" . $nextx . " WHERE nodeid=\"" . ss($nodeid) . "\"";
         $this->DB->Query($q);
         if ($testsaswell) {
             $q = "UPDATE fnlocaltest SET nextrunx=" . $nextx . " WHERE nodeid=\"" . ss($nodeid) . "\"";
             $this->DB->Query($q);
         }
         return true;
     }
     // otherwise set to it's interval
     $q = "SELECT testinterval FROM fnnode WHERE nodeid=\"" . ss($nodeid) . "\"";
     $r = $this->DB->Query($q);
     if ($row = $this->DB->Fetch_Array($r)) {
         $nextx = next_run_x($row['testinterval']);
         $uq = "UPDATE fnnode SET nextrunx=" . $nextx . " WHERE nodeid=\"" . ss($nodeid) . "\"";
         $this->DB->Query($uq);
         $this->DB->Free($r);
         if ($testsaswell) {
             $uq = "UPDATE fnlocaltest SET nextrunx=" . $nextx . " WHERE nodeid=\"" . ss($nodeid) . "\"";
             $this->DB->Query($uq);
         }
         return true;
     }
     return false;
 }
コード例 #2
0
ファイル: tester.php プロジェクト: alvunera/FreeNats-PlugIn
     db(" Pulling Data");
     $pull_result = $NATS->Nodeside_Pull($row['nodeid']);
     if ($pull_result === false) {
         db(" Pull Failed");
         $pullalert = 1;
         // alert
         $alerts[$alertc++] = "pull failed";
         $alertlevel = 2;
     } else {
         $freshdata = true;
         $pullalert = 0;
         // ok
         db(" Pull Succeeded");
     }
     db(" Updating Pull nslast/nextx and nspullalert");
     $uq = "UPDATE fnnode SET nsnextx=" . next_run_x($row['nsinterval']) . ",nspullalert=" . $pullalert . ",nslastx=" . time() . " WHERE nodeid=\"" . $row['nodeid'] . "\"";
     $NATS->DB->Query($uq);
     if ($NATS->DB->Affected_Rows() <= 0) {
         db(" - Failed");
     }
 }
 /*
 // Process for alerts in here - whether pulled or not!
 $tq="SELECT testtype,testname,alertlevel FROM fnnstest WHERE nodeid=\"".$row['nodeid']."\" AND testenabled=1 AND testalerts=1 AND alertlevel>0";
 $tr=$NATS->DB->Query($tq);
 while ($trow=$NATS->DB->Fetch_Array($tr))
 	{
 	if ($trow['testname']=="") $tname=$trow['testtype'];
 	else $tname=$trow['testname'];
 	if ($freshdata) $alerts[$alertc++]=$tname." ".oText($trow['alertlevel']); // only record text to log if fresh
 	if ($trow['alertlevel']>$alertlevel) $alertlevel=$trow['alertlevel'];