Merge pull request #2053 from chrisgfx/issue-1870

Issue 1870 : Pulse Secure OS support
This commit is contained in:
Neil Lathwood
2015-10-10 10:28:01 +01:00
11 changed files with 968 additions and 0 deletions
+20
View File
@@ -553,6 +553,18 @@ $config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
// Pulse Secure OS definition
$os = 'pulse';
$config['os'][$os]['text'] = 'Pulse Secure';
$config['os'][$os]['type'] = 'firewall';
$config['os'][$os]['icon'] = 'junos';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'fortigate';
$config['os'][$os]['text'] = 'Fortinet Fortigate';
$config['os'][$os]['type'] = 'firewall';
@@ -1494,6 +1506,14 @@ $config['graph_types']['device']['panos_sessions']['section'] = 'firewall';
$config['graph_types']['device']['panos_sessions']['order'] = '0';
$config['graph_types']['device']['panos_sessions']['descr'] = 'Active Sessions';
//Pulse Secure Graphs
$config['graph_types']['device']['pulse_users']['section'] = 'firewall';
$config['graph_types']['device']['pulse_users']['order'] = '0';
$config['graph_types']['device']['pulse_users']['descr'] = 'Active Users';
$config['graph_types']['device']['pulse_sessions']['section'] = 'firewall';
$config['graph_types']['device']['pulse_sessions']['order'] = '0';
$config['graph_types']['device']['pulse_sessions']['descr'] = 'Active Sessions';
$config['graph_types']['device']['bits']['section'] = 'netstats';
$config['graph_types']['device']['bits']['order'] = '0';
$config['graph_types']['device']['bits']['descr'] = 'Total Traffic';
+23
View File
@@ -0,0 +1,23 @@
<?php
/*
* LibreNMS Pulse Secure OS information module
*
* Copyright (c) 2015 Christophe Martinet Chrisgfx <martinet.christophe@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
//
// Hardcoded discovery of Memory usage on Pulse Secure devices.
//
if ($device['os'] == 'pulse') {
echo 'PULSE-MEMORY-POOL: ';
$usage = str_replace('"', "", snmp_get($device, 'PULSESECURE-PSG-MIB::iveMemoryUtil.0', '-OvQ'));
if (is_numeric($usage)) {
discover_mempool($valid_mempool, $device, 0, 'pulse-mem', 'Main Memory', '100', null, null);
}
}
+16
View File
@@ -0,0 +1,16 @@
<?php
/*
* LibreNMS Pulse Secure OS information module
*
* Copyright (c) 2015 Christophe Martinet Chrisgfx <martinet.christophe@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (strstr($sysDescr, 'Pulse Connect Secure')) {
$os = 'pulse';
}
}
@@ -0,0 +1,25 @@
<?php
/*
* LibreNMS Pulse Secure OS information module
*
* Copyright (c) 2015 Christophe Martinet Chrisgfx <martinet.christophe@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
//
// Hardcoded discovery of CPU usage on Pulse Secure devices.
//
if ($device['os'] == 'pulse') {
echo 'Pulse Secure : ';
$descr = 'Processor';
$usage = str_replace('"', "", snmp_get($device, 'PULSESECURE-PSG-MIB::iveCpuUtil.0', '-OvQ'));
if (is_numeric($usage)) {
discover_processor($valid['processor'], $device, 'PULSESECURE-PSG-MIB::iveCpuUtil.0', '0', 'pulse-cpu', $descr,
'100', $usage, null, null);
}
}
@@ -0,0 +1,30 @@
<?php
/*
* LibreNMS Pulse Secure OS information module
*
* Copyright (c) 2015 Christophe Martinet Chrisgfx <martinet.christophe@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
// Simple hard-coded poller for Pulse Secure
// Yes, it really can be this simple.
echo 'Pulse Secure MemPool'.'\n';
if ($device['os'] == 'pulse') {
$perc = str_replace('"', "", snmp_get($device, "PULSESECURE-PSG-MIB::iveMemoryUtil.0", '-OvQ'));
$memory_available = str_replace('"', "", snmp_get($device, "UCD-SNMP-MIB::memTotalReal.0", '-OvQ'));
$mempool['total'] = $memory_available;
if (is_numeric($perc)) {
$mempool['used'] = ($memory_available / 100 * $perc);
$mempool['free'] = ($memory_available - $mempool['used']);
}
echo "PERC " .$perc."%\n";
echo "Avail " .$mempool['total']."\n";
}
+37
View File
@@ -0,0 +1,37 @@
<?php
/*
* LibreNMS Pulse Secure OS information module
*
* Copyright (c) 2015 Christophe Martinet Chrisgfx <martinet.christophe@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$version = trim(snmp_get($device, "productVersion.0", "-OQv", "PULSESECURE-PSG-MIB"),'"');
$hardware = "Juniper " . trim(snmp_get($device, "productName.0", "-OQv", "PULSESECURE-PSG-MIB"),'"');
$hostname = trim(snmp_get($device, "sysName.0", "-OQv", "SNMPv2-MIB"),'"');
$usersrrd = $config['rrd_dir'].'/'.$device['hostname'].'/pulse_users.rrd';
$users = snmp_get($device, 'PULSESECURE-PSG-MIB::iveConcurrentUsers.0', '-OQv');
if (is_numeric($users)) {
if (!is_file($usersrrd)) {
rrdtool_create($usersrrd, ' DS:users:GAUGE:600:0:U'.$config['rrd_rra']);
}
rrdtool_update($usersrrd, "N:$users");
$graphs['pulse_users'] = true;
}
$sessrrd = $config['rrd_dir'].'/'.$device['hostname'].'/pulse_sessions.rrd';
$sessions = snmp_get($device, 'PULSESECURE-PSG-MIB::iveConcurrentUsers.0', '-OQv');
if (is_numeric($sessions)) {
if (!is_file($sessrrd)) {
rrdtool_create($sessrrd, ' DS:sessions:GAUGE:600:0:U '.$config['rrd_rra']);
}
rrdtool_update($sessrrd, "N:$sessions");
$graphs['pulse_sessions'] = true;
}
@@ -0,0 +1,23 @@
<?php
/*
* LibreNMS Pulse Secure OS information module
*
* Copyright (c) 2015 Christophe Martinet Chrisgfx <martinet.christophe@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
// Simple hard-coded poller for Pulse Secure
// Yes, it really can be this simple.
echo 'Pulse Secure CPU Usage';
if ($device['os'] == 'pulse') {
$usage = str_replace('"', "", snmp_get($device, 'PULSESECURE-PSG-MIB::iveCpuUtil.0', '-OvQ'));
if (is_numeric($usage)) {
$proc = ($usage * 100);
}
}