From 14abbbd75f1237ca72e3dae1fbaaa2254a1f26d3 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Mon, 14 Apr 2008 09:32:54 +0000 Subject: [PATCH] cleanups git-svn-id: http://www.observium.org/svn/observer/trunk@237 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/graph.php | 6 +++++ html/images/box-alert.png | Bin 848 -> 893 bytes html/images/box-info.png | Bin 847 -> 848 bytes html/images/box-ok.png | Bin 847 -> 892 bytes html/images/box-warn.png | Bin 848 -> 893 bytes html/includes/print-interface.inc | 8 +++--- includes/functions.php | 1 - includes/snom.php | 40 ++++++++---------------------- poll-device.php | 4 +-- 9 files changed, 24 insertions(+), 35 deletions(-) diff --git a/html/graph.php b/html/graph.php index 50a30edf54..e2e7d9ed18 100644 --- a/html/graph.php +++ b/html/graph.php @@ -122,7 +122,13 @@ $graph = cpugraphHP ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Snom") { $graph = callsgraphSNOM ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + } elseif($os == "ScreenOS") { + $graph = graph_netscreen_cpu ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + } elseif($os == "Fortigate") { + $graph = graph_fortinet_cpu ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } + + break; case 'temp': $graph = temp_graph ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical); diff --git a/html/images/box-alert.png b/html/images/box-alert.png index f56486ad17cee0cae0f157000f4ba51ce6c925ed..dcbaa5067cabc1db8f100bb34aae0a8685b81ca5 100644 GIT binary patch literal 893 zcmeAS@N?(olHy`uVBq!ia0vp^?LeHu!3-p4zq~BMz`zt2;1lBd|NsBc(9l(@RvkNb z?8=oZckkYP^ytyEXU|@~eEH_hn|JTty?_7y!-o$aKYsl5>C@-WpTB(h@)Zoe!N7MI z_<;m|qJm$z!Ed6$9~ywaBm!Vq{cdkxk(bw#np&5bSQZ~&5F48l6O$PoogNjH8Woii z8JQFrnHUj~07mf<5pm(+Koko`G2!756dfK8LSbP*6or8z!@{tlh_Eo6C^R$z35AD- zQXPebhLVal8fgO48^bM67srr{#<#aO^0qkeFdRI*i%p|XOm2e5{=V#={72ZM8)e^w z8EgvPy><6mcO6OBFKhqaekAq$-^mR7&ucv9;`JMXnaLNzwUyMR>9^rONZ6ZP5^mO%eS?83{1OS0b1?B(% literal 848 zcmeAS@N?(olHy`uVBq!ia0vp^?LeHu!3-p4zq~BMz`zt2;1lBd|Nnm`j~NY%Pp>+3 zXaB{gXKuZ^^5E^QCm-&=`1I)2=cjMJym{RKw9|NNx{{rU433;O%_4-Nzjt3Q(_)#pwPO_=5oHO(Y!ns&%^)u8E$fzxFJ zrc3)zm++e|<~Lo`ce=3ebRnPVfxjA)F=dnDi`o|mjOOmsSle3DFvkH?l z3sN%kQ!?{FC?gk!a#AuNC_5!1J0%^0vQpDAQD$m7ew2}#j)c-OQb|VXscAGvC2!KK zfC+A`r;B4qM&sMt8+i{K@URAYHBGGN&EZ-B>Kke>^>u(sWPw;JOexpDQ>Qza|P0^5> lks&wdhTME8a#OXIaqoSf?$Gzfr9g)>c)I$ztaD0e0sucS25+3 zXaB{gXKuZ^^5E^QCm-&=`1I)2=cjMJym{RKw9|NNx{{rU433;O%_4-Nzjt4SOFc-5RT%G#-xv{5c*ja1|cv9M(#p-Y5< z7YhU};tyQN7qEagU_Oukd~UyaK*Z%Ym&M4v)R2thz%XhV)Fta zRw59K*DNra$>KGW#glx*>^YO_D2_R87cjxC@pN$v$!L6gdn4~*10L2uucqY}>KYSr z7rcCY-k?PQR(sLO~1{J`dIv4@^MPI&AE^B|DCdj5xfeM)0r?tCD%eq@@_hc>WIZC^i=!;zNsa|>SmMhTR44$rj JF6*2UngHf=;-mlo diff --git a/html/images/box-ok.png b/html/images/box-ok.png index b7af967ef2427de3c3ba0d3c0ffda7e3655127ac..6ab6fbe20daa717cf9719985afa4b6dce73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8aC9#xU&>$Qq`rGbUkx7@zTIp$^V-ep#l5x5!~WcgM!?A3FYzq5LDo`QI7oS?U;MBQAr`|0&#kc%~-b-%l9-qYl TD*`!y4rlOm^>bP0l+XkK%Yo!D diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc index 7b7638707a..1207fa5f80 100644 --- a/html/includes/print-interface.inc +++ b/html/includes/print-interface.inc @@ -123,7 +123,7 @@ echo(""); } } unset($br); - } + # } $sql = "SELECT network_id FROM ip6addr AS A, ip6networks AS N, interfaces AS I WHERE A.interface_id = I.interface_id @@ -137,8 +137,8 @@ echo(""); $sql = "SELECT I.interface_id FROM ip6addr AS A, ip6networks AS N, interfaces AS I, devices AS D WHERE A.interface_id = I.interface_id - AND A.network = N.cidr - AND N.network_id = '".$net['network_id']."' AND D.device_id = I.device_id and D.device_id != '".$device['device_id']."'"; + AND A.network = N.cidr AND N.network_id = '".$net['network_id']."' AND D.device_id = I.device_id + AND D.device_id != '".$device['device_id']."' AND A.origin != 'linklayer' AND A.origin != 'wellknown'"; $new_query = mysql_query($sql); while($new = mysql_fetch_array($new_query)) { @@ -174,6 +174,8 @@ echo(""); unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br); + } + echo(""); // If we're showing graphs, generate the graph and print the img tags diff --git a/includes/functions.php b/includes/functions.php index 150e87284a..1e0ee0fced 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -13,7 +13,6 @@ include_once($config['install_dir'] . "/includes/ios.php"); include_once($config['install_dir'] . "/includes/unix.php"); include_once($config['install_dir'] . "/includes/windows.php"); include_once($config['install_dir'] . "/includes/procurve.php"); -include_once($config['install_dir'] . "/includes/snom.php"); include_once($config['install_dir'] . "/includes/graphing.php"); include_once($config['install_dir'] . "/includes/print-functions.php"); include_once($config['install_dir'] . "/includes/billing-functions.php"); diff --git a/includes/snom.php b/includes/snom.php index 7c5dc45a8d..7af80872bd 100755 --- a/includes/snom.php +++ b/includes/snom.php @@ -2,43 +2,25 @@ include("snom-graphing.php"); -function pollDeviceSNOM() { +function pollDeviceSNOM($device) { - global $device; - global $community; - $snmpver = $device['snmpver']; - $id = $device['device_id']; - $hostname = $device['hostname']; - $hardware = $device['hardware']; - $version = $device['version']; - $features = $device['features']; - $location = $device['location']; + global $config - $snmpdata = `snmpget -Ovq -$snmpver -c $community $hostname 1.3.6.1.2.1.7526.2.1.1 1.3.6.1.2.1.7526.2.1.2 1.3.6.1.2.1.7526.2.2.1 1.3.6.1.2.1.7526.2.2.2`; - $snmpdatab = `snmpget -Oqv -$snmpver -c $community $hostname 1.3.6.1.2.1.7526.2.5 1.3.6.1.2.1.7526.2.6`; + $snmpdata = shell_exec($config['snmpget'] . " -Ovq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname']." 1.3.6.1.2.1.7526.2.1.1 1.3.6.1.2.1.7526.2.1.2 1.3.6.1.2.1.7526.2.2.1 1.3.6.1.2.1.7526.2.2.2"); + $snmpdatab = shell_exec($config['snmpget'] . " -Oqv -".$device['snmpver']." -c ".$device['community']." ".$device['hostname']." 1.3.6.1.2.1.7526.2.5 1.3.6.1.2.1.7526.2.6"); list($rxbytes, $rxpkts, $txbytes, $txpkts) = explode("\n", $snmpdata); list($calls, $registrations) = explode("\n", $snmpdatab); $txbytes = 0 - $txbytes * 8; $rxbytes = 0 - $rxbytes * 8; - echo("$rxbytes, $rxpkts, $txbytes, $txpkts, $calls, $registrations"); - $rrdfile = "rrd/" . $hostname . "-data.rrd"; + $rrdfile = "rrd/" . $device['hostname'] . "-data.rrd"; if(!is_file($rrdfile)) { - $woo = `rrdtool create $rrdfile \ - DS:INOCTETS:COUNTER:600:U:100000000000 \ - DS:OUTOCTETS:COUNTER:600:U:10000000000 \ - DS:INPKTS:COUNTER:600:U:10000000000 \ - DS:OUTPKTS:COUNTER:600:U:10000000000 \ - DS:CALLS:COUNTER:600:U:10000000000 \ - DS:REGISTRATIONS:COUNTER:600:U:10000000000 \ - RRA:AVERAGE:0.5:1:600 \ - RRA:AVERAGE:0.5:6:700 \ - RRA:AVERAGE:0.5:24:775 \ - RRA:AVERAGE:0.5:288:797 \ - RRA:MAX:0.5:1:600 \ - RRA:MAX:0.5:6:700 \ - RRA:MAX:0.5:24:775 \ - RRA:MAX:0.5:288:797`; + $woo = shell_exec($config['rrdtool'] . " create $rrdfile \ + DS:INOCTETS:COUNTER:600:U:100000000000 DS:OUTOCTETS:COUNTER:600:U:10000000000 \ + DS:INPKTS:COUNTER:600:U:10000000000 DS:OUTPKTS:COUNTER:600:U:10000000000 \ + DS:CALLS:COUNTER:600:U:10000000000 DS:REGISTRATIONS:COUNTER:600:U:10000000000 \ + RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 \ + RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797"); } $rrdupdate = "N:$rxbytes:$txbytes:$rxpkts:$rxbytes:$calls:$registrations"; diff --git a/poll-device.php b/poll-device.php index cf5ef13d14..99615d4686 100755 --- a/poll-device.php +++ b/poll-device.php @@ -263,12 +263,12 @@ while ($device = mysql_fetch_array($device_query)) { if(is_file($old_uptimerrd) && !is_file($uptimerrd)) { rename($old_uptimerrd, $uptimerrd); echo("Moving $old_uptimerrd to $uptimerrd"); } if(!is_file($uptimerrd)) { - $woo = `rrdtool create $uptimerrd \ + $woo = shell_exec($config['rrdtool'] . " create $uptimerrd \ DS:uptime:GAUGE:600:0:U \ RRA:AVERAGE:0.5:1:600 \ RRA:AVERAGE:0.5:6:700 \ RRA:AVERAGE:0.5:24:775 \ - RRA:AVERAGE:0.5:288:797`; + RRA:AVERAGE:0.5:288:797"); } rrdtool_update($uptimerrd, "N:$uptime");