mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
git-svn-id: http://www.observium.org/svn/observer/trunk@408 61d68cd4-352d-0410-923a-c4978735b2b8
45 lines
2.2 KiB
PHP
Executable File
45 lines
2.2 KiB
PHP
Executable File
<?php
|
|
|
|
echo("Fortinet Fortigate Poller\n");
|
|
|
|
$fnSysVersion = shell_exec($config['snmpget']." -m FORTINET-MIB-280 -".$device['snmpver']." -Ovq -c ".$device['community']." ".$device['hostname'].":".$device['port']." fnSysVersion.0");
|
|
$serial = shell_exec($config['snmpget']." -m FORTINET-MIB-280 -".$device['snmpver']." -Ovq -c ".$device['community']." ".$device['hostname'].":".$device['port']." fnSysSerial.0");
|
|
|
|
$version = preg_replace("/(.+)\ (.+),(.+),(.+)/", "Fortinet \\1||\\2||\\3||\\4", $fnSysVersion);
|
|
list($hardware,$version,$features) = explode("||", $version);
|
|
|
|
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-cpu.rrd";
|
|
$memrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-memory.rrd";
|
|
$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-sessions.rrd";
|
|
|
|
$cmd = $config['snmpget'] . " -m FORTINET-MIB-280 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
|
|
$cmd .= " fnSysCpuUsage.0 fnSysMemUsage.0 fnSysSesCount.0 fnSysMemCapacity.0";
|
|
$data = shell_exec($cmd);
|
|
list ($cpu, $mem, $ses, $memsize) = explode("\n", $data);
|
|
|
|
if (!is_file($cpurrd)) {
|
|
shell_exec($config['rrdtool']." create $cpurrd --step 300 DS:cpu:GAUGE:600:0:100 \
|
|
RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \
|
|
RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800");
|
|
}
|
|
|
|
if (!is_file($memrrd)) {
|
|
|
|
shell_exec($config['rrdtool'] . " create $memrrd --step 300 \
|
|
DS:mem:GAUGE:600:0:10000000000 DS:memcapacity:GAUGE:600:0:10000000000 \
|
|
RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \
|
|
RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800");
|
|
}
|
|
|
|
if (!is_file($sessrrd)) {
|
|
`rrdtool create $sessrrd --step 300 DS:sessions:GAUGE:600:0:3000000 \
|
|
RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \
|
|
RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800`;
|
|
}
|
|
|
|
shell_exec($config['rrdtool'] . " update $cpurrd N:$cpu");
|
|
shell_exec($config['rrdtool'] . " update $memrrd N:$mem:$memsize");
|
|
shell_exec($config['rrdtool'] . " update $sessrrd N:$ses");
|
|
|
|
?>
|