File: 0.04.26a/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'])) 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: if ($style=="standard") 93: { 94: 95: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 96: $r=$NATS->DB->Query($q); 97: 98: echo ""; 99: $a=0; 100: while ($row=$NATS->DB->Fetch_Array($r)) 101: { 102: if ($a==0) echo ""; 103: echo ""; 106: $a++; 107: if ($a==2) 108: { 109: $a=0; 110: echo ""; 111: } 112: } 113: if ($a>0) echo ""; 114: echo "
"; 104: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 105: echo "
";
115: 116: 117: $NATS->DB->Free($r); 118: 119: echo "

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

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

";
255: } 256: 257: 258: 259: Screen_Footer(); 260: ?> 261: