From 65176c00bd7848060754b0df593abd89a4994ab9 Mon Sep 17 00:00:00 2001 From: wiad Date: Mon, 18 Jan 2016 13:51:39 +0100 Subject: [PATCH 1/6] Addes support for infoblox devices --- .../graphs/device/ib_dhcp_messages.inc.php | 57 ++++++ .../graphs/device/ib_dns_dyn_updates.inc.php | 50 +++++ .../graphs/device/ib_dns_performance.inc.php | 48 +++++ .../ib_dns_request_return_codes.inc.php | 52 +++++ includes/definitions.inc.php | 87 +++----- includes/discovery/os/nios.inc.php | 10 + includes/polling/os/nios.inc.php | 191 ++++++++++++++++++ 7 files changed, 439 insertions(+), 56 deletions(-) create mode 100644 html/includes/graphs/device/ib_dhcp_messages.inc.php create mode 100644 html/includes/graphs/device/ib_dns_dyn_updates.inc.php create mode 100644 html/includes/graphs/device/ib_dns_performance.inc.php create mode 100644 html/includes/graphs/device/ib_dns_request_return_codes.inc.php create mode 100644 includes/discovery/os/nios.inc.php create mode 100644 includes/polling/os/nios.inc.php diff --git a/html/includes/graphs/device/ib_dhcp_messages.inc.php b/html/includes/graphs/device/ib_dhcp_messages.inc.php new file mode 100644 index 000000000..6c43a47e8 --- /dev/null +++ b/html/includes/graphs/device/ib_dhcp_messages.inc.php @@ -0,0 +1,57 @@ + '#FFAB00FF', + 'ack' => '#007283FF', + 'discover' => '#74C366FF', + 'offer' => '#B1441EFF', + 'inform' => '#8D85F3FF', + 'nack' => '#FAFD9EFF', + 'release' => '#96E78AFF', + 'decline' => '#FF0000FF', + 'other' => '#8F9286FF', +); + +$i = 0; +foreach ($stats as $stat => $color) { + $i++; + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = ucfirst ($stat); + $rrd_list[$i]['ds'] = $stat; + + # Set up DEFs + $rrd_options .= " DEF:".$stat."=".$rrd_filename.':'.$stat.':AVERAGE '; + + # Set up CDEFS to multiply with 60 to get per minute value + $rrd_options .= " 'CDEF:cdef".$stat."=".$stat.",60,*'"; + + # Set up area graphing with stacking + if ( $i == "0" ) { + $rrd_options .= " 'AREA:cdef".$stat . $color.":".ucfirst($stat)."'"; + } else { + $rrd_options .= " 'AREA:cdef".$stat . $color.":".ucfirst($stat).":STACK'"; + } + + # Set up legend, with consistent indent + $filler = 8 - strlen($stat); + $current_pad = str_pad("", $filler, ' ', STR_PAD_LEFT); + $rrd_options .= " 'GPRINT:cdef".$stat.":LAST:".$current_pad."Current\:%8.0lf'"; + $rrd_options .= " 'GPRINT:cdef".$stat.":AVERAGE:Average\:%8.0lf'"; + $rrd_options .= " 'GPRINT:cdef".$stat.":MAX:Maximum\:%8.0lf\\n'"; +} + +// Set up Total value +$rrd_options .= " 'CDEF:cdeftotal=cdefrequest,cdefack,cdefdiscover,cdefoffer, + cdefinform,cdefnack,cdefrelease,cdefdecline,cdefother,+,+,+,+,+,+,+,+'"; +$rrd_options .= " 'LINE1:cdeftotal#000000FF:Total'"; +$filler = 8 - strlen("Total"); +$current_pad = str_pad("", $filler, ' ', STR_PAD_LEFT); +$rrd_options .= " 'GPRINT:cdeftotal:LAST:".$current_pad."Current\:%8.0lf'"; +$rrd_options .= " 'GPRINT:cdeftotal:AVERAGE:Average\:%8.0lf'"; +$rrd_options .= " 'GPRINT:cdeftotal:MAX:Maximum\:%8.0lf\\n'"; + diff --git a/html/includes/graphs/device/ib_dns_dyn_updates.inc.php b/html/includes/graphs/device/ib_dns_dyn_updates.inc.php new file mode 100644 index 000000000..e5e511ba8 --- /dev/null +++ b/html/includes/graphs/device/ib_dns_dyn_updates.inc.php @@ -0,0 +1,50 @@ + '#74C366FF', + 'failure' => '#007283FF', + 'reject' => '#FFAB00FF', + 'prereq_reject' => '#B1441EFF', +); + +$i = 0; +foreach ($stats as $stat => $color) { + $i++; + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = ucfirst ($stat); + $rrd_list[$i]['ds'] = $stat; + + # Set up DEFs + $rrd_options .= " DEF:".$stat."=".$rrd_filename.':'.$stat.':AVERAGE '; + + # Set up CDEFS to multiply with 60 to get per minute value + $rrd_options .= " 'CDEF:cdef".$stat."=".$stat.",60,*'"; + + # Set up area graphing with stacking + if ( $i == "0" ) { + $rrd_options .= " 'AREA:cdef".$stat . $color.":".$stat."'"; + } else { + $rrd_options .= " 'AREA:cdef".$stat . $color.":".$stat.":STACK'"; + } + + # Set up legend, with consistent indent + $filler = 15 - strlen($stat); + $current_pad = str_pad("", $filler, ' ', STR_PAD_LEFT); + $rrd_options .= " 'GPRINT:cdef".$stat.":LAST: ".$current_pad."Current\:%8.0lf'"; + $rrd_options .= " 'GPRINT:cdef".$stat.":AVERAGE:Average\:%8.0lf'"; + $rrd_options .= " 'GPRINT:cdef".$stat.":MAX:Maximum\:%8.0lf\\n'"; +} + +# Add total value +$rrd_options .= " 'CDEF:cdeftotal=cdefsuccess,cdeffailure,cdefreject,cdefprereq_reject,+,+,+'"; +$rrd_options .= " 'LINE1:cdeftotal#000000FF:Total'"; +$filler = 16 - strlen("Total"); +$current_pad = str_pad("", $filler, ' ', STR_PAD_LEFT); +$rrd_options .= " 'GPRINT:cdeftotal:LAST:".$current_pad."Current\:%8.0lf'"; +$rrd_options .= " 'GPRINT:cdeftotal:AVERAGE:Average\:%8.0lf'"; +$rrd_options .= " 'GPRINT:cdeftotal:MAX:Maximum\:%8.0lf\\n'"; diff --git a/html/includes/graphs/device/ib_dns_performance.inc.php b/html/includes/graphs/device/ib_dns_performance.inc.php new file mode 100644 index 000000000..f97c1eb9b --- /dev/null +++ b/html/includes/graphs/device/ib_dns_performance.inc.php @@ -0,0 +1,48 @@ + '#74C366FF', + 'PerfnonAA' => '#007283FF', +); + +$i = 0; +foreach ($stats as $stat => $color) { + $i++; + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = ucfirst ($stat); + $rrd_list[$i]['ds'] = $stat; + + # Set up DEFs + $rrd_options .= " DEF:".$stat."=".$rrd_filename.':'.$stat.':AVERAGE '; + + # Set up area graphing with stacking + if ( $i == "0" ) { + $rrd_options .= " 'AREA:".$stat . $color.":".$stat."'"; + } else { + $rrd_options .= " 'AREA:".$stat . $color.":".$stat.":STACK'"; + } + + # Set up legend, with consistent indent + $filler = 15 - strlen($stat); + $current_pad = str_pad("", $filler, ' ', STR_PAD_LEFT); + $rrd_options .= " 'GPRINT:".$stat.":LAST: ".$current_pad."Current\:%8.0lf'"; + $rrd_options .= " 'GPRINT:".$stat.":AVERAGE:Average\:%8.0lf'"; + $rrd_options .= " 'GPRINT:".$stat.":MAX:Maximum\:%8.0lf\\n'"; +} + +# Add total value +$rrd_options .= " 'CDEF:cdeftotal=PerfAA,PerfnonAA,+'"; +$rrd_options .= " 'LINE1:cdeftotal#000000FF:Total'"; +$filler = 16 - strlen("Total"); +$current_pad = str_pad("", $filler, ' ', STR_PAD_LEFT); +$rrd_options .= " 'GPRINT:cdeftotal:LAST:".$current_pad."Current\:%8.0lf'"; +$rrd_options .= " 'GPRINT:cdeftotal:AVERAGE:Average\:%8.0lf'"; +$rrd_options .= " 'GPRINT:cdeftotal:MAX:Maximum\:%8.0lf\\n'"; + diff --git a/html/includes/graphs/device/ib_dns_request_return_codes.inc.php b/html/includes/graphs/device/ib_dns_request_return_codes.inc.php new file mode 100644 index 000000000..180f6ebd4 --- /dev/null +++ b/html/includes/graphs/device/ib_dns_request_return_codes.inc.php @@ -0,0 +1,52 @@ + '#74C366FF', + 'failure' => '#007283FF', + 'nxdomain' => '#FFAB00FF', + 'nxrrset' => '#B1441EFF', +); + +$i = 0; +foreach ($stats as $stat => $color) { + $i++; + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = ucfirst ($stat); + $rrd_list[$i]['ds'] = $stat; + + # Set up DEFs + $rrd_options .= " DEF:".$stat."=".$rrd_filename.':'.$stat.':AVERAGE '; + + # Set up CDEFS to multiply with 1 to get per second value + $rrd_options .= " 'CDEF:cdef".$stat."=".$stat.",1,*'"; + + # Set up area graphing with stacking + if ( $i == "0" ) { + $rrd_options .= " 'AREA:cdef".$stat . $color.":".ucfirst($stat)."'"; + } else { + $rrd_options .= " 'AREA:cdef".$stat . $color.":".ucfirst($stat).":STACK'"; + } + + # Set up legend, with consistent indent + $filler = 15 - strlen($stat); + $current_pad = str_pad("", $filler, ' ', STR_PAD_LEFT); + $rrd_options .= " 'GPRINT:cdef".$stat.":LAST: ".$current_pad."Current\:%8.0lf%s'"; + $rrd_options .= " 'GPRINT:cdef".$stat.":AVERAGE:Average\:%8.0lf'"; + $rrd_options .= " 'GPRINT:cdef".$stat.":MAX:Maximum\:%8.0lf\\n'"; + + $statstring .= "cdef".$stat.","; +} + +# Add total value +$rrd_options .= " 'CDEF:cdeftotal=".$statstring."+,+,+'"; +$rrd_options .= " 'LINE1:cdeftotal#000000FF:Total'"; +$filler = 16 - strlen("Total"); +$current_pad = str_pad("", $filler, ' ', STR_PAD_LEFT); +$rrd_options .= " 'GPRINT:cdeftotal:LAST:".$current_pad."Current\:%8.0lf'"; +$rrd_options .= " 'GPRINT:cdeftotal:AVERAGE:Average\:%8.0lf'"; +$rrd_options .= " 'GPRINT:cdeftotal:MAX:Maximum\:%8.0lf\\n'"; diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 26f58e992..c3300e0d9 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -1,5 +1,6 @@ $ds1, + 'failure' => $ds2, + 'reject' => $ds3, + 'prereq_reject' => $ds4, +); + + +rrdtool_update($rrdfile, $fields); +$graphs['ib_dns_dyn_updates'] = true; + + +################## +# Create dns performance graph (latency) +################## +$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/ib_dns_performance.rrd'; + +$mibs = '+IB-PLATFORMONE-MIB'; +$oids = ' + IB-PLATFORMONE-MIB::ibNetworkMonitorDNSNonAAT1AvgLatency.0 + IB-PLATFORMONE-MIB::ibNetworkMonitorDNSAAT1AvgLatency.0'; + +$data = snmp_get_multi( + $device, + $oids, + '-OQUs', + $mibs); + +$ds1 = $data[0]['ibNetworkMonitorDNSAAT1AvgLatency']; +$ds2 = $data[0]['ibNetworkMonitorDNSNonAAT1AvgLatency']; + +if (!is_file($rrdfile)) { + rrdtool_create( + $rrdfile, + 'DS:PerfAA:GAUGE:600:0:U + DS:PerfnonAA:GAUGE:600:0:U '.$config['rrd_rra']); +} + +$fields = array( + 'PerfAA' => $ds1, + 'PerfnonAA' => $ds2, +); + +rrdtool_update($rrdfile, $fields); +$graphs['ib_dns_performance'] = true; + +################## +# Create dns request return code graph +################## +$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/ib_dns_request_return_codes.rrd'; + +$mibs = '+IB-DNSONE-MIB'; +$oids = ' + IB-DNSONE-MIB::ibBindZoneFailure.\"summary\" + IB-DNSONE-MIB::ibBindZoneNxDomain.\"summary\" + IB-DNSONE-MIB::ibBindZoneNxRRset.\"summary\" + IB-DNSONE-MIB::ibBindZoneSuccess.\"summary\"'; + +$data = snmp_get_multi( + $device, + $oids, + '-OQUs', + $mibs); + +$ds1 = $data['"summary"']['ibBindZoneSuccess']; +$ds2 = $data['"summary"']['ibBindZoneFailure']; +$ds3 = $data['"summary"']['ibBindZoneNxDomain']; +$ds4 = $data['"summary"']['ibBindZoneNxRRset']; + + +if (!is_file($rrdfile)) { + rrdtool_create( + $rrdfile, + 'DS:success:DERIVE:600:0:U + DS:failure:DERIVE:600:0:U + DS:nxdomain:DERIVE:600:0:U + DS:nxrrset:DERIVE:600:0:U '.$config['rrd_rra']); +} + +$fields = array( + 'success' => $ds1, + 'failure' => $ds2, + 'nxdomain' => $ds3, + 'nxrrset' => $ds4, +); + +rrdtool_update($rrdfile, $fields); +$graphs['ib_dns_request_return_codes'] = true; + + +################## +# Create dhcp messages graph +################## +$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/ib_dhcp_messages.rrd'; + +$mibs = '+IB-DHCPONE-MIB'; +$oids = ' + IB-DHCPONE-MIB::ibDhcpTotalNoOfAcks.0 + IB-DHCPONE-MIB::ibDhcpTotalNoOfDeclines.0 + IB-DHCPONE-MIB::ibDhcpTotalNoOfDiscovers.0 + IB-DHCPONE-MIB::ibDhcpTotalNoOfInforms.0 + IB-DHCPONE-MIB::ibDhcpTotalNoOfNacks.0 + IB-DHCPONE-MIB::ibDhcpTotalNoOfOffers.0 + IB-DHCPONE-MIB::ibDhcpTotalNoOfOthers.0 + IB-DHCPONE-MIB::ibDhcpTotalNoOfReleases.0 + IB-DHCPONE-MIB::ibDhcpTotalNoOfRequests.0'; + +$data = snmp_get_multi( + $device, + $oids, + '-OQUs', + $mibs); + +$ds1 = $data[0]['ibDhcpTotalNoOfAcks']; +$ds2 = $data[0]['ibDhcpTotalNoOfDeclines']; +$ds3 = $data[0]['ibDhcpTotalNoOfDiscovers']; +$ds4 = $data[0]['ibDhcpTotalNoOfInforms']; +$ds5 = $data[0]['ibDhcpTotalNoOfNacks']; +$ds6 = $data[0]['ibDhcpTotalNoOfOffers']; +$ds7 = $data[0]['ibDhcpTotalNoOfOthers']; +$ds8 = $data[0]['ibDhcpTotalNoOfReleases']; +$ds9 = $data[0]['ibDhcpTotalNoOfRequests']; + +if (!is_file($rrdfile)) { + rrdtool_create( + $rrdfile, + 'DS:ack:DERIVE:600:0:U + DS:decline:DERIVE:600:0:U + DS:discover:DERIVE:600:0:U + DS:inform:DERIVE:600:0:U + DS:nack:DERIVE:600:0:U + DS:offer:DERIVE:600:0:U + DS:other:DERIVE:600:0:U + DS:release:DERIVE:600:0:U + DS:request:DERIVE:600:0:U '.$config['rrd_rra']); +} + +$fields = array( + 'ack' => $ds1, + 'decline' => $ds2, + 'discover' => $ds3, + 'inform' => $ds4, + 'nack' => $ds5, + 'offer' => $ds6, + 'other' => $ds7, + 'release' => $ds8, + 'request' => $ds9, +); + +rrdtool_update($rrdfile, $fields); +$graphs['ib_dhcp_messages'] = true; + + From 4a0cc1609373db26f6a0f52d1d44dfe97679af96 Mon Sep 17 00:00:00 2001 From: wiad Date: Mon, 18 Jan 2016 14:48:39 +0100 Subject: [PATCH 2/6] add infoblox --- includes/definitions.inc.php | 67 ++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index c3300e0d9..6e124ba3a 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -1,6 +1,5 @@ Date: Tue, 19 Jan 2016 08:03:30 +0100 Subject: [PATCH 3/6] Fixed syntax error in line continuation --- includes/polling/os/nios.inc.php | 77 +++++++++++++------------------- 1 file changed, 30 insertions(+), 47 deletions(-) diff --git a/includes/polling/os/nios.inc.php b/includes/polling/os/nios.inc.php index 11291a454..3f6d4ccfc 100644 --- a/includes/polling/os/nios.inc.php +++ b/includes/polling/os/nios.inc.php @@ -1,8 +1,8 @@ Date: Tue, 19 Jan 2016 10:59:13 +0100 Subject: [PATCH 4/6] fix if statement style --- html/includes/graphs/device/ib_dhcp_messages.inc.php | 3 ++- html/includes/graphs/device/ib_dns_dyn_updates.inc.php | 3 ++- html/includes/graphs/device/ib_dns_performance.inc.php | 3 ++- .../includes/graphs/device/ib_dns_request_return_codes.inc.php | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/html/includes/graphs/device/ib_dhcp_messages.inc.php b/html/includes/graphs/device/ib_dhcp_messages.inc.php index 6c43a47e8..246f579f0 100644 --- a/html/includes/graphs/device/ib_dhcp_messages.inc.php +++ b/html/includes/graphs/device/ib_dhcp_messages.inc.php @@ -33,7 +33,8 @@ foreach ($stats as $stat => $color) { # Set up area graphing with stacking if ( $i == "0" ) { $rrd_options .= " 'AREA:cdef".$stat . $color.":".ucfirst($stat)."'"; - } else { + } + else { $rrd_options .= " 'AREA:cdef".$stat . $color.":".ucfirst($stat).":STACK'"; } diff --git a/html/includes/graphs/device/ib_dns_dyn_updates.inc.php b/html/includes/graphs/device/ib_dns_dyn_updates.inc.php index e5e511ba8..b59214185 100644 --- a/html/includes/graphs/device/ib_dns_dyn_updates.inc.php +++ b/html/includes/graphs/device/ib_dns_dyn_updates.inc.php @@ -28,7 +28,8 @@ foreach ($stats as $stat => $color) { # Set up area graphing with stacking if ( $i == "0" ) { $rrd_options .= " 'AREA:cdef".$stat . $color.":".$stat."'"; - } else { + } + else { $rrd_options .= " 'AREA:cdef".$stat . $color.":".$stat.":STACK'"; } diff --git a/html/includes/graphs/device/ib_dns_performance.inc.php b/html/includes/graphs/device/ib_dns_performance.inc.php index f97c1eb9b..17b8d8b09 100644 --- a/html/includes/graphs/device/ib_dns_performance.inc.php +++ b/html/includes/graphs/device/ib_dns_performance.inc.php @@ -25,7 +25,8 @@ foreach ($stats as $stat => $color) { # Set up area graphing with stacking if ( $i == "0" ) { $rrd_options .= " 'AREA:".$stat . $color.":".$stat."'"; - } else { + } + else { $rrd_options .= " 'AREA:".$stat . $color.":".$stat.":STACK'"; } diff --git a/html/includes/graphs/device/ib_dns_request_return_codes.inc.php b/html/includes/graphs/device/ib_dns_request_return_codes.inc.php index 180f6ebd4..21504dd81 100644 --- a/html/includes/graphs/device/ib_dns_request_return_codes.inc.php +++ b/html/includes/graphs/device/ib_dns_request_return_codes.inc.php @@ -28,7 +28,8 @@ foreach ($stats as $stat => $color) { # Set up area graphing with stacking if ( $i == "0" ) { $rrd_options .= " 'AREA:cdef".$stat . $color.":".ucfirst($stat)."'"; - } else { + } + else { $rrd_options .= " 'AREA:cdef".$stat . $color.":".ucfirst($stat).":STACK'"; } From 71195bcd859d30e43e40272261c8a0dc6ac33889 Mon Sep 17 00:00:00 2001 From: wiad Date: Tue, 19 Jan 2016 12:01:44 +0100 Subject: [PATCH 5/6] fix syntax --- includes/definitions.inc.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 89f85f7ee..badb80824 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -1440,13 +1440,11 @@ $config['os'][$os]['over'][1]['text'] = 'CPU Usage'; $config['os'][$os]['over'][2]['graph'] = 'device_mempool'; $config['os'][$os]['over'][2]['text'] = 'Memory Usage'; -<<<<<<< HEAD $os = 'nios'; $config['os'][$os]['text'] = 'Infoblox'; $config['os'][$os]['type'] = 'appliance'; $config['os'][$os]['icon'] = 'infoblox'; -======= // Lenovo EMC (NAS) $os = 'lenovoemc'; $config['os'][$os]['type'] = 'storage'; @@ -1459,7 +1457,6 @@ $config['os'][$os]['over'][1]['graph'] = 'device_processor'; $config['os'][$os]['over'][1]['text'] = 'CPU Usage'; $config['os'][$os]['over'][2]['graph'] = 'device_mempool'; $config['os'][$os]['over'][2]['text'] = 'Memory Usage'; ->>>>>>> ded1fa3e73bcd99f03259cc449e8cd816664a158 // Graph Types require_once $config['install_dir'].'/includes/load_db_graph_types.inc.php'; From 2883759c9389593351dd3b0c6e124a79a48de039 Mon Sep 17 00:00:00 2001 From: wiad Date: Tue, 19 Jan 2016 12:02:47 +0100 Subject: [PATCH 6/6] fix syntax --- includes/discovery/os/nios.inc.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/includes/discovery/os/nios.inc.php b/includes/discovery/os/nios.inc.php index 9d429abde..db0b0a63e 100644 --- a/includes/discovery/os/nios.inc.php +++ b/includes/discovery/os/nios.inc.php @@ -4,7 +4,3 @@ if (!$os || $os === 'linux') { $os = 'nios'; } } - - - -