mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
device: Added support for OpenBSD PF states (#8211)
* First basic support for graphing openbsd pf states * Now openbsd pf state graphing actually works * First basic support for graphing openbsd pf states * Now openbsd pf state graphing actually works * Wrong graph types for searches, removals and inserts * Removed unused file "openbsd_pfstates.inc.php" * Remove openbsd from filenames, make it more generic
This commit is contained in:
committed by
Neil Lathwood
parent
a4bc98e555
commit
2bd88a2f2b
16
html/includes/graphs/device/pf_inserts.inc.php
Normal file
16
html/includes/graphs/device/pf_inserts.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], 'pf_inserts');
|
||||
|
||||
$ds = 'inserts';
|
||||
|
||||
$colour_area = '9999cc';
|
||||
$colour_line = '0000cc';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'Inserts';
|
||||
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
||||
16
html/includes/graphs/device/pf_removals.inc.php
Normal file
16
html/includes/graphs/device/pf_removals.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], 'pf_removals');
|
||||
|
||||
$ds = 'removals';
|
||||
|
||||
$colour_area = '9999cc';
|
||||
$colour_line = '0000cc';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'Removals';
|
||||
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
||||
16
html/includes/graphs/device/pf_searches.inc.php
Normal file
16
html/includes/graphs/device/pf_searches.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], 'pf_searches');
|
||||
|
||||
$ds = 'searches';
|
||||
|
||||
$colour_area = '9999cc';
|
||||
$colour_line = '0000cc';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'Searches';
|
||||
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
||||
16
html/includes/graphs/device/pf_states.inc.php
Normal file
16
html/includes/graphs/device/pf_states.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], 'pf_states');
|
||||
|
||||
$ds = 'states';
|
||||
|
||||
$colour_area = '9999cc';
|
||||
$colour_line = '0000cc';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'States';
|
||||
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
||||
@@ -306,6 +306,25 @@ $config['graph_types']['device']['panos_activetunnels']['section'] = 'firew
|
||||
$config['graph_types']['device']['panos_activetunnels']['order'] = '0';
|
||||
$config['graph_types']['device']['panos_activetunnels']['descr'] = 'Active GlobalProtect Tunnels';
|
||||
|
||||
//PF Graphs
|
||||
$config['graph_types']['device']['pf_states']['section'] = 'firewall';
|
||||
$config['graph_types']['device']['pf_states']['order'] = '1';
|
||||
$config['graph_types']['device']['pf_states']['descr'] = 'States';
|
||||
$config['graph_types']['device']['pf_searches']['section'] = 'firewall';
|
||||
$config['graph_types']['device']['pf_searches']['order'] = '2';
|
||||
$config['graph_types']['device']['pf_searches']['descr'] = 'Searches';
|
||||
$config['graph_types']['device']['pf_inserts']['section'] = 'firewall';
|
||||
$config['graph_types']['device']['pf_inserts']['order'] = '3';
|
||||
$config['graph_types']['device']['pf_inserts']['descr'] = 'Inserts';
|
||||
$config['graph_types']['device']['pf_removals']['section'] = 'firewall';
|
||||
$config['graph_types']['device']['pf_removals']['order'] = '4';
|
||||
$config['graph_types']['device']['pf_removals']['descr'] = 'Removals';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Pulse Secure Graphs
|
||||
$config['graph_types']['device']['pulse_users']['section'] = 'firewall';
|
||||
$config['graph_types']['device']['pulse_users']['order'] = '0';
|
||||
|
||||
62
includes/polling/os/openbsd.inc.php
Normal file
62
includes/polling/os/openbsd.inc.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
|
||||
$oids = snmp_get_multi($device, 'pfStateCount.0 pfStateSearches.0 pfStateInserts.0 pfStateRemovals.0', '-OQUs', 'OPENBSD-PF-MIB');
|
||||
|
||||
$states = $oids[0]['pfStateCount'];
|
||||
$searches = $oids[0]['pfStateSearches'];
|
||||
$inserts = $oids[0]['pfStateInserts'];
|
||||
$removals = $oids[0]['pfStateCount'];
|
||||
|
||||
if (is_numeric($states)) {
|
||||
$rrd_def = RrdDefinition::make()->addDataset('states', 'GAUGE', 0);
|
||||
|
||||
$fields = array(
|
||||
'states' => $states,
|
||||
);
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'pf_states', $tags, $fields);
|
||||
|
||||
$graphs['pf_states'] = true;
|
||||
}
|
||||
|
||||
if (is_numeric($searches)) {
|
||||
$rrd_def = RrdDefinition::make()->addDataset('searches', 'COUNTER', 0);
|
||||
|
||||
$fields = array(
|
||||
'searches' => $searches,
|
||||
);
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'pf_searches', $tags, $fields);
|
||||
|
||||
$graphs['pf_searches'] = true;
|
||||
}
|
||||
|
||||
if (is_numeric($inserts)) {
|
||||
$rrd_def = RrdDefinition::make()->addDataset('inserts', 'COUNTER', 0);
|
||||
|
||||
$fields = array(
|
||||
'inserts' => $inserts,
|
||||
);
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'pf_inserts', $tags, $fields);
|
||||
|
||||
$graphs['pf_inserts'] = true;
|
||||
}
|
||||
|
||||
if (is_numeric($removals)) {
|
||||
$rrd_def = RrdDefinition::make()->addDataset('removals', 'COUNTER', 0);
|
||||
|
||||
$fields = array(
|
||||
'removals' => $removals,
|
||||
);
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'pf_removals', $tags, $fields);
|
||||
|
||||
$graphs['pf_removals'] = true;
|
||||
}
|
||||
Reference in New Issue
Block a user