File: 0.04.27a/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: ob_end_flush(); 47: Screen_Header("Live Monitor",1,1,""); 48: ?> 49:
50: 51:
52: options... 53:
54: 55: 90: 91: 92: 93: 94: if ($style=="standard") 95: { 96: 97: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 98: $r=$NATS->DB->Query($q); 99: 100: echo ""; 101: $a=0; 102: while ($row=$NATS->DB->Fetch_Array($r)) 103: { 104: if ($a==0) echo ""; 105: echo ""; 108: $a++; 109: if ($a==2) 110: { 111: $a=0; 112: echo ""; 113: } 114: } 115: if ($a>0) echo ""; 116: echo "
"; 106: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 107: echo "
";
117: 118: 119: $NATS->DB->Free($r); 120: 121: echo "

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

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

";
257: } 258: 259: 260: 261: Screen_Footer(); 262: ?> 263: