File: 1.01.7b/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: 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: if (isset($_REQUEST['style'])) 34: { 35: $style=$_REQUEST['style']; 36: setcookie("fn_monitorstyle",$style); 37: } 38: else if (isset($_COOKIE['fn_monitorstyle'])) 39: { 40: $style=$_COOKIE['fn_monitorstyle']; 41: } 42: else $style="standard"; 43: 44: if ($style=="") $style="standard"; 45: 46: Screen_Header("Live Monitor",1,1,""); 47: ?> 48:
49: 50:
51: options... 52:
53: 54: 89: 90: 91: 92: 93: ob_end_flush(); 94: 95: if ($style=="standard") 96: { 97: 98: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 99: $r=$NATS->DB->Query($q); 100: 101: if ($NATS->DB->Num_Rows($r)>0) 102: { 103: echo ""; 104: $a=0; 105: while ($row=$NATS->DB->Fetch_Array($r)) 106: { 107: if ($a==0) echo ""; 108: echo ""; 111: $a++; 112: if ($a==2) 113: { 114: $a=0; 115: echo ""; 116: } 117: } 118: if ($a>0) echo ""; 119: echo "
"; 109: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 110: echo "
";
120: echo "

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

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

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