2008-04-03 21:54:14 +00:00
|
|
|
<?php
|
2017-02-23 22:45:50 +00:00
|
|
|
|
|
|
|
|
use LibreNMS\RRD\RrdDefinition;
|
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$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']];
|
2015-04-01 20:38:53 +02:00
|
|
|
}
|
2015-04-02 22:17:53 +02:00
|
|
|
if (empty($hardware)) {
|
2015-07-13 20:10:26 +02:00
|
|
|
$hardware = snmp_get($device, 'ENTITY-MIB::entPhysicalModelName.1', '-Ovq');
|
2015-04-02 22:17:53 +02:00
|
|
|
}
|
2016-07-07 01:33:43 -05:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$sessions = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysSesCount.0', '-Ovq');
|
|
|
|
|
if (is_numeric($sessions)) {
|
2017-02-23 22:45:50 +00:00
|
|
|
$rrd_def = RrdDefinition::make()->addDataset('sessions', 'GAUGE', 0, 3000000);
|
2016-07-07 01:33:43 -05:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
print "Sessions: $sessions\n";
|
2015-08-18 16:26:55 +00:00
|
|
|
$fields = array(
|
|
|
|
|
'sessions' => $sessions,
|
|
|
|
|
);
|
2016-07-07 01:33:43 -05:00
|
|
|
|
|
|
|
|
$tags = compact('rrd_def');
|
|
|
|
|
data_update($device, 'fortigate_sessions', $tags, $fields);
|
2015-07-13 20:10:26 +02:00
|
|
|
$graphs['fortigate_sessions'] = true;
|
2008-04-03 21:54:14 +00:00
|
|
|
}
|
2016-07-07 01:33:43 -05:00
|
|
|
|
2016-02-12 13:38:22 +00:00
|
|
|
$cpu_usage = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0', '-Ovq');
|
|
|
|
|
if (is_numeric($cpu_usage)) {
|
2017-02-23 22:45:50 +00:00
|
|
|
$rrd_def = RrdDefinition::make()->addDataset('LOAD', 'GAUGE', -1, 100);
|
2016-07-07 01:33:43 -05:00
|
|
|
|
2016-02-12 13:38:22 +00:00
|
|
|
echo "CPU: $cpu_usage%\n";
|
|
|
|
|
$fields = array(
|
|
|
|
|
'LOAD' => $cpu_usage,
|
|
|
|
|
);
|
2016-07-07 01:33:43 -05:00
|
|
|
|
|
|
|
|
$tags = compact('rrd_def');
|
|
|
|
|
data_update($device, 'fortigate_cpu', $tags, $fields);
|
2016-02-12 13:38:22 +00:00
|
|
|
$graphs['fortigate_cpu'] = true;
|
|
|
|
|
}
|