Files
librenms-librenms/LibreNMS/OS/Gaia.php
Tony Murray 7e98e03338 Polling cleanup, fix PHP warnings (#13460)
* Fix warnings up to Arbos

* fixes a-c

* a-r

* a-vrp

* There and back again

* Update test data, couple fixes

* PHPSStan fixes

* style fixes, and fix Asyncos, whoops

* flip serial back.......

* less bogus data

* Poweralert sysName during polling too

* make sure things are calculated in the correct order

* fix style and bad nullables

* update test data

* A comple more conversions

* cambium ptp, misc, and hardware_mib

* remaining except vmware-esxi

* Fixes

* Update baseline

* fixes and fix up baseline

* adjust SnmpQueryMock to upstream options change

* data corrections

* restore slashes

* correctly handle all options input in SnmpQueryMock

* undo ftos changes

* restore vccodec sysDescr
2021-11-14 14:58:13 -06:00

84 lines
3.0 KiB
PHP

<?php
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
class Gaia extends \LibreNMS\OS implements OSPolling
{
public function pollOS(): void
{
$oids = ['fwLoggingHandlingRate.0', 'mgLSLogReceiveRate.0', 'fwNumConn.0', 'fwAccepted.0', 'fwRejected.0', 'fwDropped.0', 'fwLogged.0'];
$data = snmp_get_multi($this->getDeviceArray(), $oids, '-OQUs', 'CHECKPOINT-MIB');
//#############
// Create firewall lograte/handlingrate rrd
//#############
if (is_numeric($data[0]['fwLoggingHandlingRate'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('fwlograte', 'GAUGE', 0);
$fields = [
'fwlograte' => $data[0]['fwLoggingHandlingRate'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'gaia_firewall_lograte', $tags, $fields);
$this->enableGraph('gaia_firewall_lograte');
}
//#############
// Create MGMT logserver lograte rrd
//#############
if (is_numeric($data[0]['mgLSLogReceiveRate'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('LogReceiveRate', 'GAUGE', 0);
$fields = [
'LogReceiveRate' => $data[0]['mgLSLogReceiveRate'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'gaia_logserver_lograte', $tags, $fields);
$this->enableGraph('gaia_logserver_lograte');
}
//#############
// Create firewall active connections rrd
//#############
if (is_numeric($data[0]['fwNumConn'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('NumConn', 'GAUGE', 0);
$fields = [
'NumConn' => $data[0]['fwNumConn'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'gaia_connections', $tags, $fields);
$this->enableGraph('gaia_connections');
}
//#############
// Create firewall packets rrd
//#############
if (is_numeric($data[0]['fwAccepted'] ?? null) && is_numeric($data[0]['fwRejected'] ?? null) && is_numeric($data[0]['fwDropped'] ?? null) && is_numeric($data[0]['fwLogged'] ?? null)) {
$rrd_def = RrdDefinition::make()
->addDataset('accepted', 'DERIVE', 0)
->addDataset('rejected', 'DERIVE', 0)
->addDataset('dropped', 'DERIVE', 0)
->addDataset('logged', 'DERIVE', 0);
$fields = [
'accepted' => $data[0]['fwAccepted'],
'rejected' => $data[0]['fwRejected'],
'dropped' => $data[0]['fwDropped'],
'logged' => $data[0]['fwLogged'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'gaia_firewall_packets', $tags, $fields);
$this->enableGraph('gaia_firewall_packets');
}
}
}