From f29e7b755b1ee4358b6bf9475cf153856c2ef142 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Wed, 28 Jul 2010 19:43:02 +0000 Subject: [PATCH] redesigned graph defining system (still seems a bit batshit, but nevermind). lots of improvements to various pollers, only writing RRDs if valid data is returned, etc. git-svn-id: http://www.observium.org/svn/observer/trunk@1506 61d68cd4-352d-0410-923a-c4978735b2b8 --- database-update.sql | 5 ++ html/images/icons/greyscale/mempools.png | Bin 0 -> 1523 bytes html/images/icons/mempools.png | Bin 0 -> 1532 bytes html/images/icons/netstats.png | Bin 0 -> 749 bytes html/includes/graphs/device/auth.inc.php | 2 - html/includes/graphs/device/cpu.inc.php | 38 ---------- .../graphs/device/cpu_powerconnect.inc.php | 28 -------- .../graphs/device/cpu_procurve.inc.php | 28 -------- ...processes.inc.php => hr_processes.inc.php} | 2 +- .../{hrusers.inc.php => hr_users.inc.php} | 2 +- ..._v4.inc.php => ipsystemstats_ipv4.inc.php} | 0 .../device/ipsystemstats_ipv4_frag.inc.php | 64 +++++++++++++++++ ..._v6.inc.php => ipsystemstats_ipv6.inc.php} | 0 ...nc.php => ipsystemstats_ipv6_frag.inc.php} | 0 .../graphs/device/memory_procurve.inc.php | 35 ---------- .../{memory.inc.php => mempools.inc.php} | 0 .../{icmp.inc.php => netstat_icmp.inc.php} | 0 ...onal.inc.php => netstat_icmp_info.inc.php} | 0 .../device/{ip.inc.php => netstat_ip.inc.php} | 0 ...mented.inc.php => netstat_ip_frag.inc.php} | 0 ...tatistics.inc.php => netstat_snmp.inc.php} | 0 ...ckets.inc.php => netstat_snmp_pkt.inc.php} | 0 .../{tcp.inc.php => netstat_tcp.inc.php} | 0 .../{udp.inc.php => netstat_udp.inc.php} | 0 .../{cpu_unix.inc.php => ucd_cpu.inc.php} | 39 ----------- .../{laload.inc.php => ucd_load.inc.php} | 2 +- ...memory_unix.inc.php => ucd_memory.inc.php} | 0 html/includes/graphs/graph.inc.php | 7 +- html/map.php | 2 + html/pages/device/graphs.inc.php | 34 ++++----- .../device/graphs/{system => }/cpu.inc.php | 0 .../device/graphs/fortigate-sessions.inc.php | 9 +++ .../graphs/{system => }/hrprocesses.inc.php | 0 .../graphs/{system => }/hrusers.inc.php | 0 html/pages/device/graphs/laload.inc.php | 4 ++ .../device/graphs/{system => }/memory.inc.php | 0 .../graphs/{network => }/netstats.inc.php | 0 .../device/graphs/screenos-sessions.inc.php | 10 +++ .../graphs/{system => }/screenos.inc.php | 0 .../pages/device/graphs/system/laload.inc.php | 9 --- .../device/graphs/{system => }/uptime.inc.php | 0 .../graphs/{system => }/wireless.inc.php | 0 html/pages/device/health.inc.php | 6 +- html/pages/graphs.inc.php | 2 + includes/common.php | 22 ++++++ includes/functions.php | 22 ------ includes/polling/hr-mib.inc.php | 23 ++++--- includes/polling/ipSystemStats.inc.php | 6 +- includes/polling/netstats-icmp.inc.php | 9 ++- includes/polling/netstats-ip.inc.php | 5 +- includes/polling/netstats-snmp.inc.php | 3 +- includes/polling/netstats-tcp.inc.php | 2 +- includes/polling/netstats-udp.inc.php | 2 +- includes/polling/os/allied.inc.php | 2 - includes/polling/os/extremeware.inc.php | 3 - includes/polling/os/fortigate.inc.php | 40 ++++------- includes/polling/os/junos.inc.php | 4 -- includes/polling/os/junose.inc.php | 7 -- includes/polling/os/redback.inc.php | 2 - includes/polling/os/screenos.inc.php | 4 +- includes/polling/os/speedtouch.inc.php | 4 -- includes/polling/os/unix.inc.php | 5 +- includes/polling/os/windows.inc.php | 3 - includes/polling/ucd-mib.inc.php | 12 ++++ includes/rewrites.php | 2 +- includes/static-config.php | 27 +++++--- poller.php | 65 +++++++++++++----- 67 files changed, 264 insertions(+), 338 deletions(-) create mode 100644 html/images/icons/greyscale/mempools.png create mode 100644 html/images/icons/mempools.png create mode 100755 html/images/icons/netstats.png delete mode 100644 html/includes/graphs/device/cpu.inc.php delete mode 100644 html/includes/graphs/device/cpu_powerconnect.inc.php delete mode 100644 html/includes/graphs/device/cpu_procurve.inc.php rename html/includes/graphs/device/{hrprocesses.inc.php => hr_processes.inc.php} (97%) rename html/includes/graphs/device/{hrusers.inc.php => hr_users.inc.php} (98%) rename html/includes/graphs/device/{ipSystemStats_v4.inc.php => ipsystemstats_ipv4.inc.php} (100%) create mode 100644 html/includes/graphs/device/ipsystemstats_ipv4_frag.inc.php rename html/includes/graphs/device/{ipSystemStats_v6.inc.php => ipsystemstats_ipv6.inc.php} (100%) rename html/includes/graphs/device/{ipSystemStats_v6_frag.inc.php => ipsystemstats_ipv6_frag.inc.php} (100%) delete mode 100644 html/includes/graphs/device/memory_procurve.inc.php rename html/includes/graphs/device/{memory.inc.php => mempools.inc.php} (100%) rename html/includes/graphs/device/{icmp.inc.php => netstat_icmp.inc.php} (100%) rename html/includes/graphs/device/{icmp_informational.inc.php => netstat_icmp_info.inc.php} (100%) rename html/includes/graphs/device/{ip.inc.php => netstat_ip.inc.php} (100%) rename html/includes/graphs/device/{ip_fragmented.inc.php => netstat_ip_frag.inc.php} (100%) rename html/includes/graphs/device/{snmp_statistics.inc.php => netstat_snmp.inc.php} (100%) rename html/includes/graphs/device/{snmp_packets.inc.php => netstat_snmp_pkt.inc.php} (100%) rename html/includes/graphs/device/{tcp.inc.php => netstat_tcp.inc.php} (100%) rename html/includes/graphs/device/{udp.inc.php => netstat_udp.inc.php} (100%) rename html/includes/graphs/device/{cpu_unix.inc.php => ucd_cpu.inc.php} (66%) rename html/includes/graphs/device/{laload.inc.php => ucd_load.inc.php} (93%) rename html/includes/graphs/device/{memory_unix.inc.php => ucd_memory.inc.php} (100%) rename html/pages/device/graphs/{system => }/cpu.inc.php (100%) create mode 100644 html/pages/device/graphs/fortigate-sessions.inc.php rename html/pages/device/graphs/{system => }/hrprocesses.inc.php (100%) rename html/pages/device/graphs/{system => }/hrusers.inc.php (100%) create mode 100644 html/pages/device/graphs/laload.inc.php rename html/pages/device/graphs/{system => }/memory.inc.php (100%) rename html/pages/device/graphs/{network => }/netstats.inc.php (100%) create mode 100644 html/pages/device/graphs/screenos-sessions.inc.php rename html/pages/device/graphs/{system => }/screenos.inc.php (100%) delete mode 100644 html/pages/device/graphs/system/laload.inc.php rename html/pages/device/graphs/{system => }/uptime.inc.php (100%) rename html/pages/device/graphs/{system => }/wireless.inc.php (100%) diff --git a/database-update.sql b/database-update.sql index 42e3e6471..97b42eae7 100644 --- a/database-update.sql +++ b/database-update.sql @@ -43,3 +43,8 @@ CREATE TABLE IF NOT EXISTS `perf_times` ( `type` varchar(8) NOT NULL, `doing` ## 0.10.7.1 ALTER TABLE `bills` ADD `bill_autoadded` BOOLEAN NOT NULL DEFAULT '0' ALTER TABLE `bill_ports` ADD `bill_port_autoadded` BOOLEAN NOT NULL DEFAULT '0' +CREATE TABLE IF NOT EXISTS `device_graphs` ( `device_id` int(11) NOT NULL, `graph` varchar(32) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +DROP TABLE IF EXISTS `graph_types`; +CREATE TABLE IF NOT EXISTS `graph_types` ( `graph_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_subtype` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_section` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_descr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `graph_order` int(11) NOT NULL, KEY `graph_type` (`graph_type`), KEY `graph_subtype` (`graph_subtype`), KEY `graph_section` (`graph_section`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO `graph_types` (`graph_type`, `graph_subtype`, `graph_section`, `graph_descr`, `graph_order`) VALUES('device', 'bits', 'netstats', 'Total Traffic', 0),('device', 'hr_users', 'system', 'Users Logged In', 0),('device', 'ucd_load', 'system', 'Load Averages', 0),('device', 'ucd_cpu', 'system', 'Detailed Processor Usage', 0),('device', 'ucd_memory', 'system', 'Detailed Memory Usage', 0),('device', 'netstat_tcp', 'netstats', 'TCP Statistics', 0),('device', 'netstat_icmp_info', 'netstats', 'ICMP Informational Statistics', 0),('device', 'netstat_icmp_stat', 'netstats', 'ICMP Statistics', 0),('device', 'netstat_ip', 'netstats', 'IP Statistics', 0),('device', 'netstat_ip_frag', 'netstats', 'IP Fragmentation Statistics', 0),('device', 'netstat_udp', 'netstats', 'UDP Statistics', 0),('device', 'netstat_snmp', 'netstats', 'SNMP Statistics', 0),('device', 'temperatures', 'system', 'Temperatures', 0),('device', 'mempools', 'system', 'Memory Pool Usage', 0),('device', 'processors', 'system', 'Processor Usage', 0),('device', 'storage', 'system', 'Filesystem Usage', 0),('device', 'hr_processes', 'system', 'Running Processes', 0),('device', 'uptime', 'system', 'System Uptime', ''),('device', 'ipsystemstats_ipv4', 'netstats', 'IPv4 Packet Statistics', 0),('device', 'ipsystemstats_ipv6_frag', 'netstats', 'IPv6 Fragmentation Statistics', 0),('device', 'ipsystemstats_ipv6', 'netstats', 'IPv6 Packet Statistics', 0),('device', 'ipsystemstats_ipv4_frag', 'netstats', 'IPv4 Fragmentation Statistics', 0),('device', 'fortigate_sessions', 'firewall', 'Active Sessions', ''), ('device', 'screenos_settings', 'firewall', 'Active Sessions', ''); + diff --git a/html/images/icons/greyscale/mempools.png b/html/images/icons/greyscale/mempools.png new file mode 100644 index 0000000000000000000000000000000000000000..1349695ff62a10aba41fbc24af4a007c241e30f8 GIT binary patch literal 1523 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstPBjy3;{kN zu0U~LU*CX$fWW}OkdTn@@bJ{s)U>p;+}zya;^NZM(z3F$s;a7*nwt9h`i6#vrlzKr zmX_Am*3Qn(uCA`0o}S*`-oC!R{{H?66DCZWG->+u=`&``m^pLitXZ>W&z?PZ?%a9v z<}FyTVBx}rOO`BIzI^%GwQDzQ*sx{GmVNv79XN2{(4j*|jvP65?AVDDCr+L`dFs@u zGiT16KY#whg$tK1UAl7R%C&3Pu3x`?O>_%)r16EI_yg7}qNA zEd>g)mw5WRvR~%m;Wy?`+hVgEC^WIeHKN2hKQ}iuuY@5aKR+iau}HT#vnn-3Au~BY zkINPbaB*oQYbqES7#J&fC1#f<=H@0Qt1ASTq-N%&7U?K(Wt5Z@Sn2CSB=mAi zi!+lm5_59&lB>A5l8aIkOMnKKXO?6rlw_nTxO@5r=)km;mzV3MXXX~@@gJ_Bo6&6iw-^HQdopG_ z88lfxx_$2QBa7vUwg)m;k6Ko-ugIEU-jw&v>p_Z%j+I320wc%!%~3VSIS=2xP?Pk+ zI*o_tyt~HNk3vq`ZIZSe+m>z@Z~omY5`2(zTV7D)gBU@ZJ4+^Mx^8fp7*fQ0>Q`-; dyuy#u>=6pqKFlv9>Va-%@O1TaS?83{1OWf!Arb%p literal 0 HcmV?d00001 diff --git a/html/images/icons/mempools.png b/html/images/icons/mempools.png new file mode 100644 index 0000000000000000000000000000000000000000..492d82ec6f67d25dac5dee881c81747870cf5c60 GIT binary patch literal 1532 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstPBjy3;{kN zu0U}aEpb^r2|0a9d0iO=LrFzrSrZczJ3BiK2L)YMRXu-o10OZRAa#>ab@Ny~s~}^W zSX1jnBb#(X$5?ZxI9r!wTbCRwhXNDlA`_1SJC8zpS65eecXtmD52s)U{}6xAIH$1a zknot$$oMetY**i67yl}k*rb@)l-QX3@W3LE@Y;Zc;+U$cikh05uvV|^iNP72$+;7g zOJ-$PPc2@wF0Y}Xp{c247I;J!Gca%qf-qx!O8i8iAbW|YuPggy9v*&U z4z(>d%Yi}@OI#yLobz*YQ}ap~Lh|!-k`jw_i!-ZIQxr0j^YgfDkpLH$MzW@Yk%57+ zf>&a8X_A6^R%UK)VzRnIa7k)rUTTq!0#`;!Nr9EVK14z)*`=J zvx0kjD^nozsxQea73LZ;AMs}~JI&vZ>%h3)%~ z#+IbJ;FFDG??-c+T_21rm1LV#4~LF)_b?ghyQZ9u#u#o3H=L6>&|AoXU?qv@1Je4>AlGSTjH9nQnv` zZj`d7z#wVmBfa>gsDTLdFI!hq-@bX#X+L@z8vo6kH}8K}amoKn){fuj1c#~B)YRMs ziM6)2zRSwWDz&q-<3{$cgk#0gf)Z9d-K|58&^ z|4*7U>3?Nq<$n;{+uQpONDgEONG*d?^_d5g*IfJ$^zTa}BcraSrl#*81N{B{x$N!j zKkwbU_y4(b=l&l$bm;%uwQK)_#6WT&13+pS94d|%*p(iBU{kceKv!2cGd(^1J;;Ed zprDL1_pvLhz$}0$$<<2sYMAyO(5{~^}XKP+xvdis#R~-ty}kh`t<4l z3kwVXS5#Dh*&s2H97qjFEs6nZYHG|tCmMKpdEHM*N%@kUo&6n%e};#L#{sc3ko^fH f29g7*0jUK58Cr#m= diff --git a/html/includes/graphs/device/cpu.inc.php b/html/includes/graphs/device/cpu.inc.php deleted file mode 100644 index 021e55826..000000000 --- a/html/includes/graphs/device/cpu.inc.php +++ /dev/null @@ -1,38 +0,0 @@ - diff --git a/html/includes/graphs/device/cpu_powerconnect.inc.php b/html/includes/graphs/device/cpu_powerconnect.inc.php deleted file mode 100644 index db1a3bf7c..000000000 --- a/html/includes/graphs/device/cpu_powerconnect.inc.php +++ /dev/null @@ -1,28 +0,0 @@ - diff --git a/html/includes/graphs/device/cpu_procurve.inc.php b/html/includes/graphs/device/cpu_procurve.inc.php deleted file mode 100644 index a30f82037..000000000 --- a/html/includes/graphs/device/cpu_procurve.inc.php +++ /dev/null @@ -1,28 +0,0 @@ - diff --git a/html/includes/graphs/device/hrprocesses.inc.php b/html/includes/graphs/device/hr_processes.inc.php similarity index 97% rename from html/includes/graphs/device/hrprocesses.inc.php rename to html/includes/graphs/device/hr_processes.inc.php index d8ba4109f..a6bef2ca5 100644 --- a/html/includes/graphs/device/hrprocesses.inc.php +++ b/html/includes/graphs/device/hr_processes.inc.php @@ -6,7 +6,7 @@ $scale_min = "0"; include("includes/graphs/common.inc.php"); -$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrSystem.rrd"; +$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_processes.rrd"; $rrd_options .= " DEF:procs=$database:procs:AVERAGE"; $rrd_options .= " COMMENT:Processes\ \ \ \ Cur\ \ \ \ \ Ave\ \ \ \ \ \ Min\ \ \ \ \ Max\\\\n"; diff --git a/html/includes/graphs/device/hrusers.inc.php b/html/includes/graphs/device/hr_users.inc.php similarity index 98% rename from html/includes/graphs/device/hrusers.inc.php rename to html/includes/graphs/device/hr_users.inc.php index e1bac0a9c..8f2752715 100644 --- a/html/includes/graphs/device/hrusers.inc.php +++ b/html/includes/graphs/device/hr_users.inc.php @@ -6,7 +6,7 @@ $scale_min = "0"; include("includes/graphs/common.inc.php"); -$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrSystem.rrd"; +$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_users.rrd"; $rrd_options .= " DEF:users=$database:users:AVERAGE"; $rrd_options .= " DEF:users_max=$database:users:MAX"; diff --git a/html/includes/graphs/device/ipSystemStats_v4.inc.php b/html/includes/graphs/device/ipsystemstats_ipv4.inc.php similarity index 100% rename from html/includes/graphs/device/ipSystemStats_v4.inc.php rename to html/includes/graphs/device/ipsystemstats_ipv4.inc.php diff --git a/html/includes/graphs/device/ipsystemstats_ipv4_frag.inc.php b/html/includes/graphs/device/ipsystemstats_ipv4_frag.inc.php new file mode 100644 index 000000000..2c9b5e138 --- /dev/null +++ b/html/includes/graphs/device/ipsystemstats_ipv4_frag.inc.php @@ -0,0 +1,64 @@ + diff --git a/html/includes/graphs/device/ipSystemStats_v6.inc.php b/html/includes/graphs/device/ipsystemstats_ipv6.inc.php similarity index 100% rename from html/includes/graphs/device/ipSystemStats_v6.inc.php rename to html/includes/graphs/device/ipsystemstats_ipv6.inc.php diff --git a/html/includes/graphs/device/ipSystemStats_v6_frag.inc.php b/html/includes/graphs/device/ipsystemstats_ipv6_frag.inc.php similarity index 100% rename from html/includes/graphs/device/ipSystemStats_v6_frag.inc.php rename to html/includes/graphs/device/ipsystemstats_ipv6_frag.inc.php diff --git a/html/includes/graphs/device/memory_procurve.inc.php b/html/includes/graphs/device/memory_procurve.inc.php deleted file mode 100644 index 370969603..000000000 --- a/html/includes/graphs/device/memory_procurve.inc.php +++ /dev/null @@ -1,35 +0,0 @@ - diff --git a/html/includes/graphs/device/memory.inc.php b/html/includes/graphs/device/mempools.inc.php similarity index 100% rename from html/includes/graphs/device/memory.inc.php rename to html/includes/graphs/device/mempools.inc.php diff --git a/html/includes/graphs/device/icmp.inc.php b/html/includes/graphs/device/netstat_icmp.inc.php similarity index 100% rename from html/includes/graphs/device/icmp.inc.php rename to html/includes/graphs/device/netstat_icmp.inc.php diff --git a/html/includes/graphs/device/icmp_informational.inc.php b/html/includes/graphs/device/netstat_icmp_info.inc.php similarity index 100% rename from html/includes/graphs/device/icmp_informational.inc.php rename to html/includes/graphs/device/netstat_icmp_info.inc.php diff --git a/html/includes/graphs/device/ip.inc.php b/html/includes/graphs/device/netstat_ip.inc.php similarity index 100% rename from html/includes/graphs/device/ip.inc.php rename to html/includes/graphs/device/netstat_ip.inc.php diff --git a/html/includes/graphs/device/ip_fragmented.inc.php b/html/includes/graphs/device/netstat_ip_frag.inc.php similarity index 100% rename from html/includes/graphs/device/ip_fragmented.inc.php rename to html/includes/graphs/device/netstat_ip_frag.inc.php diff --git a/html/includes/graphs/device/snmp_statistics.inc.php b/html/includes/graphs/device/netstat_snmp.inc.php similarity index 100% rename from html/includes/graphs/device/snmp_statistics.inc.php rename to html/includes/graphs/device/netstat_snmp.inc.php diff --git a/html/includes/graphs/device/snmp_packets.inc.php b/html/includes/graphs/device/netstat_snmp_pkt.inc.php similarity index 100% rename from html/includes/graphs/device/snmp_packets.inc.php rename to html/includes/graphs/device/netstat_snmp_pkt.inc.php diff --git a/html/includes/graphs/device/tcp.inc.php b/html/includes/graphs/device/netstat_tcp.inc.php similarity index 100% rename from html/includes/graphs/device/tcp.inc.php rename to html/includes/graphs/device/netstat_tcp.inc.php diff --git a/html/includes/graphs/device/udp.inc.php b/html/includes/graphs/device/netstat_udp.inc.php similarity index 100% rename from html/includes/graphs/device/udp.inc.php rename to html/includes/graphs/device/netstat_udp.inc.php diff --git a/html/includes/graphs/device/cpu_unix.inc.php b/html/includes/graphs/device/ucd_cpu.inc.php similarity index 66% rename from html/includes/graphs/device/cpu_unix.inc.php rename to html/includes/graphs/device/ucd_cpu.inc.php index e9bf31442..6a61c3037 100644 --- a/html/includes/graphs/device/cpu_unix.inc.php +++ b/html/includes/graphs/device/ucd_cpu.inc.php @@ -1,42 +1,5 @@ diff --git a/html/includes/graphs/device/laload.inc.php b/html/includes/graphs/device/ucd_load.inc.php similarity index 93% rename from html/includes/graphs/device/laload.inc.php rename to html/includes/graphs/device/ucd_load.inc.php index c686fdc27..365b968ab 100644 --- a/html/includes/graphs/device/laload.inc.php +++ b/html/includes/graphs/device/ucd_load.inc.php @@ -3,7 +3,7 @@ include("includes/graphs/common.inc.php"); $device = device_by_id_cache($id); -$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/ucd_load.rrd"; + $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/ucd_load.rrd"; $rrd_options .= " DEF:1min=$rrd_filename:1min:AVERAGE"; $rrd_options .= " DEF:5min=$rrd_filename:5min:AVERAGE"; diff --git a/html/includes/graphs/device/memory_unix.inc.php b/html/includes/graphs/device/ucd_memory.inc.php similarity index 100% rename from html/includes/graphs/device/memory_unix.inc.php rename to html/includes/graphs/device/ucd_memory.inc.php diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php index 9779538f2..993a3d60b 100644 --- a/html/includes/graphs/graph.inc.php +++ b/html/includes/graphs/graph.inc.php @@ -12,6 +12,7 @@ if($_GET['debug']) { include("../config.php"); include("../includes/common.php"); include("../includes/rewrites.php"); + include("includes/functions.inc.php"); include("includes/authenticate.inc.php"); if(!$config['allow_unauth_graphs']) { @@ -47,9 +48,8 @@ if($_GET['debug']) { $graphfile = $config['temp_dir'] . "/" . strgen() . ".png"; - $os = gethostosbyid($device_id); - if($config['os'][$os]['group']) {$os_group = $config['os'][$os]['group'];} - +# $os = gethostosbyid($device_id); +# if($config['os'][$os]['group']) {$os_group = $config['os'][$os]['group'];} # if(is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php")) { # /// Type + OS Specific # include($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php"); @@ -62,6 +62,7 @@ if($_GET['debug']) { # } if(is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php")) { + include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php"); include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php"); } diff --git a/html/map.php b/html/map.php index 68b2ad0c6..73377a657 100755 --- a/html/map.php +++ b/html/map.php @@ -1,5 +1,7 @@ '); -$datas = array('System','Network'); - -if(!$_GET['opta']) { $_GET['opta'] = strtolower($datas[0]); } print_optionbar_start('', ''); $sep = ""; -foreach ($datas as $texttype) +$query = mysql_query("SELECT graph_section FROM device_graphs AS D, graph_types AS G WHERE D.device_id = '".$device['device_id']."' AND G.graph_subtype = D.graph AND G.graph_type = 'device' GROUP BY G.graph_section ORDER BY graph_section"); +while($section = mysql_fetch_assoc($query)) { - $type = strtolower($texttype); + $type = strtolower($section['graph_section']); + if(!$_GET['opta']) { $_GET['opta'] = $type; } echo($sep); if ($_GET['opta'] == $type) { @@ -24,29 +23,24 @@ foreach ($datas as $texttype) { echo(''); } - echo(" " . $texttype ."\n"); + echo(" " . $type ."\n"); if ($_GET['opta'] == $type) { echo(""); } $sep = " | "; } unset ($sep); print_optionbar_end(); -#echo('
'); +$sql = "SELECT * FROM device_graphs AS D, graph_types AS G WHERE D.device_id = '".$device['device_id']."'"; +$sql .=" AND G.graph_subtype = D.graph AND G.graph_type = 'device' AND G.graph_section = '".mres($_GET['opta'])."' ORDER BY graph_order, graph_subtype"; +$query = mysql_query($sql); +while($graph = mysql_fetch_assoc($query)) +{ - include_dir("/html/pages/device/graphs/".mres($_GET['opta'])); + $graph_title = $graph['graph_descr']; + $graph_type = "device_" . $graph['graph_subtype']; + include ("includes/print-device-graph.php"); - #if ($config['os'][$device['os']]['group']) { $os_group = $config['os'][$device['os']]['group']; } - #if (is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os'].".inc.php")) { - # /// OS Specific - # include($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os'].".inc.php"); - #} elseif ($os_group && is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$os_group.".inc.php")) { - # /// OS Group Specific - # include($config['install_dir'] . "/html/pages/device/graphs/os-".$os_group.".inc.php"); - #} else { - # echo("No graph definitions found for OS " . $device['os'] . "!"); - #} - -# echo("
"); +} ?> diff --git a/html/pages/device/graphs/system/cpu.inc.php b/html/pages/device/graphs/cpu.inc.php similarity index 100% rename from html/pages/device/graphs/system/cpu.inc.php rename to html/pages/device/graphs/cpu.inc.php diff --git a/html/pages/device/graphs/fortigate-sessions.inc.php b/html/pages/device/graphs/fortigate-sessions.inc.php new file mode 100644 index 000000000..8c22b9d09 --- /dev/null +++ b/html/pages/device/graphs/fortigate-sessions.inc.php @@ -0,0 +1,9 @@ + diff --git a/html/pages/device/graphs/system/hrprocesses.inc.php b/html/pages/device/graphs/hrprocesses.inc.php similarity index 100% rename from html/pages/device/graphs/system/hrprocesses.inc.php rename to html/pages/device/graphs/hrprocesses.inc.php diff --git a/html/pages/device/graphs/system/hrusers.inc.php b/html/pages/device/graphs/hrusers.inc.php similarity index 100% rename from html/pages/device/graphs/system/hrusers.inc.php rename to html/pages/device/graphs/hrusers.inc.php diff --git a/html/pages/device/graphs/laload.inc.php b/html/pages/device/graphs/laload.inc.php new file mode 100644 index 000000000..6eff33c4e --- /dev/null +++ b/html/pages/device/graphs/laload.inc.php @@ -0,0 +1,4 @@ + diff --git a/html/pages/device/graphs/system/memory.inc.php b/html/pages/device/graphs/memory.inc.php similarity index 100% rename from html/pages/device/graphs/system/memory.inc.php rename to html/pages/device/graphs/memory.inc.php diff --git a/html/pages/device/graphs/network/netstats.inc.php b/html/pages/device/graphs/netstats.inc.php similarity index 100% rename from html/pages/device/graphs/network/netstats.inc.php rename to html/pages/device/graphs/netstats.inc.php diff --git a/html/pages/device/graphs/screenos-sessions.inc.php b/html/pages/device/graphs/screenos-sessions.inc.php new file mode 100644 index 000000000..efab46db8 --- /dev/null +++ b/html/pages/device/graphs/screenos-sessions.inc.php @@ -0,0 +1,10 @@ + diff --git a/html/pages/device/graphs/system/screenos.inc.php b/html/pages/device/graphs/screenos.inc.php similarity index 100% rename from html/pages/device/graphs/system/screenos.inc.php rename to html/pages/device/graphs/screenos.inc.php diff --git a/html/pages/device/graphs/system/laload.inc.php b/html/pages/device/graphs/system/laload.inc.php deleted file mode 100644 index c60cb86fd..000000000 --- a/html/pages/device/graphs/system/laload.inc.php +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/html/pages/device/graphs/system/uptime.inc.php b/html/pages/device/graphs/uptime.inc.php similarity index 100% rename from html/pages/device/graphs/system/uptime.inc.php rename to html/pages/device/graphs/uptime.inc.php diff --git a/html/pages/device/graphs/system/wireless.inc.php b/html/pages/device/graphs/wireless.inc.php similarity index 100% rename from html/pages/device/graphs/system/wireless.inc.php rename to html/pages/device/graphs/wireless.inc.php diff --git a/html/pages/device/health.inc.php b/html/pages/device/health.inc.php index ed04bc914..3e2164efa 100644 --- a/html/pages/device/health.inc.php +++ b/html/pages/device/health.inc.php @@ -2,7 +2,7 @@ $storage = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0); $diskio = mysql_result(mysql_query("select count(*) from ucd_diskio WHERE device_id = '" . $device['device_id'] . "'"), 0); -$memory = mysql_result(mysql_query("select count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"), 0); +$mempools = mysql_result(mysql_query("select count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"), 0); $processor = mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0); $temperatures = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "'"), 0); @@ -14,7 +14,7 @@ $freqs = mysql_result(mysql_query("select count(*) from frequency WHERE device_i $datas[] = 'overview'; if ($processor) { $datas[] = 'processors'; } -if ($memory) { $datas[] = 'memory'; } +if ($mempools) { $datas[] = 'mempools'; } if ($storage) { $datas[] = 'storage'; } if ($diskio) { $datas[] = 'diskio'; } if ($temperatures) { $datas[] = 'temperatures'; } @@ -28,7 +28,7 @@ if ($current) { $datas[] = 'current'; } $type_text['overview'] = "Overview"; $type_text['temperatures'] = "Temperatures"; $type_text['humidity'] = "Humidity"; -$type_text['memory'] = "Memory Pools"; +$type_text['mempools'] = "Memory Pools"; $type_text['storage'] = "Disk Usage"; $type_text['diskio'] = "Disk I/O"; $type_text['processors'] = "Processor Usage"; diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index 92af53be9..f683d1595 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -14,6 +14,8 @@ if(is_numeric($_GET['optd'])) { $to = $_GET['optd']; } else { $to = $now; } if(isset($config['graph'][$type][$subtype])) { $descr = $config['graph'][$type][$subtype]; } else { $descr = $graph_type; } + $descr = mysql_result(mysql_query("SELECT `graph_descr` FROM `graph_types` WHERE `graph_type` = '".$type."' AND `graph_subtype` = '".$subtype."'"),0); + if(is_file("includes/graphs/".$type."/auth.inc.php")) { include("includes/graphs/".$type."/auth.inc.php"); diff --git a/includes/common.php b/includes/common.php index 8f2c1a10e..21a65abf8 100644 --- a/includes/common.php +++ b/includes/common.php @@ -2,6 +2,28 @@ ## Common Functions +function get_port_by_id($port_id) +{ + if(is_numeric($port_id)) { + $port = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '".$port_id."'")); + } + if(is_array($port)){ + return $port; + } else { + return FALSE; + } + +} + +function ifclass($ifOperStatus, $ifAdminStatus) +{ + $ifclass = "interface-upup"; + if ($ifAdminStatus == "down") { $ifclass = "interface-admindown"; } + if ($ifAdminStatus == "up" && $ifOperStatus== "down") { $ifclass = "interface-updown"; } + if ($ifAdminStatus == "up" && $ifOperStatus== "up") { $ifclass = "interface-upup"; } + return $ifclass; +} + function device_by_id_cache($device_id) { global $device_cache; diff --git a/includes/functions.php b/includes/functions.php index 9c3463a40..37ab9ccee 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -89,19 +89,6 @@ function device_array($device_id) return $device; } -function get_port_by_id($port_id) -{ - if(is_numeric($port_id)) { - $port = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '".$port_id."'")); - } - if(is_array($port)){ - return $port; - } else { - return FALSE; - } - -} - function get_device_id_by_interface_id($interface_id) { if(is_numeric($interface_id)) { $device_id = mysql_result(mysql_query("SELECT `device_id` FROM `ports` WHERE `interface_id` = '".$interface_id."'"),0); @@ -406,15 +393,6 @@ function isValidInterface($if) { } else { return 0; } } -function ifclass($ifOperStatus, $ifAdminStatus) -{ - $ifclass = "interface-upup"; - if ($ifAdminStatus == "down") { $ifclass = "interface-admindown"; } - if ($ifAdminStatus == "up" && $ifOperStatus== "down") { $ifclass = "interface-updown"; } - if ($ifAdminStatus == "up" && $ifOperStatus== "up") { $ifclass = "interface-upup"; } - return $ifclass; -} - function utime() { $time = explode( " ", microtime()); diff --git a/includes/polling/hr-mib.inc.php b/includes/polling/hr-mib.inc.php index c4d6e6e9a..c0276ab40 100755 --- a/includes/polling/hr-mib.inc.php +++ b/includes/polling/hr-mib.inc.php @@ -3,14 +3,14 @@ /// HOST-RESOURCES-MIB // Generic System Statistics -$hrSystem_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrSystem.rrd"; - $oid_list = "hrSystemProcesses.0 hrSystemNumUsers.0"; $hrSystem = snmp_get_multi ($device, $oid_list, "-OUQs", "HOST-RESOURCES-MIB"); -if(isset($hrSystem[0]['hrSystemProcesses'])) +echo("HR Stats:"); + +if(is_numeric($hrSystem[0]['hrSystemProcesses'])) { - $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr-processes.rrd"; + $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_processes.rrd"; if (!is_file($rrd_file)) { shell_exec($config['rrdtool'] . " create $rrd_file \ --step 300 \ @@ -24,13 +24,14 @@ if(isset($hrSystem[0]['hrSystemProcesses'])) RRA:MAX:0.5:24:800 \ RRA:MAX:0.5:288:800"); } - rrdtool_update($rrd_file, "N:$hrSystemProcesses"); - $graphs['hrprocesses'] = TRUE; + rrdtool_update($rrd_file, "N:".$hrSystem[0]['hrSystemProcesses']); + $graphs['hr_processes'] = TRUE; + echo(" Processes"); } -if(isset($hrSystem[0]['hrSystemNumUsers'])) +if(is_numeric($hrSystem[0]['hrSystemNumUsers'])) { - $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr-users.rrd"; + $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_users.rrd"; if (!is_file($rrd_file)) { shell_exec($config['rrdtool'] . " create $rrd_file \ --step 300 \ @@ -44,9 +45,11 @@ if(isset($hrSystem[0]['hrSystemNumUsers'])) RRA:MAX:0.5:24:800 \ RRA:MAX:0.5:288:800"); } - rrdtool_update($rrd_file, "N:$hrSystemNumUsers"); - $graphs['hrusers'] = TRUE; + rrdtool_update($rrd_file, "N:".$hrSystem[0]['hrSystemNumUsers']); + $graphs['hr_users'] = TRUE; + echo(" Users"); } +echo("\n"); ?> diff --git a/includes/polling/ipSystemStats.inc.php b/includes/polling/ipSystemStats.inc.php index 47f912a9c..f432fe3ba 100755 --- a/includes/polling/ipSystemStats.inc.php +++ b/includes/polling/ipSystemStats.inc.php @@ -90,9 +90,9 @@ unset($rrdupdate, $rrd_create); ## FIXME per-AF? - - $graphs['ipSystemStats'] = TRUE; - + + $graphs['ipsystemstats_'.$af] = TRUE; + $graphs['ipsystemstats_'.$af.'_frag'] = TRUE; } } diff --git a/includes/polling/netstats-icmp.inc.php b/includes/polling/netstats-icmp.inc.php index 1502ec09e..3369698bd 100755 --- a/includes/polling/netstats-icmp.inc.php +++ b/includes/polling/netstats-icmp.inc.php @@ -42,11 +42,10 @@ if($device[os] != "Snom") { if(isset($data_array[$device['device_id']][0]['icmpInMsgs']) && isset($data_array[$device['device_id']][0]['icmpOutMsgs'])) { if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } rrdtool_update($rrd_file, $rrdupdate); - $graphs['netstats-icmp'] = TRUE; - } - - - unset($oids, $data, $data_array, $oid, $protos); + $graphs['netstat_icmp'] = TRUE; + $graphs['netstat_icmp_info'] = TRUE; + } + unset($oids, $data, $data_array, $oid, $protos); } ?> diff --git a/includes/polling/netstats-ip.inc.php b/includes/polling/netstats-ip.inc.php index 7922ae703..3ea852aaf 100755 --- a/includes/polling/netstats-ip.inc.php +++ b/includes/polling/netstats-ip.inc.php @@ -36,12 +36,11 @@ if($device[os] != "Snom") { $rrdupdate .= ":$value"; } - print_r($data); - if(isset($data[0]['ipOutRequests']) && isset($data[0]['ipInReceives'])) { if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } rrdtool_update($rrd_file, $rrdupdate); - $graphs['netstats-ip'] = TRUE; + $graphs['netstat_ip'] = TRUE; + $graphs['netstat_ip_frag'] = TRUE; } diff --git a/includes/polling/netstats-snmp.inc.php b/includes/polling/netstats-snmp.inc.php index 346a40bfe..9cd0ae3fd 100755 --- a/includes/polling/netstats-snmp.inc.php +++ b/includes/polling/netstats-snmp.inc.php @@ -38,7 +38,8 @@ if($device[os] != "Snom") { if(isset($data_array[$device['device_id']][0]['snmpInPkts']) && isset($data_array[$device['device_id']][0]['snmpOutPkts'])) { if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } rrdtool_update($rrd_file, $rrdupdate); - $graphs['netstats-snmp'] = TRUE; + $graphs['netstat_snmp'] = TRUE; + $graphs['netstat_snmp_pkt'] = TRUE; } unset($oids, $data, $data_array, $oid, $protos); diff --git a/includes/polling/netstats-tcp.inc.php b/includes/polling/netstats-tcp.inc.php index 9238727bb..7f38d6c46 100755 --- a/includes/polling/netstats-tcp.inc.php +++ b/includes/polling/netstats-tcp.inc.php @@ -45,7 +45,7 @@ if($device[os] != "Snom") { if(isset($data[0]['tcpInSegs']) && isset($data[0]['tcpOutSegs'])) { if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } rrdtool_update($rrd_file, $rrdupdate); - $graphs['netstats-tcp'] = TRUE; + $graphs['netstat_tcp'] = TRUE; } unset($oids, $data, $data_array, $oid, $protos); diff --git a/includes/polling/netstats-udp.inc.php b/includes/polling/netstats-udp.inc.php index d7fabe202..43972861e 100755 --- a/includes/polling/netstats-udp.inc.php +++ b/includes/polling/netstats-udp.inc.php @@ -37,7 +37,7 @@ if($device[os] != "Snom") { if(isset($data[0]['udpInDatagrams']) && isset($data[0]['udpOutDatagrams'])) { if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } rrdtool_update($rrd_file, $rrdupdate); - $graphs['netstats-udp'] = TRUE; + $graphs['netstat_udp'] = TRUE; } } unset($oids, $data, $data_array, $oid, $protos, $snmpstring); diff --git a/includes/polling/os/allied.inc.php b/includes/polling/os/allied.inc.php index ec175d7a1..5e00d49bd 100644 --- a/includes/polling/os/allied.inc.php +++ b/includes/polling/os/allied.inc.php @@ -47,6 +47,4 @@ $version = str_replace("\"","", $version); $features = str_replace("\"","", $features); $hardware = str_replace("\"","", $hardware); -include("includes/polling/hr-mib.inc.php"); - ?> diff --git a/includes/polling/os/extremeware.inc.php b/includes/polling/os/extremeware.inc.php index e8f393f61..6d0b959b2 100644 --- a/includes/polling/os/extremeware.inc.php +++ b/includes/polling/os/extremeware.inc.php @@ -41,7 +41,4 @@ $version = str_replace("\"","", $version); $features = str_replace("\"","", $features); $hardware = str_replace("\"","", $hardware); - -include("includes/polling/hr-mib.inc.php"); - ?> diff --git a/includes/polling/os/fortigate.inc.php b/includes/polling/os/fortigate.inc.php index 00051c84f..b6f2462a2 100755 --- a/includes/polling/os/fortigate.inc.php +++ b/includes/polling/os/fortigate.inc.php @@ -10,37 +10,25 @@ $serial = shell_exec($config['snmpget']. " -M ".$config['mibdir']." -m FOR $version = preg_replace("/(.+)\ (.+),(.+),(.+)/", "Fortinet \\1||\\2||\\3||\\4", $fnSysVersion); list($hardware,$version,$features) = explode("||", $version); -$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-cpu.rrd"; -$memrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-memory.rrd"; -$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-sessions.rrd"; +#$cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m FORTINET-MIB-280 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname']; +#$cmd .= " fnSysCpuUsage.0 fnSysMemUsage.0 fnSysSesCount.0 fnSysMemCapacity.0"; +#$data = shell_exec($cmd); +#list ($cpu, $mem, $ses, $memsize) = explode("\n", $data); -$cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m FORTINET-MIB-280 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname']; -$cmd .= " fnSysCpuUsage.0 fnSysMemUsage.0 fnSysSesCount.0 fnSysMemCapacity.0"; -$data = shell_exec($cmd); -list ($cpu, $mem, $ses, $memsize) = explode("\n", $data); +$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate_sessions.rrd"; -if (!is_file($cpurrd)) { - shell_exec($config['rrdtool']." create $cpurrd --step 300 DS:cpu:GAUGE:600:0:100 \ - RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \ - RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800"); -} +$sessions = snmp_get($device, "fnSysSesCount.0", "FORTINET-MIB-280"); -if (!is_file($memrrd)) { - - shell_exec($config['rrdtool'] . " create $memrrd --step 300 \ - DS:mem:GAUGE:600:0:10000000000 DS:memcapacity:GAUGE:600:0:10000000000 \ - RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \ - RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800"); -} - -if (!is_file($sessrrd)) { +if(is_numeric($sessions) +{ + if (!is_file($sessrrd)) + { `rrdtool create $sessrrd --step 300 DS:sessions:GAUGE:600:0:3000000 \ RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \ - RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800`; + RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800`; + } + shell_exec($config['rrdtool'] . " update $sessrrd N:$ses"); + $graphs['fortigate_sessions'] } -shell_exec($config['rrdtool'] . " update $cpurrd N:$cpu"); -shell_exec($config['rrdtool'] . " update $memrrd N:$mem:$memsize"); -shell_exec($config['rrdtool'] . " update $sessrrd N:$ses"); - ?> diff --git a/includes/polling/os/junos.inc.php b/includes/polling/os/junos.inc.php index 4cdf906b3..f7b95efa7 100644 --- a/includes/polling/os/junos.inc.php +++ b/includes/polling/os/junos.inc.php @@ -17,8 +17,6 @@ list($version) = explode("]", $jun_ver); list(,$version) = explode("[", $version); $features = ""; -echo("$hardware - $version - $features - $serial\n"); - $cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/junos-cpu.rrd"; #$cpu_cmd = $config['snmpget'] . " -m JUNIPER-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; @@ -46,6 +44,4 @@ if (is_numeric($cpu_usage)) rrdtool_update($cpurrd, " N:$cpu_usage"); } -include("includes/polling/hr-mib.inc.php"); - ?> diff --git a/includes/polling/os/junose.inc.php b/includes/polling/os/junose.inc.php index 929b2fd91..fb56c21f2 100644 --- a/includes/polling/os/junose.inc.php +++ b/includes/polling/os/junose.inc.php @@ -18,17 +18,10 @@ list(,$version) = explode("(", $version); list($features) = explode("]", $junose_version); list(,$features) = explode("[", $features); -echo("$hardware - $version - $features - $serial\n"); - $cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/junose-cpu.rrd"; #$cpu_cmd = $config['snmpget'] . " -m JUNIPER-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; #$cpu_cmd .= " .1.3.6.1.4.1.2636.3.1.13.1.8.9.1.0.0"; #$cpu_usage = trim(shell_exec($cpu_cmd)); -include("includes/polling/hr-mib.inc.php"); -include("includes/polling/junose-atm-vp.inc.php"); - - - ?> diff --git a/includes/polling/os/redback.inc.php b/includes/polling/os/redback.inc.php index 3c54df787..6eff33c4e 100644 --- a/includes/polling/os/redback.inc.php +++ b/includes/polling/os/redback.inc.php @@ -1,6 +1,4 @@ diff --git a/includes/polling/os/screenos.inc.php b/includes/polling/os/screenos.inc.php index 08607baf4..280571bdc 100755 --- a/includes/polling/os/screenos.inc.php +++ b/includes/polling/os/screenos.inc.php @@ -3,11 +3,9 @@ echo("Doing Juniper Netscreen (ScreenOS)"); $version = preg_replace("/(.+)\ version\ (.+)\ \(SN:\ (.+)\,\ (.+)\)/", "Juniper Netscreen \\1||\\2||\\3||\\4", $sysDescr); -#echo("$version\n"); list($hardware,$version,$serial,$features) = explode("||", $version); $sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/screenos-sessions.rrd"; - $sess_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname']; $sess_cmd .= " .1.3.6.1.4.1.3224.16.3.2.0 .1.3.6.1.4.1.3224.16.3.3.0 .1.3.6.1.4.1.3224.16.3.4.0"; $sess_data = shell_exec($sess_cmd); @@ -30,4 +28,6 @@ if (!is_file($sessrrd)) { rrdtool_update("$sessrrd", "N:$sessalloc:$sessmax:$sessfailed"); +$graphs['netscreen_sessions'] = TRUE; + ?> diff --git a/includes/polling/os/speedtouch.inc.php b/includes/polling/os/speedtouch.inc.php index 6313e5df8..1dc0121bc 100644 --- a/includes/polling/os/speedtouch.inc.php +++ b/includes/polling/os/speedtouch.inc.php @@ -17,8 +17,4 @@ if($loop) { $version = $matches[1]; } -echo("$hardware - $version - $features - $serial\n"); - -#include("hr-mib.inc.php"); - ?> diff --git a/includes/polling/os/unix.inc.php b/includes/polling/os/unix.inc.php index 5278ae51f..27ff37c27 100755 --- a/includes/polling/os/unix.inc.php +++ b/includes/polling/os/unix.inc.php @@ -46,7 +46,4 @@ if(strpos($hw, "No") !== FALSE) { unset($hw); } else { $hardware = "Dell " . $hw; } } -echo("$version - $hardware - $features "); - -include("includes/polling/ucd-mib.inc.php"); -include("includes/polling/hr-mib.inc.php"); +?> diff --git a/includes/polling/os/windows.inc.php b/includes/polling/os/windows.inc.php index f4526e191..52d93f4da 100755 --- a/includes/polling/os/windows.inc.php +++ b/includes/polling/os/windows.inc.php @@ -32,7 +32,4 @@ ### Detect processor type? : I.E. x86 Family 15 Model 2 Stepping 7 -include("includes/polling/ucd-mib.inc.php"); -include("includes/polling/hr-mib.inc.php"); - ?> diff --git a/includes/polling/ucd-mib.inc.php b/includes/polling/ucd-mib.inc.php index cc96ba12a..5d5a7d0f7 100755 --- a/includes/polling/ucd-mib.inc.php +++ b/includes/polling/ucd-mib.inc.php @@ -52,6 +52,7 @@ ### This is how we currently collect. We should collect one RRD per stat, for ease of handling differen formats, ### and because it is per-host and no big performance hit. See new format below + ### FIXME REMOVE if(is_numeric($ss['ssCpuRawUser']) && is_numeric($ss['ssCpuRawNice']) && is_numeric($ss['ssCpuRawSystem']) && is_numeric($ss['ssCpuRawIdle'])) { @@ -78,9 +79,18 @@ rrdtool_create($filename, " --step 300 DS:value:COUNTER:600:0:U RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800"); } rrdtool_update($filename, "N:".$value); + $graphs['ucd_cpu'] = TRUE; } } + ### Set various graphs if we've seen the right OIDs. + + if(is_numeric($ss['ssRawSwapIn'])) { $graphs['ucd_swap_io'] = TRUE; } + if(is_numeric($ss['ssIORawSent'])) { $graphs['ucd_io'] = TRUE; } + if(is_numeric($ss['ssRawContexts'])) { $graphs['ucd_contexts'] = TRUE; } + if(is_numeric($ss['ssRawInterrupts'])) { $graphs['ucd_interrupts'] = TRUE; } + + ############################################################################################################################################ ### Poll mem for load memory utilisation stats on UNIX-like hosts running UCD/Net-SNMPd @@ -130,6 +140,7 @@ rrdtool_create($mem_rrd, $mem_rrd_create); } rrdtool_update($mem_rrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:".($memShared+0).":".($memBuffer+0).":".($memCached+0)); + $graphs['ucd_memory'] = TRUE; } ########################################################################################################################################################## @@ -164,4 +175,5 @@ rrdtool_create($load_rrd, $la_load_create); } rrdtool_update($load_rrd, "N:$load1:$load5:$load10"); + $graphs['ucd_load'] = "TRUE"; } diff --git a/includes/rewrites.php b/includes/rewrites.php index eb4d1e9fa..174e081df 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -12,7 +12,7 @@ function ifNameDescr($interface, $device = NULL) { function ifLabel ($interface, $device = NULL) { global $config; - if(!$device) { $device = device_array($interface['device_id']); } + if(!$device) { $device = device_by_id_cache($interface['device_id']); } $os = strtolower($device['os']); if (isset($config['os'][$os]['ifname'])) { diff --git a/includes/static-config.php b/includes/static-config.php index e6124c0fa..9de0917b3 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -7,9 +7,9 @@ $config['afi']['ipv4']['vpn'] = "VPNv4"; $config['afi']['ipv6']['unicast'] = "IPv6"; $config['afi']['ipv6']['multicast'] = "IPv6 Multicast"; -$config['os']['default']['over'][0]['graph'] = "device_cpu"; +$config['os']['default']['over'][0]['graph'] = "device_processors"; $config['os']['default']['over'][0]['text'] = "Processor Usage"; -$config['os']['default']['over'][1]['graph'] = "device_memory"; +$config['os']['default']['over'][1]['graph'] = "device_mempools"; $config['os']['default']['over'][1]['text'] = "Memory Usage"; $os = "generic"; @@ -65,9 +65,9 @@ $config['os'][$os]['type'] = "network"; $config['os'][$os]['ifXmcbc'] = 1; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; -$config['os'][$os]['over'][1]['graph'] = "device_cpu"; +$config['os'][$os]['over'][1]['graph'] = "device_processors"; $config['os'][$os]['over'][1]['text'] = "CPU Usage"; -$config['os'][$os]['over'][2]['graph'] = "device_memory"; +$config['os'][$os]['over'][2]['graph'] = "device_mempools"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "cat1900"; @@ -134,9 +134,9 @@ $config['os'][$os]['type'] = "network"; $config['os'][$os]['nobulk'] = 1; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; -$config['os'][$os]['over'][1]['graph'] = "device_cpu"; +$config['os'][$os]['over'][1]['graph'] = "device_processors"; $config['os'][$os]['over'][1]['text'] = "CPU Usage"; -$config['os'][$os]['over'][2]['graph'] = "device_memory"; +$config['os'][$os]['over'][2]['graph'] = "device_mempools"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "junose"; @@ -188,9 +188,9 @@ $config['os'][$os]['ifname'] = 1; $config['os'][$os]['type'] = "network"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; -$config['os'][$os]['over'][1]['graph'] = "device_cpu"; +$config['os'][$os]['over'][1]['graph'] = "device_processors"; $config['os'][$os]['over'][1]['text'] = "CPU Usage"; -#$config['os'][$os]['over'][2]['graph'] = "device_memory"; +#$config['os'][$os]['over'][2]['graph'] = "device_mempools"; #$config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "powervault"; @@ -438,6 +438,17 @@ $config['graph']['device']['processors'] = "Processor Usage"; $config['graph']['device']['cpu'] = "Processor Usage"; $config['graph']['device']['storage'] = "Disk Usage"; +$config['graph']['device']['ucd_load'] = "Load Averages"; +$config['graph']['device']['ucd_cpu'] = "Detailed Processor Usage"; +$config['graph']['device']['ucd_mem'] = "Detailed Memory Usage"; +$config['graph']['device']['netstats_tcp'] = "TCP Statistics"; +$config['graph']['device']['netstats_icmp_info'] = "ICMP Informational Statistics"; +$config['graph']['device']['netstats_icmp_stat'] = "ICMP Statistics"; +$config['graph']['device']['netstats_ip'] = "IP Statistics"; +$config['graph']['device']['netstats_ip_frag'] = "IP Fragmentation Statistics"; +$config['graph']['device']['netstats_udp'] = "UDP Statistics"; +$config['graph']['device']['netstats_snmp'] = "SNMP Statistics"; + ############################## diff --git a/poller.php b/poller.php index 40bd71794..886db0ff0 100755 --- a/poller.php +++ b/poller.php @@ -94,19 +94,33 @@ while ($device = mysql_fetch_array($device_query)) if ($status == "1") { + + $graphs = array(); + $snmp_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; $snmp_cmd .= " sysUpTime.0 sysLocation.0 sysContact.0 sysName.0"; $snmpdata = str_replace('"','',trim(shell_exec($snmp_cmd))); list($sysUptime, $sysLocation, $sysContact, $sysName) = explode("\n", $snmpdata); - $snmp_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; - $snmp_cmd .= " HOST-RESOURCES-MIB::hrSystemUptime.0"; - $snmpdata = str_replace('"','',trim(shell_exec($snmp_cmd))); - list($hrSystemUptime) = explode("\n", $snmpdata); $sysDescr = trim(shell_exec($config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " sysDescr.0")); $sysName = strtolower($sysName); + $hrSystemUptime = snmp_get($device, ".1.3.6.1.2.1.25.1.1.0", "-Oqv", "HOST-RESOURCES-MIB"); + + echo("UPTIMES: ".$hrSystemUptime."|".$sysUptime."]"); + + #SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31 + $sysUptime = str_replace("(", "", $sysUptime); + $sysUptime = str_replace(")", "", $sysUptime); + list($days, $hours, $mins, $secs) = explode(":", $sysUptime); + list($secs, $microsecs) = explode(".", $secs); + $hours = $hours + ($days * 24); + $mins = $mins + ($hours * 60); + $secs = $secs + ($mins * 60); + $uptime = $secs; + if ($hrSystemUptime != "No Such Object available on this agent at this OID" && $hrSystemUptime != "") { + $agent_uptime = $uptime; ## Move uptime into agent_uptime #HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (63050465) 7 days, 7:08:24.65 $hrSystemUptime = str_replace("(", "", $hrSystemUptime); $hrSystemUptime = str_replace(")", "", $hrSystemUptime); @@ -118,21 +132,12 @@ while ($device = mysql_fetch_array($device_query)) $uptime = $secs; if ($device['os'] == "windows") { $uptime /= 10; } } - else - { - #SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31 - $sysUptime = str_replace("(", "", $sysUptime); - $sysUptime = str_replace(")", "", $sysUptime); - list($days, $hours, $mins, $secs) = explode(":", $sysUptime); - list($secs, $microsecs) = explode(".", $secs); - $hours = $hours + ($days * 24); - $mins = $mins + ($hours * 60); - $secs = $secs + ($mins * 60); - $uptime = $secs; - } - if ($uptime) + if (is_numeric($uptime)) { + + $graphs['uptime'] = TRUE; + if ( $uptime < $device['uptime'] ) { notify($device,"Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago."); log_event('Device rebooted after '.formatUptime($device['uptime']), $device['device_id'], 'reboot', $device['uptime']); @@ -184,6 +189,8 @@ while ($device = mysql_fetch_array($device_query)) include("includes/polling/mempools.inc.php"); include("includes/polling/storage.inc.php"); include("includes/polling/netstats.inc.php"); + include("includes/polling/hr-mib.inc.php"); + include("includes/polling/ucd-mib.inc.php"); include("includes/polling/ipSystemStats.inc.php"); include("includes/polling/ports.inc.php"); include("includes/polling/altiga-ssl.inc.php"); @@ -252,12 +259,34 @@ while ($device = mysql_fetch_array($device_query)) } + ## FIX ME EVENTLOGGING + ### This code cycles through the graphs already known in the database and the ones we've defined as being polled here + ### If there any don't match, they're added/deleted from the database. + ### Ideally we should hold graphs for xx days/weeks/polls so that we don't needlessly hide information. + + $query = mysql_query("SELECT `graph` FROM `device_graphs` WHERE `device_id` = '".$device['device_id']."'"); + while($graph = mysql_fetch_array($query)){ + if(!isset($graphs[$graph[0]])) + { + mysql_query("DELETE FROM `device_graphs` WHERE `device_id` = '".$device['device_id']."' AND `graph` = '".$graph[0]."'"); + } else { + $oldgraphs[$graph[0]] = TRUE; + } + } + foreach($graphs as $graph => $value) + { + if(!isset($oldgraphs[$graph])) + { + mysql_query("INSERT INTO `device_graphs` (`device_id`, `graph`) VALUES ('".$device['device_id']."','".$graph."')"); + } + } + + $device_end = utime(); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5); $poll_update .= $poll_separator . "`last_polled_timetaken` = '$device_time'"; echo("$device_end - $device_start; $device_time $device_run"); echo("Polled in $device_time seconds\n"); - $poll_update_query = "UPDATE `devices` SET "; $poll_update_query .= $poll_update; $poll_update_query .= " WHERE `device_id` = '" . $device['device_id'] . "'";