File: 1.02.4b/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 FreeNATS. 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: 27: // Timeskip check - means this page skips timecheck/reset if site.monitor.keepalive is 0 28: if ($NATS->Cfg->Get("site.monitor.keepalive",1)==0) $timeskip=true; 29: else $timeskip=false; 30: 31: if (!$NATS_Session->Check($NATS->DB,$timeskip)) 32: { 33: header("Location: ./?login_msg=Invalid+Or+Expired+Session"); 34: exit(); 35: } 36: if ($NATS_Session->userlevel<1) UL_Error("View Monitor"); 37: 38: if (isset($_REQUEST['style'])) 39: { 40: $style=$_REQUEST['style']; 41: setcookie("fn_monitorstyle",$style); 42: } 43: else if (isset($_COOKIE['fn_monitorstyle'])) 44: { 45: $style=$_COOKIE['fn_monitorstyle']; 46: } 47: else $style="standard"; 48: 49: if ($style=="") $style="standard"; 50: 51: Screen_Header("Live Monitor",1,1,""); 52: ?> 53:
54: 55:
56: options... 57:
58: 59: 94: 95: 96: 97: 98: ob_end_flush(); 99: 100: if ($style=="standard") 101: { 102: 103: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 104: $r=$NATS->DB->Query($q); 105: 106: if ($NATS->DB->Num_Rows($r)>0) 107: { 108: echo ""; 109: $a=0; 110: while ($row=$NATS->DB->Fetch_Array($r)) 111: { 112: if ($a==0) echo ""; 113: echo ""; 116: $a++; 117: if ($a==2) 118: { 119: $a=0; 120: echo ""; 121: } 122: } 123: if ($a>0) echo ""; 124: echo "
"; 114: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 115: echo "
";
125: echo "

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

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

";
266: } 267: 268: mt_srand(microtime()*1000000); 269: if (mt_rand(0,100)==50) $track_if_enabled=true; 270: else $track_if_enabled=false; 271: 272: Screen_Footer($track_if_enabled); 273: ?> 274: