Skip to content

Instantly share code, notes, and snippets.

@dvopsway
Forked from abkfenris/asa-sessions.inc.php
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save dvopsway/6d0bb8f23d9a9dc28d88 to your computer and use it in GitHub Desktop.

Select an option

Save dvopsway/6d0bb8f23d9a9dc28d88 to your computer and use it in GitHub Desktop.
<?php
// Lives at html/pages/device/graphs/asa-sessions.inc.php
if ($device['os'] == "asa" || $device['os_group'] == "firewall")
{
$graph_title = "Firewall Sessions";
$graph_type = "asa_sessions";
include("includes/print-device-graph.php");
}
?>
<?php
// Lives at includes/polling/os/asa.inc.php
$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/asa-sessions.rrd";
$sessions = snmp_get($device, "1.3.6.1.4.1.9.9.147.1.2.2.2.1.5.40.6", "-Ovq");
if (is_numeric($sessions))
{
if (!is_file($sessrrd))
{
rrdtool_create($sessrrd," DS:sessions:GAUGE:600:0:3000000 "); }
rrdtool_update($sessrrd,"N:$sessions");
$graphs['asa_sessions'] = TRUE;
}
?>
<?php
// lives at html/includes/graphs/device/asa_sessions.inc.php
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("asa-sessions.rrd");
include("includes/graphs/common.inc.php");
$ds = "sessions";
$colour_area = "9999cc";
$colour_line = "0000cc";
$colour_area_max = "9999cc";
$graph_max = 1;
$unit_text = "Sessions";
include("includes/graphs/generic_simplex.inc.php");
?>
//add to graphtypes.inc.php in includes/definitions
$config['graph_types']['device']['asa_sessions']['section'] = 'firewall';
$config['graph_types']['device']['asa_sessions']['order'] = '0';
$config['graph_types']['device']['asa_sessions']['descr'] = 'Active Sessions';
## add to the bottom of the $os = "asa" block in includes/definitions/os.inc.php
$config['graph_types']['device']['asa_sessions']['section'] = 'firewall';
$config['graph_types']['device']['asa_sessions']['order'] = '0';
$config['graph_types']['device']['asa_sessions']['descr'] = 'Active Sessions';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment