File: 1.00.6a/server/web/monitor.php (View as Code)

1: 2: /* ------------------------------------------------------------- 3: This file is part of FreeNATS 4: 5: FreeNATS is (C) Copyright 2008 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 Foobar. If not, see www.gnu.org/licenses 19: 20: For more information see www.purplepixie.org/freenats 21: -------------------------------------------------------------- */ 22: 23: ob_start(); 24: require("include.php"); 25: $NATS->Start(); 26: if (!$NATS_Session->Check($NATS->DB)) 27: { 28: header("Location: ./?login_msg=Invalid+Or+Expired+Session"); 29: exit(); 30: } 31: if ($NATS_Session->userlevel<1) UL_Error("View Monitor"); 32: 33: Screen_Header("Live Monitor",1,1,""); 34: ?> 35:
36: 37:
38: options... 39:
40: 41: 76: 77: 78: 79: if (isset($_REQUEST['style'])) 80: { 81: $style=$_REQUEST['style']; 82: setcookie("fn_monitorstyle",$style); 83: } 84: else if (isset($_COOKIE['fn_monitorstyle'])) 85: { 86: $style=$_COOKIE['fn_monitorstyle']; 87: } 88: else $style="standard"; 89: 90: if ($style=="") $style="standard"; 91: 92: ob_end_flush(); 93: 94: if ($style=="standard") 95: { 96: 97: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 98: $r=$NATS->DB->Query($q); 99: 100: if ($NATS->DB->Num_Rows($r)>0) 101: { 102: echo ""; 103: $a=0; 104: while ($row=$NATS->DB->Fetch_Array($r)) 105: { 106: if ($a==0) echo ""; 107: echo ""; 110: $a++; 111: if ($a==2) 112: { 113: $a=0; 114: echo ""; 115: } 116: } 117: if ($a>0) echo ""; 118: echo "
"; 108: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 109: echo "
";
119: echo "

";
120: } 121: 122: 123: $NATS->DB->Free($r); 124: 125: 126: $q="SELECT * FROM fnnode ORDER BY alertlevel DESC, weight ASC"; 127: $r=$NATS->DB->Query($q); 128: 129: echo ""; 130: $a=0; 131: while ($row=$NATS->DB->Fetch_Array($r)) 132: { 133: if ($a==0) echo ""; 134: echo ""; 137: $a++; 138: if ($a==5) 139: { 140: $a=0; 141: echo ""; 142: } 143: } 144: if ($a>0) echo ""; 145: echo "
"; 135: np_tiny($row['nodeid'],true,$row['nodename']); 136: echo "
";
146: $NATS->DB->Free($r); 147: } 148: 149: else if ($style=="alerting") 150: { 151: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 152: $r=$NATS->DB->Query($q); 153: 154: echo ""; 155: $a=0; 156: while ($row=$NATS->DB->Fetch_Array($r)) 157: { 158: if ($NATS->GroupAlertLevel($row['groupid'])>0) 159: { 160: if ($a==0) echo ""; 161: echo ""; 164: $a++; 165: if ($a==2) 166: { 167: $a=0; 168: echo ""; 169: } 170: } 171: } 172: if ($a>0) echo ""; 173: echo "
"; 162: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 163: echo "
";
174: 175: 176: $NATS->DB->Free($r); 177: 178: echo "

";
179: 180: $q="SELECT * FROM fnnode WHERE alertlevel!=0 ORDER BY alertlevel DESC, weight ASC"; 181: $r=$NATS->DB->Query($q); 182: 183: echo ""; 184: $a=0; 185: while ($row=$NATS->DB->Fetch_Array($r)) 186: { 187: if ($a==0) echo ""; 188: echo ""; 191: $a++; 192: if ($a==5) 193: { 194: $a=0; 195: echo ""; 196: } 197: } 198: if ($a>0) echo ""; 199: echo "
"; 189: np_tiny($row['nodeid'],true,$row['nodename']); 190: echo "
";
200: $NATS->DB->Free($r); 201: } 202: 203: else if ($style=="groups") 204: { 205: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 206: $r=$NATS->DB->Query($q); 207: 208: echo ""; 209: $a=0; 210: while ($row=$NATS->DB->Fetch_Array($r)) 211: { 212: if ($a==0) echo ""; 213: echo ""; 216: $a++; 217: if ($a==2) 218: { 219: $a=0; 220: echo ""; 221: } 222: } 223: if ($a>0) echo ""; 224: echo "
"; 214: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 215: echo "
";
225: 226: 227: $NATS->DB->Free($r); 228: } 229: 230: else if ($style=="nodes") 231: { 232: $q="SELECT * FROM fnnode ORDER BY alertlevel DESC, weight ASC"; 233: $r=$NATS->DB->Query($q); 234: 235: echo ""; 236: $a=0; 237: while ($row=$NATS->DB->Fetch_Array($r)) 238: { 239: if ($a==0) echo ""; 240: echo ""; 243: $a++; 244: if ($a==2) 245: { 246: $a=0; 247: echo ""; 248: } 249: } 250: if ($a>0) echo ""; 251: echo "
"; 241: np_big($row['nodeid'],$row['nodename'],$row['nodedesc'],$row['nodeicon']); 242: echo "
";
252: 253: 254: $NATS->DB->Free($r); 255: } 256: 257: else 258: { 259: echo "Sorry - unknown display style type

";
260: } 261: 262: mt_srand(microtime()*1000000); 263: if (mt_rand(0,100)==50) $track_if_enabled=true; 264: else $track_if_enabled=false; 265: 266: Screen_Footer($track_if_enabled); 267: ?> 268: