File: 1.09.5a/server/web/monitor.popup.php (View as HTML)

  1: <?php
  2: /* -------------------------------------------------------------
  3: This file is part of FreeNATS
  4: 
  5: FreeNATS is (C) Copyright 2008-2010 PurplePixie Systems
  6: 
  7: FreeNATS is free software: you can redistribute it and/or modify
  8: it under the terms of the GNU General Public License as published by
  9: the Free Software Foundation, either version 3 of the License, or
 10: (at your option) any later version.
 11: 
 12: FreeNATS is distributed in the hope that it will be useful,
 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15: GNU General Public License for more details.
 16: 
 17: You should have received a copy of the GNU General Public License
 18: along with FreeNATS.  If not, see www.gnu.org/licenses
 19: 
 20: For more information see www.purplepixie.org/freenats
 21: -------------------------------------------------------------- */
 22: ob_start();
 23: 
 24: // This really should be handled by clever Data API (XML) calls but alas
 25: // that is too much work hence the AJAH framework
 26: 
 27: require("include.php");
 28: $NATS->Start();
 29: 
 30: // Timeskip check - means this page skips timecheck/reset if site.monitor.keepalive is 0
 31: if ($NATS->Cfg->Get("site.monitor.keepalive",1)==0) $timeskip=true;
 32: else $timeskip=false;
 33: 
 34: if (!$NATS_Session->Check($NATS->DB,$timeskip))
 35: 	{
 36: 	header("Location: ./?login_msg=Invalid+Or+Expired+Session");
 37: 	exit();
 38: 	}
 39: if ($NATS_Session->userlevel<1) UL_Error("Monitor Popup");
 40: 
 41: if (isset($_REQUEST['type'])) $type=$_REQUEST['type'];
 42: else $type="";
 43: 
 44: echo "<div class=\"popup_inside\">";
 45: 
 46: switch ($type)
 47: {
 48: case "node": // a node details
 49: if (isset($_REQUEST['nodeid']))
 50: 	{
 51: 	$nodeid=ss($_REQUEST['nodeid']);
 52: 	$node=$NATS->GetNode($nodeid);
 53: 	if ($node===false) echo "Invalid or illegal node";
 54: 	else
 55: 		{
 56: 		echo "<b class=\"al".$node['alertlevel']."\">";
 57: 		echo $node['name'];
 58: 		echo "</b>";
 59: 		echo " (<a href=\"node.php?nodeid=".$nodeid."\">Goto Node</a>)";
 60: 		
 61: 		echo "<br /><br />";
 62: 		$tests = $NATS->GetNodeTests($nodeid);
 63: 		echo "<table border=\"0\">";
 64: 		foreach($tests as $testid)
 65: 			{
 66: 			echo "<tr><td align=\"left\" valign=\"top\">";
 67: 			$test=$NATS->GetTest($testid);
 68: 			echo "<b class=\"al".$test['alertlevel']."\">";
 69: 			echo $test['name'];
 70: 			echo "</b>:";
 71: 			echo "</td><td align=\"left\" valign=\"top\">";
 72: 			if (is_numeric($test['lastvalue'])) echo round($test['lastvalue'],2);
 73: 			else echo $test['lastvalue'];
 74: 			$c=$testid[0];
 75: 			if ( is_numeric($c) || ($c=="L") ) echo " ".lUnit($test['testtype']);
 76: 			echo "</td></tr>\n";
 77: 			}
 78: 		echo "</table><br />\n";
 79: 		
 80: 		echo "<a href=\"node.php?nodeid=".$nodeid."\">Goto Node Page</a><br />";
 81: 		
 82: 		}
 83: 	}
 84: else echo "Invalid or illegal node";
 85: break;
 86: default:
 87: echo "Incorrect or invalid request type to popup framework";
 88: break;
 89: }
 90: 
 91: echo "</div>";
 92: ?>