mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add additional OpenBSD PF graphs
Some of these were already present for PFSense (matches, badoffset, fragmented, short, normalized, memdropped) and reuse existing graph types; the others are are added as new types.
This commit is contained in:
@@ -33,58 +33,70 @@ class Openbsd extends Unix implements OSPolling
|
||||
{
|
||||
public function pollOS(): void
|
||||
{
|
||||
$oids = snmp_get_multi($this->getDeviceArray(), ['pfStateCount.0', 'pfStateSearches.0', 'pfStateInserts.0', 'pfStateRemovals.0'], '-OQUs', 'OPENBSD-PF-MIB');
|
||||
$oids = snmp_get_multi($this->getDeviceArray(), [
|
||||
'pfStateCount.0',
|
||||
'pfStateSearches.0',
|
||||
'pfStateInserts.0',
|
||||
'pfStateRemovals.0',
|
||||
|
||||
if (is_numeric($oids[0]['pfStateCount'] ?? null)) {
|
||||
$rrd_def = RrdDefinition::make()->addDataset('states', 'GAUGE', 0);
|
||||
'pfCntMatch.0',
|
||||
'pfCntBadOffset.0',
|
||||
'pfCntFragment.0',
|
||||
'pfCntShort.0',
|
||||
'pfCntNormalize.0',
|
||||
'pfCntMemory.0',
|
||||
|
||||
'pfCntTimestamp.0',
|
||||
'pfCntCongestion.0',
|
||||
'pfCntIpOption.0',
|
||||
'pfCntProtoCksum.0',
|
||||
'pfCntStateMismatch.0',
|
||||
'pfCntStateInsert.0',
|
||||
'pfCntStateLimit.0',
|
||||
'pfCntSrcLimit.0',
|
||||
'pfCntSynproxy.0',
|
||||
'pfCntTranslate.0',
|
||||
'pfCntNoRoute.0',
|
||||
], '-OQUs', 'OPENBSD-PF-MIB');
|
||||
|
||||
$this->parseOID($oids[0]['pfStateCount'], 'states', 'GAUGE');
|
||||
$this->parseOID($oids[0]['pfStateSearches'], 'searches');
|
||||
$this->parseOID($oids[0]['pfStateInserts'], 'inserts');
|
||||
$this->parseOID($oids[0]['pfStateRemovals'], 'removals');
|
||||
|
||||
$this->parseOID($oids[0]['pfCntMatch'], 'matches');
|
||||
$this->parseOID($oids[0]['pfCntBadOffset'], 'badoffset');
|
||||
$this->parseOID($oids[0]['pfCntFragment'], 'fragmented');
|
||||
$this->parseOID($oids[0]['pfCntShort'], 'short');
|
||||
$this->parseOID($oids[0]['pfCntNormalize'], 'normalized');
|
||||
$this->parseOID($oids[0]['pfCntMemory'], 'memdropped');
|
||||
|
||||
$this->parseOID($oids[0]['pfCntTimestamp'], 'timestamp');
|
||||
$this->parseOID($oids[0]['pfCntCongestion'], 'congestion');
|
||||
$this->parseOID($oids[0]['pfCntIpOption'], 'ipoption');
|
||||
$this->parseOID($oids[0]['pfCntProtoCksum'], 'badchecksum');
|
||||
$this->parseOID($oids[0]['pfCntStateMismatch'], 'badstate');
|
||||
$this->parseOID($oids[0]['pfCntStateInsert'], 'badinsert');
|
||||
$this->parseOID($oids[0]['pfCntStateLimit'], 'statelimit');
|
||||
$this->parseOID($oids[0]['pfCntSrcLimit'], 'srclimit');
|
||||
$this->parseOID($oids[0]['pfCntSynproxy'], 'synproxy');
|
||||
$this->parseOID($oids[0]['pfCntTranslate'], 'translate');
|
||||
$this->parseOID($oids[0]['pfCntNoRoute'], 'noroute');
|
||||
}
|
||||
|
||||
private function parseOID(?string $oid, string $field, string $type = 'COUNTER'): void
|
||||
{
|
||||
if (is_numeric($oid ?? null)) {
|
||||
$rrd_def = RrdDefinition::make()->addDataset($field, $type, 0);
|
||||
|
||||
$fields = [
|
||||
'states' => $oids[0]['pfStateCount'],
|
||||
$field => $oid,
|
||||
];
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($this->getDeviceArray(), 'pf_states', $tags, $fields);
|
||||
data_update($this->getDeviceArray(), "pf_$field", $tags, $fields);
|
||||
|
||||
$this->enableGraph('pf_states');
|
||||
}
|
||||
|
||||
if (is_numeric($oids[0]['pfStateSearches'] ?? null)) {
|
||||
$rrd_def = RrdDefinition::make()->addDataset('searches', 'COUNTER', 0);
|
||||
|
||||
$fields = [
|
||||
'searches' => $oids[0]['pfStateSearches'],
|
||||
];
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($this->getDeviceArray(), 'pf_searches', $tags, $fields);
|
||||
|
||||
$this->enableGraph('pf_searches');
|
||||
}
|
||||
|
||||
if (is_numeric($oids[0]['pfStateInserts'] ?? null)) {
|
||||
$rrd_def = RrdDefinition::make()->addDataset('inserts', 'COUNTER', 0);
|
||||
|
||||
$fields = [
|
||||
'inserts' => $oids[0]['pfStateInserts'],
|
||||
];
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($this->getDeviceArray(), 'pf_inserts', $tags, $fields);
|
||||
|
||||
$this->enableGraph('pf_inserts');
|
||||
}
|
||||
|
||||
if (is_numeric($oids[0]['pfStateCount'] ?? null)) {
|
||||
$rrd_def = RrdDefinition::make()->addDataset('removals', 'COUNTER', 0);
|
||||
|
||||
$fields = [
|
||||
'removals' => $oids[0]['pfStateCount'],
|
||||
];
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($this->getDeviceArray(), 'pf_removals', $tags, $fields);
|
||||
|
||||
$this->enableGraph('pf_removals');
|
||||
$this->enableGraph("pf_$field");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
includes/html/graphs/device/pf_badchecksum.inc.php
Normal file
16
includes/html/graphs/device/pf_badchecksum.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_badchecksum');
|
||||
|
||||
$ds = 'badchecksum';
|
||||
|
||||
$colour_area = 'cc0000';
|
||||
$colour_line = 'ff0000';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'BadChecksum';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_badinsert.inc.php
Normal file
16
includes/html/graphs/device/pf_badinsert.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_badinsert');
|
||||
|
||||
$ds = 'badinsert';
|
||||
|
||||
$colour_area = 'cc3300';
|
||||
$colour_line = 'ff3300';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'BadInsert';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_badstate.inc.php
Normal file
16
includes/html/graphs/device/pf_badstate.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_badstate');
|
||||
|
||||
$ds = 'badstate';
|
||||
|
||||
$colour_area = 'cc0033';
|
||||
$colour_line = 'ff0033';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'BadState';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_congestion.inc.php
Normal file
16
includes/html/graphs/device/pf_congestion.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_congestion');
|
||||
|
||||
$ds = 'congestion';
|
||||
|
||||
$colour_area = 'cc3333';
|
||||
$colour_line = 'ff3333';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'Congestion';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_ipoption.inc.php
Normal file
16
includes/html/graphs/device/pf_ipoption.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_ipoption');
|
||||
|
||||
$ds = 'ipoption';
|
||||
|
||||
$colour_area = 'cc6600';
|
||||
$colour_line = 'ff6600';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'IPOption';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_noroute.inc.php
Normal file
16
includes/html/graphs/device/pf_noroute.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_noroute');
|
||||
|
||||
$ds = 'noroute';
|
||||
|
||||
$colour_area = 'cc6633';
|
||||
$colour_line = 'ff6633';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'NoRoute';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_srclimit.inc.php
Normal file
16
includes/html/graphs/device/pf_srclimit.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_srclimit');
|
||||
|
||||
$ds = 'srclimit';
|
||||
|
||||
$colour_area = 'cc6666';
|
||||
$colour_line = 'ff6666';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'SrcLimit';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_statelimit.inc.php
Normal file
16
includes/html/graphs/device/pf_statelimit.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_statelimit');
|
||||
|
||||
$ds = 'statelimit';
|
||||
|
||||
$colour_area = 'cc3366';
|
||||
$colour_line = 'ff3366';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'StateLimit';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_synproxy.inc.php
Normal file
16
includes/html/graphs/device/pf_synproxy.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_synproxy');
|
||||
|
||||
$ds = 'synproxy';
|
||||
|
||||
$colour_area = 'cc0066';
|
||||
$colour_line = 'ff0066';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'SynProxy';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_timestamp.inc.php
Normal file
16
includes/html/graphs/device/pf_timestamp.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_timestamp');
|
||||
|
||||
$ds = 'timestamp';
|
||||
|
||||
$colour_area = 'cc9900';
|
||||
$colour_line = 'ff9900';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'Timestamp';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
16
includes/html/graphs/device/pf_translate.inc.php
Normal file
16
includes/html/graphs/device/pf_translate.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = Rrd::name($device['hostname'], 'pf_translate');
|
||||
|
||||
$ds = 'translate';
|
||||
|
||||
$colour_area = 'cc9933';
|
||||
$colour_line = 'ff9933';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'Translate';
|
||||
|
||||
require 'includes/html/graphs/generic_simplex.inc.php';
|
@@ -2717,6 +2717,22 @@
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_badchecksum": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 14,
|
||||
"descr": "Drops (Bad Checksum)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_badinsert": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 16,
|
||||
"descr": "Drops (Bad Insert)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_badoffset": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
@@ -2725,6 +2741,22 @@
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_badstate": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 15,
|
||||
"descr": "Drops (Bad State)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_congestion": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 12,
|
||||
"descr": "Drops (Congestion)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_fragmented": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
@@ -2741,6 +2773,14 @@
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_ipoption": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 13,
|
||||
"descr": "Drops (IP Option)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_matches": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
@@ -2765,6 +2805,14 @@
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_noroute": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 21,
|
||||
"descr": "Drops (No Route)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_removals": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
@@ -2789,6 +2837,22 @@
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_srclimit": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 18,
|
||||
"descr": "Drops (Src Limit)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_statelimit": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 17,
|
||||
"descr": "Drops (State Limit)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_states": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
@@ -2797,6 +2861,30 @@
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_synproxy": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 19,
|
||||
"descr": "Drops (Syn Proxy)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_timestamp": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 11,
|
||||
"descr": "Drops (Timestamp)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.pf_translate": {
|
||||
"default": {
|
||||
"section": "firewall",
|
||||
"order": 20,
|
||||
"descr": "Drops (Translate)"
|
||||
},
|
||||
"type": "graph"
|
||||
},
|
||||
"graph_types.device.ping_perf": {
|
||||
"default": {
|
||||
"section": "poller",
|
||||
|
Reference in New Issue
Block a user