mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Use data_update instead of rrd_update/rrd_create and influx_update Centralize rrd file check so we can check against a remote rrdcached server too Use rrd_name() to generate rrd file names
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
$fnSysVersion = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysVersion.0', '-Ovq');
|
|
$serial = snmp_get($device, 'ENTITY-MIB::entPhysicalSerialNum.1', '-Ovq');
|
|
$version = preg_replace('/(.+),(.+),(.+)/', '\\1||\\2||\\3', $fnSysVersion);
|
|
list($version,$features) = explode('||', $version);
|
|
if (isset($rewrite_fortinet_hardware[$poll_device['sysObjectID']])) {
|
|
$hardware = $rewrite_fortinet_hardware[$poll_device['sysObjectID']];
|
|
}
|
|
if (empty($hardware)) {
|
|
$hardware = snmp_get($device, 'ENTITY-MIB::entPhysicalModelName.1', '-Ovq');
|
|
}
|
|
|
|
$sessions = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysSesCount.0', '-Ovq');
|
|
if (is_numeric($sessions)) {
|
|
$rrd_def = 'DS:sessions:GAUGE:600:0:3000000';
|
|
|
|
print "Sessions: $sessions\n";
|
|
$fields = array(
|
|
'sessions' => $sessions,
|
|
);
|
|
|
|
$tags = compact('rrd_def');
|
|
data_update($device, 'fortigate_sessions', $tags, $fields);
|
|
$graphs['fortigate_sessions'] = true;
|
|
}
|
|
|
|
$cpu_usage = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0', '-Ovq');
|
|
if (is_numeric($cpu_usage)) {
|
|
$rrd_def = 'DS:LOAD:GAUGE:600:-1:100';
|
|
|
|
echo "CPU: $cpu_usage%\n";
|
|
$fields = array(
|
|
'LOAD' => $cpu_usage,
|
|
);
|
|
|
|
$tags = compact('rrd_def');
|
|
data_update($device, 'fortigate_cpu', $tags, $fields);
|
|
$graphs['fortigate_cpu'] = true;
|
|
}
|