mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Move mempool polling scripts into their own directory. add Juniper ScreenOS CPU/Memory hardcoded discovery/poller
git-svn-id: http://www.observium.org/svn/observer/trunk@1467 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
19
includes/discovery/mempools-screenos.inc.php
Executable file
19
includes/discovery/mempools-screenos.inc.php
Executable file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
if($device['os'] == "screenos") {
|
||||
|
||||
echo("ScreenOS: ");
|
||||
|
||||
$used = snmp_get($device, ".1.3.6.1.4.1.3224.16.2.1.0", "-OvQ");
|
||||
$total = snmp_get($device, ".1.3.6.1.4.1.3224.16.2.2.0", "-OvQ");
|
||||
$free = $total - $used;
|
||||
|
||||
$percent = $used / $total * 100;
|
||||
|
||||
if(is_numeric($total) && is_numeric($used)) {
|
||||
discover_mempool($valid_mempool, $device, 0, "screenos", "Memory", "1", NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
@ -7,6 +7,7 @@ include("mempools-cemp.inc.php");
|
||||
include("mempools-cmp.inc.php");
|
||||
include("mempools-junos.inc.php");
|
||||
include("mempools-ironware-dyn.inc.php");
|
||||
include("mempools-screenos.inc.php");
|
||||
|
||||
### Remove memory pools which weren't redetected here
|
||||
|
||||
|
20
includes/discovery/processors/screenos.inc.php
Normal file
20
includes/discovery/processors/screenos.inc.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
|
||||
if($device['os'] == "screenos" && mysql_result(mysql_query("SELECT COUNT(*) FROM processors WHERE device_id = '".$device['device_id']."' AND processor_type != 'screenos'"),0) == "0")
|
||||
{
|
||||
# .1.3.6.1.4.1.3224.16.1.3.0 Cpu Last 5 Minutes
|
||||
# discover_processor(&$valid, $device, $oid, $index, $type, $descr, $precision = "1", $current = NULL, $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
|
||||
|
||||
|
||||
echo("ScreenOS ");
|
||||
|
||||
$percent = snmp_get($device, ".1.3.6.1.4.1.3224.16.1.3.0", "-OvQ");
|
||||
|
||||
|
||||
if(is_numeric($percent)) {
|
||||
discover_processor($valid_processor, $device, ".1.3.6.1.4.1.3224.16.1.3.0", "1", "screenos", "Processor", "1", $percent, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -28,7 +28,7 @@ while($mempool = mysql_fetch_array($mempool_data)) {
|
||||
RRA:MAX:0.5:288:797");
|
||||
}
|
||||
|
||||
$file = $config['install_dir']."/includes/polling/mempools-".$mempool['mempool_type'].".inc.php";
|
||||
$file = $config['install_dir']."/includes/polling/mempools/".$mempool['mempool_type'].".inc.php";
|
||||
if(is_file($file)) {
|
||||
include($file);
|
||||
} else {
|
||||
|
10
includes/polling/mempools/screenos.inc.php
Executable file
10
includes/polling/mempools/screenos.inc.php
Executable file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
## Simple hard-coded poller for Brocade Ironware Dynamic Memory (old style)
|
||||
## Yes, it really can be this simple.
|
||||
|
||||
$mempool['used'] = snmp_get($device, ".1.3.6.1.4.1.3224.16.2.1.0", "-OvQ");
|
||||
$mempool['total'] = snmp_get($device, ".1.3.6.1.4.1.3224.16.2.2.0", "-OvQ");
|
||||
$mempool['free'] = $mempool['total'] - $mempool['used'];
|
||||
|
||||
?>
|
@ -3,59 +3,16 @@
|
||||
echo("Doing Juniper Netscreen (ScreenOS)");
|
||||
|
||||
$version = preg_replace("/(.+)\ version\ (.+)\ \(SN:\ (.+)\,\ (.+)\)/", "Juniper Netscreen \\1||\\2||\\3||\\4", $sysDescr);
|
||||
echo("$version\n");
|
||||
#echo("$version\n");
|
||||
list($hardware,$version,$serial,$features) = explode("||", $version);
|
||||
|
||||
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/screenos-cpu.rrd";
|
||||
$memrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/screenos-memory.rrd";
|
||||
$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/screenos-sessions.rrd";
|
||||
|
||||
$cpu_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
|
||||
$cpu_cmd .= " .1.3.6.1.4.1.3224.16.1.1.0 .1.3.6.1.4.1.3224.16.1.3.0";
|
||||
$cpu_data = shell_exec($cpu_cmd);
|
||||
list ($cpuav, $cpu5m) = explode("\n", $cpu_data);
|
||||
|
||||
$mem_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
|
||||
$mem_cmd .= " .1.3.6.1.4.1.3224.16.2.1.0 .1.3.6.1.4.1.3224.16.2.2.0 .1.3.6.1.4.1.3224.16.2.3.0";
|
||||
$mem_data = shell_exec($mem_cmd);
|
||||
list ($memalloc, $memfree, $memfrag) = explode("\n", $mem_data);
|
||||
|
||||
$sess_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
|
||||
$sess_cmd .= " .1.3.6.1.4.1.3224.16.3.2.0 .1.3.6.1.4.1.3224.16.3.3.0 .1.3.6.1.4.1.3224.16.3.4.0";
|
||||
$sess_data = shell_exec($sess_cmd);
|
||||
list ($sessalloc, $sessmax, $sessfailed) = explode("\n", $sess_data);
|
||||
|
||||
if (!is_file($cpurrd)) {
|
||||
`rrdtool create $cpurrd \
|
||||
--step 300 \
|
||||
DS:average:GAUGE:600:0:100 \
|
||||
DS:5min: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("rrdtool create $memrrd \
|
||||
--step 300 \
|
||||
DS:allocate:GAUGE:600:0:10000000000 \
|
||||
DS:left:GAUGE:600:0:10000000000 \
|
||||
DS:frag: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 \
|
||||
@ -72,9 +29,6 @@ if (!is_file($sessrrd)) {
|
||||
RRA:MAX:0.5:288:800`;
|
||||
}
|
||||
|
||||
|
||||
shell_exec($config['rrdtool'] . " update $cpurrd N:$cpuav:$cpu5m");
|
||||
shell_exec($config['rrdtool'] . " update $memrrd N:$memalloc:$memfree:$memfrag");
|
||||
shell_exec($config['rrdtool'] . " update $sessrrd N:$sessalloc:$sessmax:$sessfailed");
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user