. * * @link https://www.librenms.org * @copyright 2020 Tony Murray * @author Tony Murray */ namespace LibreNMS\OS; use App\Models\Device; use LibreNMS\Interfaces\Discovery\OSDiscovery; use LibreNMS\Interfaces\Polling\OSPolling; use LibreNMS\OS\Shared\Zyxel; use LibreNMS\RRD\RrdDefinition; class Zywall extends Zyxel implements OSDiscovery, OSPolling { public function discoverOS(Device $device): void { parent::discoverOS($device); // yaml $device->hardware = $device->hardware ?: $device->sysDescr; // ZYXEL-ES-COMMON::sysSwVersionString.0 $pos = strpos($device->version, 'ITS'); if ($pos) { $device->version = substr($device->version, 0, $pos); } } public function pollOS() { $sessions = snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.890.1.6.22.1.6.0', '-Ovq'); if (is_numeric($sessions)) { $rrd_def = RrdDefinition::make()->addDataset('sessions', 'GAUGE', 0, 3000000); $fields = [ 'sessions' => $sessions, ]; $tags = compact('rrd_def'); data_update($this->getDeviceArray(), 'zywall-sessions', $tags, $fields); $this->enableGraph('zywall_sessions'); } } }