mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Reverted fortigate cpu update from Dec 2015
This commit is contained in:
@@ -1,31 +1,13 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
// Somewhat dynamic processor discovery for Fortigate boxes.
|
||||
//
|
||||
// FORTINET-FORTIGATE-MIB::fgSysCpuUsage.X where X is the CPU number
|
||||
// FORTINET-FORTIGATE-MIB::fgProcModDescr.X where X is the CPU number
|
||||
// FORTINET-FORTIGATE-MIB::fgProcessorCount.0 -> Num CPUs in the device
|
||||
|
||||
if ($device['os'] == 'fortigate') {
|
||||
echo 'Fortigate : ';
|
||||
|
||||
// Forti have logical CPU numbering - start at 1 and increment to $num_cpu in the box.
|
||||
$num_cpu = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgProcessorCount.0', '-Ovq');
|
||||
|
||||
print "Forti-found $num_cpu CPUs\n";
|
||||
|
||||
for($i = 1; $i <= $num_cpu; $i++) {
|
||||
// HERP DERP IM A FORTIGATE AND I PUT NON NUMERIC VALUES IN A GAUGE
|
||||
$cpu_usage = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgProcessorUsage.$i", '-Ovq');
|
||||
$usage = trim ( str_replace(" %", "", $cpu_usage ) ) ;
|
||||
$descr = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgProcModDescr.$i", '-Ovq');
|
||||
print "CPU: $num_cpu - USAGE: $cpu_usage - TYPE $descr\n";
|
||||
if (is_numeric($usage)) {
|
||||
discover_processor($valid['processor'], $device, "FORTINET-FORTIGATE-MIB::fgProcessorUsage." . $num_cpu, '0', 'fortigate-fixed', $descr, '1', $usage, null, null);
|
||||
}
|
||||
} // END For loop for CPU discovery
|
||||
echo 'Fortigate : ';
|
||||
$descr = 'Processor';
|
||||
$usage = snmp_get($device, '.1.3.6.1.4.1.12356.101.4.1.3.0', '-Ovq');
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.12356.101.4.1.3.0', '0', 'fortigate-fixed', $descr, '1', $usage, null, null);
|
||||
}
|
||||
} // END if device is Fortigate
|
||||
|
||||
unset($processors_array);
|
||||
|
@@ -1,38 +1,41 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
$sessrrd = $config['rrd_dir'].'/'.$device['hostname'].'/fortigate_sessions.rrd';
|
||||
$sessions = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysSesCount.0', '-Ovq');
|
||||
|
||||
if (is_numeric($sessions)) {
|
||||
if (!is_file($sessrrd)) {
|
||||
rrdtool_create($sessrrd, ' --step 300 DS:sessions:GAUGE:600:0:3000000 '.$config['rrd_rra']);
|
||||
}
|
||||
|
||||
print "Sessions: $sessions\n";
|
||||
|
||||
$fields = array(
|
||||
'sessions' => $sessions,
|
||||
);
|
||||
|
||||
rrdtool_update($sessrrd, $fields);
|
||||
|
||||
$tags = array();
|
||||
influx_update($device,'fortigate_sessions',$tags,$fields);
|
||||
|
||||
$graphs['fortigate_sessions'] = true;
|
||||
}
|
||||
|
||||
$cpurrd = $config['rrd_dir'].'/'.$device['hostname'].'/fortigate_cpu.rrd';
|
||||
$cpu_usage = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0', '-Ovq');
|
||||
if (is_numeric($cpu_usage)) {
|
||||
if (!is_file($cpurrd)) {
|
||||
rrdtool_create($cpurrd, ' --step 300 DS:LOAD:GAUGE:600:-1:100 '.$config['rrd_rra']);
|
||||
}
|
||||
echo "CPU: $cpu_usage%\n";
|
||||
$fields = array(
|
||||
'LOAD' => $cpu_usage,
|
||||
);
|
||||
rrdtool_update($cpurrd, $fields);
|
||||
$tags = array();
|
||||
influx_update($device,'fortigate_cpu',$tags,$fields);
|
||||
$graphs['fortigate_cpu'] = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user