Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #268 from laf/issue-laf-32
Added support for Cisco ASA Connection graphs
- Loading branch information
Showing
6 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
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 ; | ||
INSERT INTO `graph_types` SET `graph_type`='device', `graph_subtype`='asa_conns',`graph_section`='firewall',`graph_descr`='Current connections',`graph_order`='0'; |