File: 0.04.12a/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: ob_end_flush(); 33: Screen_Header("Live Monitor",1,1,""); 34: ?> 35:
36: 37:
38: options... 39:
40: 41: 76: 77: 78: 79: if (isset($_REQUEST['style'])) $style=$_REQUEST['style']; 80: else $style="standard"; 81: if ($style=="") $style="standard"; 82: 83: if ($style=="standard") 84: { 85: 86: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 87: $r=$NATS->DB->Query($q); 88: 89: echo ""; 90: $a=0; 91: while ($row=$NATS->DB->Fetch_Array($r)) 92: { 93: if ($a==0) echo ""; 94: echo ""; 97: $a++; 98: if ($a==2) 99: { 100: $a=0; 101: echo ""; 102: } 103: } 104: if ($a>0) echo ""; 105: echo "
"; 95: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 96: echo "
";
106: 107: 108: $NATS->DB->Free($r); 109: 110: echo "

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

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

";
246: } 247: 248: 249: 250: Screen_Footer(); 251: ?> 252: