Added support for Cisco ASA Connection graphs

This commit is contained in:
laf
2014-07-03 15:27:52 +01:00
parent 72c3e3e3c9
commit 7d2ee3bc56
6 changed files with 97 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ fua http://www.lathwood.co.uk>
*
* 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.
*/
$scale_min = "0";
include("includes/graphs/common.inc.php");
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/asa_conns.rrd";
$rrd_options .= " DEF:connections=$rrd_filename:connections:AVERAGE";
$rrd_options .= " DEF:connections_max=$rrd_filename:connections:MAX";
$rrd_options .= " DEF:connections_min=$rrd_filename:connections:MIN";
$rrd_options .= " AREA:connections_min";
$rrd_options .= " LINE1.5:connections#cc0000:'" . rrdtool_escape('Current connections')."'";
$rrd_options .= " GPRINT:connections_min:MIN:%4.0lf";
$rrd_options .= " GPRINT:connections:LAST:%4.0lf";
$rrd_options .= " GPRINT:connections_max:MAX:%4.0lf\\\\l";
?>

View File

@@ -529,6 +529,7 @@ $config['poller_modules']['netscaler-vsvr'] = 1;
$config['poller_modules']['aruba-controller'] = 1;
$config['poller_modules']['entity-physical'] = 1;
$config['poller_modules']['applications'] = 1;
$config['poller_modules']['cisco-asa-firewall'] = 1;
// List of discovery modules. Need to be in this array to be
// considered for execution.

View File

@@ -1079,6 +1079,10 @@ $config['graph_types']['device']['netscaler_tcp_pkts']['section'] = 'load balanc
$config['graph_types']['device']['netscaler_tcp_pkts']['order'] = '0';
$config['graph_types']['device']['netscaler_tcp_pkts']['descr'] = 'TCP Packets';
$config['graph_types']['device']['asa_conns']['section'] = 'firewall';
$config['graph_types']['device']['asa_conns']['order'] = '0';
$config['graph_types']['device']['asa_conns']['descr'] = 'Current connections';
$config['graph_descr']['device_smokeping_in_all'] = "This is an aggregate graph of the incoming smokeping tests to this host. The line corresponds to the average RTT. The shaded area around each line denotes the standard deviation.";
$config['graph_descr']['device_processor'] = "This is an aggregate graph of all processors in the system.";

View File

@@ -0,0 +1,58 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ fua http://www.lathwood.co.uk>
*
* 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($device['os_group'] == "cisco" && $device['os'] == "asa" && $device['type'] == "firewall")
{
$oid_list = "cfwConnectionStatValue.protoIp.currentInUse";
$temp_data = snmpwalk_cache_double_oid($device, $oid_list, array(), "CISCO-FIREWALL-MIB");
foreach ($temp_data as $oid => $result)
{
$oid = substr(strchr($oid, '.'),1);
$data[$oid]['data'] = $result['cfwConnectionStatValue'];
$asa_db = dbFetchCell("SELECT `ciscoASA_id` FROM `ciscoASA` WHERE `device_id` = ? AND `oid` = ?", array($device['device_id'],$oid));
if(!is_numeric($asa_db))
{
$asa_db = dbInsert(array('device_id' => $device['device_id'], 'oid' => $oid, 'data' => $result['cfwConnectionStatValue']), 'ciscoASA');
}
else
{
$asa_db = dbUpdate(array('data' => $result['cfwConnectionStatValue']), 'ciscoASA', 'device_id=?',array($device['device_id']));
}
$data[$oid]['db_id'] = $asa_db;
}
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("asa_conns.rrd");
$rrd_create .= " DS:connections:GAUGE:600:0:U";
$rrd_create .= $config['rrd_rra'];
if(is_file($rrd_filename) || $data['currentInUse'])
{
if (!file_exists($rrd_filename))
{
rrdtool_create($rrd_filename, $rrd_create);
}
$rrd_update = "N";
$rrd_update .= ":".$data['currentInUse']['data'];
rrdtool_update($rrd_filename, $rrd_update);
$graphs['asa_conns'] = TRUE;
echo(" ASA Connections");
}
unset($data,$rrd_filename,$rrd_create,$rrd_update);
}
?>

View File

@@ -1 +1,2 @@
ALTER TABLE `sensors` ADD `sensor_alert` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `sensor_limit_low_warn` ;
INSERT INTO `graph_types` SET `graph_type`='device', `graph_subtype`='asa_conns',`graph_section`='firewall',`graph_descr`='Current connections',`graph_order`='0';

1
sql-schema/032.sql Normal file
View File

@@ -0,0 +1 @@
CREATE TABLE IF NOT EXISTS `ciscoASA` ( `ciscoASA_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `oid` varchar(255) NOT NULL, `data` bigint(20) NOT NULL, `high_alert` bigint(20) NOT NULL, `low_alert` bigint(20) NOT NULL, `disabled` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`ciscoASA_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;