F5 gtm support (#8161)

* initial

* commited correct version of f5-ltm-inc.php

* cleaned up comments

* cleaned up formating for travis

* split GTM discovery from LTM discovery module

* removed blank line at EOF

* updated per comments
This commit is contained in:
dnapper
2018-02-01 22:35:23 -07:00
committed by Tony Murray
parent 8163112c72
commit a347e7c8d3
25 changed files with 1374 additions and 1 deletions

View File

@@ -0,0 +1,52 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-pool');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
include "includes/graphs/common.inc.php";
$rrd_options .= " -l 0 -E ";
$rrd_options .= " COMMENT:'GTM Pool Dropped Requests Now Avg Max\\n'";
$colours = array_merge($config['graph_colours']['mixed'], $config['graph_colours']['manycolours']);
$colcount = 0;
$count = 0;
// add all GTM Wide IP Request on this device.
foreach ($components as $compid => $comp) {
$label = $comp['label'];
$hash = $comp['hash'];
$rrd_filename = rrd_name($device['hostname'], array($comp['type'], $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
// Grab a colour from the array.
if (isset($colours[$colcount])) {
$colour = $colours[$colcount];
} else {
$colcount = 0;
$colour = $colours[$colcount];
}
$rrd_options .= " DEF:DS" . $count . "=" . $rrd_filename . ":dropped:AVERAGE ";
$rrd_options .= " LINE1.25:DS" . $count . "#" . $colour . ":'" . str_pad(substr($label, 0, 60), 60) . "'";
$rrd_options .= " GPRINT:DS" . $count . ":LAST:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":AVERAGE:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":MAX:%6.2lf%s\l ";
$count++;
$colcount++;
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-pool');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
include "includes/graphs/common.inc.php";
$rrd_options .= " -l 0 -E ";
$rrd_options .= " COMMENT:'GTM Pool Resolved Requests Now Avg Max\\n'";
$colours = array_merge($config['graph_colours']['mixed'], $config['graph_colours']['manycolours']);
$colcount = 0;
$count = 0;
// add all GTM Wide IP Request on this device.
foreach ($components as $compid => $comp) {
$label = $comp['label'];
$hash = $comp['hash'];
$rrd_filename = rrd_name($device['hostname'], array($comp['type'], $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
// Grab a colour from the array.
if (isset($colours[$colcount])) {
$colour = $colours[$colcount];
} else {
$colcount = 0;
$colour = $colours[$colcount];
}
$rrd_options .= " DEF:DS" . $count . "=" . $rrd_filename . ":resolved:AVERAGE ";
$rrd_options .= " LINE1.25:DS" . $count . "#" . $colour . ":'" . str_pad(substr($label, 0, 60), 60) . "'";
$rrd_options .= " GPRINT:DS" . $count . ":LAST:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":AVERAGE:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":MAX:%6.2lf%s\l ";
$count++;
$colcount++;
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-wide');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
include "includes/graphs/common.inc.php";
$rrd_options .= " -l 0 -E ";
$rrd_options .= " COMMENT:'Wide IP Dropped Requests Now Avg Max\\n'";
$colours = array_merge($config['graph_colours']['mixed'], $config['graph_colours']['manycolours']);
$colcount = 0;
$count = 0;
// add all GTM Wide IP Request on this device.
foreach ($components as $compid => $comp) {
$label = $comp['label'];
$hash = $comp['hash'];
$rrd_filename = rrd_name($device['hostname'], array($comp['type'], $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
// Grab a colour from the array.
if (isset($colours[$colcount])) {
$colour = $colours[$colcount];
} else {
$colcount = 0;
$colour = $colours[$colcount];
}
$rrd_options .= " DEF:DS" . $count . "=" . $rrd_filename . ":dropped:AVERAGE ";
$rrd_options .= " LINE1.25:DS" . $count . "#" . $colour . ":'" . str_pad(substr($label, 0, 60), 60) . "'";
$rrd_options .= " GPRINT:DS" . $count . ":LAST:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":AVERAGE:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":MAX:%6.2lf%s\l ";
$count++;
$colcount++;
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-wide');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
include "includes/graphs/common.inc.php";
$rrd_options .= " -l 0 -E ";
$rrd_options .= " COMMENT:'Wide IP Requests Now Avg Max\\n'";
$colours = array_merge($config['graph_colours']['mixed'], $config['graph_colours']['manycolours']);
$colcount = 0;
$count = 0;
// add all GTM Wide IP Request on this device.
foreach ($components as $compid => $comp) {
$label = $comp['label'];
$hash = $comp['hash'];
$rrd_filename = rrd_name($device['hostname'], array($comp['type'], $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
// Grab a colour from the array.
if (isset($colours[$colcount])) {
$colour = $colours[$colcount];
} else {
$colcount = 0;
$colour = $colours[$colcount];
}
$rrd_options .= " DEF:DS" . $count . "=" . $rrd_filename . ":requests:AVERAGE ";
$rrd_options .= " LINE1.25:DS" . $count . "#" . $colour . ":'" . str_pad(substr($label, 0, 60), 60) . "'";
$rrd_options .= " GPRINT:DS" . $count . ":LAST:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":AVERAGE:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":MAX:%6.2lf%s\l ";
$count++;
$colcount++;
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-wide');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
include "includes/graphs/common.inc.php";
$rrd_options .= " -l 0 -E ";
$rrd_options .= " COMMENT:'Wide IP Resolved Requests Now Avg Max\\n'";
$colours = array_merge($config['graph_colours']['mixed'], $config['graph_colours']['manycolours']);
$colcount = 0;
$count = 0;
// add all GTM Wide IP Request on this device.
foreach ($components as $compid => $comp) {
$label = $comp['label'];
$hash = $comp['hash'];
$rrd_filename = rrd_name($device['hostname'], array($comp['type'], $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
// Grab a colour from the array.
if (isset($colours[$colcount])) {
$colour = $colours[$colcount];
} else {
$colcount = 0;
$colour = $colours[$colcount];
}
$rrd_options .= " DEF:DS" . $count . "=" . $rrd_filename . ":resolved:AVERAGE ";
$rrd_options .= " LINE1.25:DS" . $count . "#" . $colour . ":'" . str_pad(substr($label, 0, 60), 60) . "'";
$rrd_options .= " GPRINT:DS" . $count . ":LAST:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":AVERAGE:%6.2lf%s ";
$rrd_options .= " GPRINT:DS" . $count . ":MAX:%6.2lf%s\l ";
$count++;
$colcount++;
}
}

View File

@@ -0,0 +1,45 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-pool');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
// Is the ID we are looking for a valid GTM Pool
if (isset($components[$vars['id']])) {
$label = $components[$vars['id']]['label'];
$hash = $components[$vars['id']]['hash'];
$rrd_filename = rrd_name($device['hostname'], array('f5-gtm-pool', $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
require 'includes/graphs/common.inc.php';
$ds = 'dropped';
$colour_area = '9999cc';
$colour_line = '0000cc';
$colour_area_max = '9999cc';
$graph_max = 1;
$graph_min = 0;
$unit_text = 'Dropped Requests';
$line_text = 'Dropped Requests';
require 'includes/graphs/generic_simplex.inc.php';
}
}

View File

@@ -0,0 +1,45 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-pool');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
// Is the ID we are looking for a valid GTM Pool
if (isset($components[$vars['id']])) {
$label = $components[$vars['id']]['label'];
$hash = $components[$vars['id']]['hash'];
$rrd_filename = rrd_name($device['hostname'], array('f5-gtm-pool', $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
require 'includes/graphs/common.inc.php';
$ds = 'resolved';
$colour_area = '9999cc';
$colour_line = '0000cc';
$colour_area_max = '9999cc';
$graph_max = 1;
$graph_min = 0;
$unit_text = 'Resolved Requests';
$line_text = 'Resolved Requests';
require 'includes/graphs/generic_simplex.inc.php';
}
}

View File

@@ -0,0 +1,45 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-wide');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
// Is the ID we are looking for a valid GTM Pool
if (isset($components[$vars['id']])) {
$label = $components[$vars['id']]['label'];
$hash = $components[$vars['id']]['hash'];
$rrd_filename = rrd_name($device['hostname'], array('f5-gtm-wide', $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
require 'includes/graphs/common.inc.php';
$ds = 'dropped';
$colour_area = '9999cc';
$colour_line = '0000cc';
$colour_area_max = '9999cc';
$graph_max = 1;
$graph_min = 0;
$unit_text = 'Dropped Requests';
$line_text = 'Dropped Requests';
require 'includes/graphs/generic_simplex.inc.php';
}
}

View File

@@ -0,0 +1,45 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-wide');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
// Is the ID we are looking for a valid GTM Pool
if (isset($components[$vars['id']])) {
$label = $components[$vars['id']]['label'];
$hash = $components[$vars['id']]['hash'];
$rrd_filename = rrd_name($device['hostname'], array('f5-gtm-wide', $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
require 'includes/graphs/common.inc.php';
$ds = 'requests';
$colour_area = '9999cc';
$colour_line = '0000cc';
$colour_area_max = '9999cc';
$graph_max = 1;
$graph_min = 0;
$unit_text = 'Requests';
$line_text = 'Requests';
require 'includes/graphs/generic_simplex.inc.php';
}
}

View File

@@ -0,0 +1,45 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$options = array();
$options['filter']['type'] = array('=','f5-gtm-wide');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
// Is the ID we are looking for a valid GTM Pool
if (isset($components[$vars['id']])) {
$label = $components[$vars['id']]['label'];
$hash = $components[$vars['id']]['hash'];
$rrd_filename = rrd_name($device['hostname'], array('f5-gtm-wide', $label, $hash));
if (rrdtool_check_rrd_exists($rrd_filename)) {
require 'includes/graphs/common.inc.php';
$ds = 'resolved';
$colour_area = '9999cc';
$colour_line = '0000cc';
$colour_area_max = '9999cc';
$graph_max = 1;
$graph_min = 0;
$unit_text = 'Resolved Requests';
$line_text = 'Resolved Requests';
require 'includes/graphs/generic_simplex.inc.php';
}
}

View File

@@ -211,6 +211,14 @@ if (device_permitted($vars['device']) || $permitted_by_port) {
$device_loadbalancer_count['ltm_pool'] = $component_count['f5-ltm-pool'];
$loadbalancer_tabs[] = 'ltm_pool';
}
if (isset($component_count['f5-gtm-wide'])) {
$device_loadbalancer_count['gtm_wide'] = $component_count['f5-gtm-wide'];
$loadbalancer_tabs[] = 'gtm_wide';
}
if (isset($component_count['f5-gtm-pool'])) {
$device_loadbalancer_count['gtm_pool'] = $component_count['f5-gtm-pool'];
$loadbalancer_tabs[] = 'gtm_pool';
}
if (is_array($loadbalancer_tabs)) {
echo '<li role="presentation" '.$select['loadbalancer'].'>

View File

@@ -11,6 +11,8 @@ $type_text['loadbalancer_vservers'] = 'Serverfarms'; // Cisco ACE
$type_text['netscaler_vsvr'] = 'VServers'; // Citrix Netscaler
$type_text['ltm_vs'] = 'LTM Virtual Servers'; // F5 BigIP
$type_text['ltm_pool'] = 'LTM Pools'; // F5 BigIP
$type_text['gtm_wide'] = 'GTM Wide IPs'; // F5 BigIP
$type_text['gtm_pool'] = 'GTM Pools'; // F5 BigIP
print_optionbar_start();

View File

@@ -0,0 +1,37 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$components = $component->getComponents($device['device_id'], array('filter' => array('ignore' => array('=', 0))));
// We only care about our device id.
$components = $components[$device['device_id']];
// We extracted all the components for this device, now lets only get the GTM Pools
$keep = array();
$types = array($module, 'f5-gtm-pool');
foreach ($components as $k => $v) {
foreach ($types as $type) {
if ($v['type'] == $type) {
$keep[$k] = $v;
}
}
}
$components = $keep;
if (is_file('pages/device/loadbalancer/'. $vars['subtype'] .'.inc.php')) {
include 'pages/device/loadbalancer/'. $vars['subtype'] .'.inc.php';
} else {
include 'pages/device/loadbalancer/gtm_pool_all.inc.php';
}//end if

View File

@@ -0,0 +1,96 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
?>
<table id='grid' data-toggle='bootgrid' class='table table-condensed table-responsive table-striped'>
<thead>
<tr>
<th data-column-id="gtmpoolid" data-type="numeric" data-visible="false">gtmpoolid</th>
<th data-column-id="name">Name</th>
<th data-column-id="status" data-visible="false">Status Code</th>
<th data-column-id="message">Status</th>
</tr>
</thead>
<tbody>
<?php
foreach ($components as $wide_id => $array) {
if ($array['type'] != 'f5-gtm-pool') {
continue;
}
if ($array['status'] != 0) {
$message = $array['error'];
$status = 2;
} else {
$message = 'Ok';
$status = '';
}
?>
<tr>
<td><?php echo $wide_id; ?></td>
<td><?php echo $array['label']; ?></td>
<td><?php echo $status; ?></td>
<td><?php echo $message; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<div class="panel panel-default" id="requests">
<div class="panel-heading">
<h3 class="panel-title">Resolved Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_allpool_requests';
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
<div class="panel panel-default" id="dropped">
<div class="panel-heading">
<h3 class="panel-title">Dropped Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_allpool_dropped';
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
<script type="text/javascript">
$("#grid").bootgrid({
caseSensitive: false,
statusMappings: {
2: "danger"
},
}).on("click.rs.jquery.bootgrid", function (e, columns, row) {
var link = '<?php echo generate_url($vars, array('type' => 'gtm_pool', 'subtype' => 'gtm_pool_det')); ?>gtmpoolid='+row['gtmpoolid'];
window.location.href = link;
});
</script>

View File

@@ -0,0 +1,69 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
// Pages
$subtypes = array();
$subtypes['gtm_pool_det'] = 'GTM Pool Details';
// If we have a defautl pool, display the details.
if ($vars['poolid'] != 0) {
$subtypes['gtm_wide_pool'] = 'Default Pool Details';
}
if (!$vars['subtype']) {
$vars['subtype'] = 'gtm_pool_det';
}
// Determine a policy to show.
if (!isset($vars['gtmpoolid'])) {
foreach ($components as $id => $array) {
if ($array['type'] != 'f5-gtm-pool') {
continue;
}
$vars['gtmpoolid'] = $id;
}
}
print_optionbar_start();
?>
<div class='row' style="margin-bottom: 10px;">
<div class='col-md-12'>
<span style="font-size: 20px;">Wide IP - <?php echo $components[$vars['gtmpoolid']]['label']?></span><br />
</div>
</div>
<div class='row'>
<div class='col-md-12'>
<?php
// Pages, on the left.
$sep = '';
foreach ($subtypes as $page => $text) {
echo $sep;
if ($vars['subtype'] == $page) {
echo "<span class='pagemenu-selected'>";
}
echo generate_link($text, $vars, array('subtype' => $page));
if ($vars['subtype'] == $page) {
echo '</span>';
}
$sep = ' | ';
}
unset($sep);
?>
</div>
</div>
<?php
print_optionbar_end();

View File

@@ -0,0 +1,63 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
include 'pages/device/loadbalancer/gtm_pool_common.inc.php';
if ($components[$vars['gtmpoolid']]['type'] == 'f5-gtm-pool') {
?>
<div class="row">
<div class="col-md-12">
<div class="container-fluid">
<div class='row'>
<div class="panel panel-default" id="requests">
<div class="panel-heading">
<h3 class="panel-title">Resolved Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array ();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_pool_requests';
$graph_array['id'] = $vars['gtmpoolid'];
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
<div class="panel panel-default" id="dropped">
<div class="panel-heading">
<h3 class="panel-title">Dropped Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array ();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_pool_dropped';
$graph_array['id'] = $vars['gtmpoolid'];
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
</div>
</div>
</div>
<?php
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$component = new LibreNMS\Component();
$components = $component->getComponents($device['device_id'], array('filter' => array('ignore' => array('=', 0))));
// We only care about our device id.
$components = $components[$device['device_id']];
// We extracted all the components for this device, now lets only get the Wide IPs
$keep = array();
$types = array($module, 'f5-gtm-wide');
foreach ($components as $k => $v) {
foreach ($types as $type) {
if ($v['type'] == $type) {
$keep[$k] = $v;
}
}
}
$components = $keep;
if (is_file('pages/device/loadbalancer/'. $vars['subtype'] .'.inc.php')) {
include 'pages/device/loadbalancer/'. $vars['subtype'] .'.inc.php';
} else {
include 'pages/device/loadbalancer/gtm_wide_all.inc.php';
}//end if

View File

@@ -0,0 +1,114 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
?>
<table id='grid' data-toggle='bootgrid' class='table table-condensed table-responsive table-striped'>
<thead>
<tr>
<th data-column-id="wideid" data-type="numeric" data-visible="false">wideid</th>
<th data-column-id="name">Name</th>
<th data-column-id="status" data-visible="false">Status Code</th>
<th data-column-id="message">Status</th>
</tr>
</thead>
<tbody>
<?php
foreach ($components as $wide_id => $array) {
if ($array['type'] != 'f5-gtm-wide') {
continue;
}
if ($array['status'] != 0) {
$message = $array['error'];
$status = 2;
} else {
$message = 'Ok';
$status = '';
}
?>
<tr>
<td><?php echo $wide_id; ?></td>
<td><?php echo $array['label']; ?></td>
<td><?php echo $status; ?></td>
<td><?php echo $message; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<div class="panel panel-default" id="requests">
<div class="panel-heading">
<h3 class="panel-title">Total Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_allwide_requests';
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
<div class="panel panel-default" id="resolved">
<div class="panel-heading">
<h3 class="panel-title">Resolved Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_allwide_resolved';
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
<div class="panel panel-default" id="dropped">
<div class="panel-heading">
<h3 class="panel-title">Dropped Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_allwide_dropped';
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
<script type="text/javascript">
$("#grid").bootgrid({
caseSensitive: false,
statusMappings: {
2: "danger"
},
}).on("click.rs.jquery.bootgrid", function (e, columns, row) {
var link = '<?php echo generate_url($vars, array('type' => 'gtm_wide', 'subtype' => 'gtm_wide_det')); ?>wideid='+row['wideid'];
window.location.href = link;
});
</script>

View File

@@ -0,0 +1,69 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
// Pages
$subtypes = array();
$subtypes['gtm_wide_det'] = 'Wide IP Details';
// If we have a defautl pool, display the details.
if ($vars['poolid'] != 0) {
$subtypes['gtm_wide_pool'] = 'Default Pool Details';
}
if (!$vars['subtype']) {
$vars['subtype'] = 'gtm_wide_det';
}
// Determine a policy to show.
if (!isset($vars['wideid'])) {
foreach ($components as $id => $array) {
if ($array['type'] != 'f5-gtm-wide') {
continue;
}
$vars['wideid'] = $id;
}
}
print_optionbar_start();
?>
<div class='row' style="margin-bottom: 10px;">
<div class='col-md-12'>
<span style="font-size: 20px;">Wide IP - <?php echo $components[$vars['wideid']]['label']?></span><br />
</div>
</div>
<div class='row'>
<div class='col-md-12'>
<?php
// Pages, on the left.
$sep = '';
foreach ($subtypes as $page => $text) {
echo $sep;
if ($vars['subtype'] == $page) {
echo "<span class='pagemenu-selected'>";
}
echo generate_link($text, $vars, array('subtype' => $page));
if ($vars['subtype'] == $page) {
echo '</span>';
}
$sep = ' | ';
}
unset($sep);
?>
</div>
</div>
<?php
print_optionbar_end();

View File

@@ -0,0 +1,82 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
include 'pages/device/loadbalancer/gtm_wide_common.inc.php';
if ($components[$vars['wideid']]['type'] == 'f5-gtm-wide') {
?>
<div class="row">
<div class="col-md-12">
<div class="container-fluid">
<div class='row'>
<div class="panel panel-default" id="requests">
<div class="panel-heading">
<h3 class="panel-title">Total Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array ();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_wide_requests';
$graph_array['id'] = $vars['wideid'];
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
<div class="panel panel-default" id="resolved">
<div class="panel-heading">
<h3 class="panel-title">Resolved Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array ();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_wide_resolved';
$graph_array['id'] = $vars['wideid'];
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
<div class="panel panel-default" id="dropped">
<div class="panel-heading">
<h3 class="panel-title">Dropped Requests</h3>
</div>
<div class="panel-body">
<?php
$graph_array = array ();
$graph_array['device'] = $device['device_id'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['legend'] = 'no';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'device_bigip_gtm_wide_dropped';
$graph_array['id'] = $vars['wideid'];
require 'includes/print-graphrow.inc.php';
?>
</div>
</div>
</div>
</div>
</div>
<?php
}

View File

@@ -11,4 +11,5 @@
if ($device['os'] == 'f5') {
include "includes/discovery/loadbalancers/f5-ltm.inc.php";
include "includes/discovery/loadbalancers/f5-gtm.inc.php";
}

View File

@@ -0,0 +1,188 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
// Define some error messages
use LibreNMS\Util\IP;
$error_poolaction = array();
$error_poolaction[0] = "Unused";
$error_poolaction[1] = "Reboot";
$error_poolaction[2] = "Restart";
$error_poolaction[3] = "Failover";
$error_poolaction[4] = "Failover and Restart";
$error_poolaction[5] = "Go Active";
$error_poolaction[6] = "None";
$component = new LibreNMS\Component();
$components = $component->getComponents($device['device_id']);
// We only care about our device id.
$components = $components[$device['device_id']];
// We extracted all the components for this device, now lets only get the LTM ones.
$keep = array();
$types = array($module, 'bigip', 'f5-gtm-wide', 'f5-gtm-pool');
foreach ($components as $k => $v) {
foreach ($types as $type) {
if ($v['type'] == $type) {
$keep[$k] = $v;
}
}
}
$components = $keep;
// Begin our master array, all other values will be processed into this array.
$tblBigIP = array();
if ((snmp_get($device, 'sysModuleAllocationProvisionLevel.3.103.116.109', '-Ovqs', 'F5-BIGIP-SYSTEM-MIB')) !=none) {
$gtmWideIPEntry = snmpwalk_array_num($device, '1.3.6.1.4.1.3375.2.3.12.1.2.1', 0);
if (!is_null($gtmWideIPEntry)) {
$gtmWideStatusEntry = snmpwalk_array_num($device, '1.3.6.1.4.1.3375.2.3.12.3.2.1', 0);
$gtmPoolEntry = snmpwalk_array_num($device, '1.3.6.1.4.1.3375.2.3.6.2.3.1.1', 0);
}
}
/*
* False == no object found - this is not an error, OID doesn't exist.
* null == timeout or something else that caused an error, OID may exist but we couldn't get it.
*/
if (!is_null($gtmWideIPEntry) || !is_null($gtmWideStatusEntry) || !is_null($gtmPoolEntry)) {
// No Nulls, lets go....
d_echo("Objects Found:\n");
// Process the Virtual Servers
if (is_array($gtmWideStatusEntry)) {
foreach ($gtmWideStatusEntry as $oid => $value) {
$result = array();
// Find all Virtual server names and UID's, then we can find everything else we need.
if (strpos($oid, '1.3.6.1.4.1.3375.2.3.12.3.2.1.1.') !== false) {
list($null, $index) = explode('1.3.6.1.4.1.3375.2.3.12.3.2.1.1.', $oid);
$result['type'] = 'f5-gtm-wide';
$result['UID'] = (string)$index;
$result['label'] = $value;
// The UID is far too long to have in a RRD filename, use a hash of it instead.
$result['hash'] = hash('crc32', $result['UID']);
// Now that we have our UID we can pull all the other data we need.
// 0 = None, 1 = Green, 2 = Yellow, 3 = Red, 4 = Blue
$result['state'] = $gtmWideStatusEntry['1.3.6.1.4.1.3375.2.3.12.3.2.1.2.'.$index];
if ($result['state'] == 2) {
// Looks like one of the VS Pool members is down.
$result['status'] = 1;
$result['error'] = $gtmWideStatusEntry['1.3.6.1.4.1.3375.2.3.12.3.2.1.5.'.$index];
} elseif ($result['state'] == 3) {
// Looks like ALL of the VS Pool members is down.
$result['status'] = 2;
$result['error'] = $gtmWideStatusEntry['1.3.6.1.4.1.3375.2.3.12.3.2.1.5.'.$index];
} else {
// All is good.
$result['status'] = 0;
$result['error'] = $gtmWideStatusEntry['1.3.6.1.4.1.3375.2.3.12.3.2.1.5.'.$index];
}
}
// Do we have any results
if (count($result) > 0) {
// Let's log some debugging
d_echo("\n\n".$result['type'].": ".$result['label']."\n");
d_echo(" Status: ".$result['status']."\n");
d_echo(" Message: ".$result['error']."\n");
// Add this result to the master array.
$tblBigIP[] = $result;
}
}
}
// Process the Pools
if (is_array($gtmPoolEntry)) {
foreach ($gtmPoolEntry as $oid => $value) {
$result = array ();
// Find all Pool names and UID's, then we can find everything else we need.
if (strpos($oid, '1.3.6.1.4.1.3375.2.3.6.2.3.1.1.') !== false) {
list($null, $index) = explode('1.3.6.1.4.1.3375.2.3.6.2.3.1.1.', $oid);
$result['type'] = 'f5-gtm-pool';
$result['UID'] = (string)$index;
$result['label'] = $value;
// The UID is far too long to have in a RRD filename, use a hash of it instead.
$result['hash'] = hash('crc32', $result['UID']);
}
// Do we have any results
if (count($result) > 0) {
// Let's log some debugging
d_echo("\n\n".$result['type'].": ".$result['label']."\n");
// Add this result to the master array.
$tblBigIP[] = $result;
}
}
}
/*
* Ok, we have our 2 array's (Components and SNMP) now we need
* to compare and see what needs to be added/updated.
*
* Let's loop over the SNMP data to see if we need to ADD or UPDATE any components.
*/
foreach ($tblBigIP as $key => $array) {
$component_key = false;
// Loop over our components to determine if the component exists, or we need to add it.
foreach ($components as $compid => $child) {
if (($child['UID'] === $array['UID']) && ($child['type'] === $array['type'])) {
$component_key = $compid;
}
}
if (!$component_key) {
// The component doesn't exist, we need to ADD it - ADD.
$new_component = $component->createComponent($device['device_id'], $array['type']);
$component_key = key($new_component);
$components[$component_key] = array_merge($new_component[$component_key], $array);
echo "+";
} else {
// The component does exist, merge the details in - UPDATE.
$components[$component_key] = array_merge($components[$component_key], $array);
echo ".";
}
}
/*
* Loop over the Component data to see if we need to DELETE any components.
*/
foreach ($components as $key => $array) {
// Guilty until proven innocent
$found = false;
foreach ($tblBigIP as $k => $v) {
if (($array['UID'] == $v['UID']) && ($array['type'] == $v['type'])) {
// Yay, we found it...
$found = true;
}
}
if ($found === false) {
// The component has not been found. we should delete it.
echo "-";
$component->deleteComponent($key);
}
}
// Write the Components back to the DB.
$component->setComponentPrefs($device['device_id'], $components);
echo "\n";
} // End if not error

View File

@@ -262,4 +262,4 @@ if (!is_null($ltmVirtualServEntry) || !is_null($ltmVsStatusEntry) || !is_null($l
// Write the Components back to the DB.
$component->setComponentPrefs($device['device_id'], $components);
echo "\n";
} // End if not error
}// End if not error

View File

@@ -11,4 +11,5 @@
if ($device['os'] == 'f5') {
include "includes/polling/loadbalancers/f5-ltm.inc.php";
include "includes/polling/loadbalancers/f5-gtm.inc.php";
}

View File

@@ -0,0 +1,121 @@
<?php
/*
* LibreNMS module to display F5 GTM Wide IP Details
*
* Adapted from F5 LTM module by Darren Napper
* Copyright (c) 2016 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
use LibreNMS\RRD\RrdDefinition;
// Define some error messages
$error_poolaction = array();
$error_poolaction[0] = "Unused";
$error_poolaction[1] = "Reboot";
$error_poolaction[2] = "Restart";
$error_poolaction[3] = "Failover";
$error_poolaction[4] = "Failover and Restart";
$error_poolaction[5] = "Go Active";
$error_poolaction[6] = "None";
$component = new LibreNMS\Component();
$options['filter']['disabled'] = array('=',0);
$options['filter']['ignore'] = array('=',0);
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
// We extracted all the components for this device, now lets only get the GTM ones.
$keep = array();
$types = array('f5-gtm-wide', 'f5-gtm-pool');
foreach ($components as $k => $v) {
foreach ($types as $type) {
if ($v['type'] == $type) {
$keep[$k] = $v;
}
}
}
$components = $keep;
// Only collect SNMP data if we have enabled components
if (count($components > 0)) {
// Let's gather the stats..
$f5_stats['gtmWideIPStatEntryRequests'] = snmpwalk_array_num($device, '.1.3.6.1.4.1.3375.2.3.12.2.3.1.2', 0);
$f5_stats['gtmWideIPStatEntryResolved'] = snmpwalk_array_num($device, '.1.3.6.1.4.1.3375.2.3.12.2.3.1.3', 0);
$f5_stats['gtmWideIPStatEntryDropped'] = snmpwalk_array_num($device, '.1.3.6.1.4.1.3375.2.3.12.2.3.1.7', 0);
$f5_stats['gtmPoolEntryResolved'] = snmpwalk_array_num($device, '1.3.6.1.4.1.3375.2.3.6.2.3.1.2', 0);
$f5_stats['gtmPoolEntryDropped'] = snmpwalk_array_num($device, '1.3.6.1.4.1.3375.2.3.6.2.3.1.5', 0);
// and check the status
$f5_stats['gtmWideIPStatEntryState'] = snmpwalk_array_num($device, '1.3.6.1.4.1.3375.2.3.12.3.2.1.2', 0);
$f5_stats['gtmWideIPStatEntryMsg'] = snmpwalk_array_num($device, '1.3.6.1.4.1.3375.2.3.12.3.2.1.5', 0);
// Loop through the components and extract the data.
foreach ($components as $key => &$array) {
$type = $array['type'];
$UID = $array['UID'];
$label = $array['label'];
$hash = $array['hash'];
$rrd_name = array($type, $label, $hash);
if ($type == 'f5-gtm-wide') {
$rrd_def = RrdDefinition::make()
->addDataset('requests', 'COUNTER', 0)
->addDataset('resolved', 'COUNTER', 0)
->addDataset('dropped', 'COUNTER', 0);
$fields = array(
'requests' => $f5_stats['gtmWideIPStatEntryRequests']['1.3.6.1.4.1.3375.2.3.12.2.3.1.2.'.$UID],
'resolved' => $f5_stats['gtmWideIPStatEntryResolved']['1.3.6.1.4.1.3375.2.3.12.2.3.1.3.'.$UID],
'dropped' => $f5_stats['gtmWideIPStatEntryDropped']['1.3.6.1.4.1.3375.2.3.12.2.3.1.7.'.$UID],
);
// Let's print some debugging info.
d_echo("\n\nComponent: ".$key."\n");
d_echo(" Type: ".$type."\n");
d_echo(" Label: ".$label."\n");
} elseif ($type == 'f5-gtm-pool') {
$rrd_def = RrdDefinition::make()
->addDataset('resolved', 'COUNTER', 0)
->addDataset('dropped', 'COUNTER', 0);
$fields = array(
'resolved' => $f5_stats['gtmPoolEntryResolved']['1.3.6.1.4.1.3375.2.3.6.2.3.1.2.'.$UID],
'dropped' => $f5_stats['gtmPoolEntryDropped']['1.3.6.1.4.1.3375.2.3.6.2.3.1.5.'.$UID],
);
// Let's print some debugging info.
d_echo("\n\nComponent: ".$key."\n");
d_echo(" Type: ".$type."\n");
d_echo(" Label: ".$label."\n");
} else {
d_echo("Type is unknown: ".$type."\n");
continue;
}
$tags = compact('rrd_name', 'rrd_def', 'type', 'hash', 'label');
data_update($device, $type, $tags, $fields);
} // End foreach components
unset($f5_stats);
// Write the Components back to the DB.
$component->setComponentPrefs($device['device_id'], $components);
} // end if count components
// Clean-up after yourself!
unset(
$type,
$components,
$component,
$options,
$error_poolaction,
$keep
);