add HP Procurve FDB count graph

git-svn-id: http://www.observium.org/svn/observer/trunk@1543 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-07-30 13:54:00 +00:00
parent aeee6d1eed
commit 985ec190c6
5 changed files with 41 additions and 38 deletions

View File

@@ -6,4 +6,4 @@ ALTER TABLE `sensors` ADD `sensor_multiplier` INT( 11 ) NOT NULL AFTER `sensor
CREATE TABLE IF NOT EXISTS `device_graphs` ( `device_id` int(11) NOT NULL, `graph` varchar(32) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `graph_types`;
CREATE TABLE IF NOT EXISTS `graph_types` ( `graph_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_subtype` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_section` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_descr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `graph_order` int(11) NOT NULL, KEY `graph_type` (`graph_type`), KEY `graph_subtype` (`graph_subtype`), KEY `graph_section` (`graph_section`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `graph_types` (`graph_type`, `graph_subtype`, `graph_section`, `graph_descr`, `graph_order`) VALUES('device', 'bits', 'netstats', 'Total Traffic', 0),('device', 'hr_users', 'system', 'Users Logged In', 0),('device', 'ucd_load', 'system', 'Load Averages', 0),('device', 'ucd_cpu', 'system', 'Detailed Processor Usage', 0),('device', 'ucd_memory', 'system', 'Detailed Memory Usage', 0),('device', 'netstat_tcp', 'netstats', 'TCP Statistics', 0),('device', 'netstat_icmp_info', 'netstats', 'ICMP Informational Statistics', 0),('device', 'netstat_icmp_stat', 'netstats', 'ICMP Statistics', 0),('device', 'netstat_ip', 'netstats', 'IP Statistics', 0),('device', 'netstat_ip_frag', 'netstats', 'IP Fragmentation Statistics', 0),('device', 'netstat_udp', 'netstats', 'UDP Statistics', 0),('device', 'netstat_snmp', 'netstats', 'SNMP Statistics', 0),('device', 'temperatures', 'system', 'Temperatures', 0),('device', 'mempools', 'system', 'Memory Pool Usage', 0),('device', 'processors', 'system', 'Processor Usage', 0),('device', 'storage', 'system', 'Filesystem Usage', 0),('device', 'hr_processes', 'system', 'Running Processes', 0),('device', 'uptime', 'system', 'System Uptime', ''),('device', 'ipsystemstats_ipv4', 'netstats', 'IPv4 Packet Statistics', 0),('device', 'ipsystemstats_ipv6_frag', 'netstats', 'IPv6 Fragmentation Statistics', 0),('device', 'ipsystemstats_ipv6', 'netstats', 'IPv6 Packet Statistics', 0),('device', 'ipsystemstats_ipv4_frag', 'netstats', 'IPv4 Fragmentation Statistics', 0),('device', 'fortigate_sessions', 'firewall', 'Active Sessions', ''), ('device', 'screenos_settings', 'firewall', 'Active Sessions', '');
INSERT INTO `graph_types` (`graph_type`, `graph_subtype`, `graph_section`, `graph_descr`, `graph_order`) VALUES('device', 'bits', 'netstats', 'Total Traffic', 0),('device', 'hr_users', 'system', 'Users Logged In', 0),('device', 'ucd_load', 'system', 'Load Averages', 0),('device', 'ucd_cpu', 'system', 'Detailed Processor Usage', 0),('device', 'ucd_memory', 'system', 'Detailed Memory Usage', 0),('device', 'netstat_tcp', 'netstats', 'TCP Statistics', 0),('device', 'netstat_icmp_info', 'netstats', 'ICMP Informational Statistics', 0),('device', 'netstat_icmp_stat', 'netstats', 'ICMP Statistics', 0),('device', 'netstat_ip', 'netstats', 'IP Statistics', 0),('device', 'netstat_ip_frag', 'netstats', 'IP Fragmentation Statistics', 0),('device', 'netstat_udp', 'netstats', 'UDP Statistics', 0),('device', 'netstat_snmp', 'netstats', 'SNMP Statistics', 0),('device', 'temperatures', 'system', 'Temperatures', 0),('device', 'mempools', 'system', 'Memory Pool Usage', 0),('device', 'processors', 'system', 'Processor Usage', 0),('device', 'storage', 'system', 'Filesystem Usage', 0),('device', 'hr_processes', 'system', 'Running Processes', 0),('device', 'uptime', 'system', 'System Uptime', ''),('device', 'ipsystemstats_ipv4', 'netstats', 'IPv4 Packet Statistics', 0),('device', 'ipsystemstats_ipv6_frag', 'netstats', 'IPv6 Fragmentation Statistics', 0),('device', 'ipsystemstats_ipv6', 'netstats', 'IPv6 Packet Statistics', 0),('device', 'ipsystemstats_ipv4_frag', 'netstats', 'IPv4 Fragmentation Statistics', 0),('device', 'fortigate_sessions', 'firewall', 'Active Sessions', ''), ('device', 'screenos_settings', 'firewall', 'Active Sessions', ''), ('device', 'fdb_count', 'system', 'MAC Addresses Learnt', '0');

View File

@@ -4,6 +4,8 @@ if(is_numeric($id)) {
$device = device_by_id_cache($id);
}
#if(!device_permitted($device['device_id'])) { echo("Not Permitted"); exit; }
$title = generatedevicelink($device);
?>

View File

@@ -0,0 +1,17 @@
<?php
$scale_min = "0";
include("includes/graphs/common.inc.php");
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/fdb_count.rrd";
$rrd_options .= " DEF:value=$rrd_filename:value:AVERAGE";
$rrd_options .= " CDEF:cvalue=value,86400,/";
$rrd_options .= " COMMENT:'MACs Current Minimum Maximum Average\\n'";
$rrd_options .= " AREA:cvalue#EEEEEE:value";
$rrd_options .= " LINE1.25:cvalue#36393D:";
$rrd_options .= " GPRINT:cvalue:LAST:%6.2lf\ GPRINT:cvalue:AVERAGE:%6.2lf\ ";
$rrd_options .= " GPRINT:cvalue:MAX:%6.2lf\ GPRINT:cvalue:AVERAGE:%6.2lf\\\\n";
?>

View File

@@ -1,28 +1,21 @@
<?php
list($hardware, $features, $version) = explode(",", str_replace(", ", ",", $sysDescr));
list($version) = explode("(", $version);
list($hardware, $version, $features) = explode(",", str_replace(", ", ",", $sysDescr));
list($features) = explode("(", $version);
$fdb_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/fdb_count.rrd";
$FdbAddressCount = snmp_get ($device, "hpSwitchFdbAddressCount.0", "-Ovqn", "STATISTICS-MIB", $config['mib_dir'].":".$config['mib_dir']."/hp");
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/procurve-cpu.rrd";
$memrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/procurve-mem.rrd";
if(is_numeric($FdbAddressCount))
{
$cpu_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " 1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0";
$cpu = shell_exec($cpu_cmd);
$mem_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$mem_cmd .= " 1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.5.1 1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.6.1 1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.7.1";
$mem = shell_exec($mem_cmd);
list ($memtotal, $memfree, $memused) = explode("\n", $mem);
$memused = $memused + 0;
$memfree = $memfree + 0;
$memtotal = $memtotal + 0;
if (!is_file($cpurrd)) {
$rrdcreate = shell_exec($config['rrdtool'] ." create $cpurrd --step 300 DS:LOAD:GAUGE:600:-1:100 RRA:AVERAGE:0.5:1:1200 RRA:AVERAGE:0.5:1:2000 \
if (!is_file($fdb_rrd_file))
{
rrdtool_create($fdb_rrd_file, " --step 300 \
DS:value:GAUGE:600:-1:100000 \
RRA:AVERAGE:0.5:1:1200 \
RRA:AVERAGE:0.5:1:2000 \
RRA:AVERAGE:0.5:6:2000 \
RRA:AVERAGE:0.5:24:2000 \
RRA:AVERAGE:0.5:288:2000 \
@@ -34,23 +27,14 @@ if (!is_file($cpurrd)) {
RRA:MIN:0.5:6:2000 \
RRA:MIN:0.5:24:2000 \
RRA:MIN:0.5:288:2000");
}
if (!is_file($memrrd)) {
$rrdcreate = shell_exec($config['rrdtool'] ." create $memrrd --step 300 DS:TOTAL:GAUGE:600:0:500000000 DS:FREE:GAUGE:600:-1:500000000 DS:USED:GAUGE:600:0:500000000 RRA:AVERAGE:0.5:1:1200 RRA:AVERAGE:0.5:1:2000 \
RRA:AVERAGE:0.5:6:2000 \
RRA:AVERAGE:0.5:24:2000 \
RRA:AVERAGE:0.5:288:2000 \
RRA:MAX:0.5:1:2000 \
RRA:MAX:0.5:6:2000 \
RRA:MAX:0.5:24:2000 \
RRA:MAX:0.5:288:2000 \
RRA:MIN:0.5:1:2000 \
RRA:MIN:0.5:6:2000 \
RRA:MIN:0.5:24:2000 \
RRA:MIN:0.5:288:2000");
}
}
rrdtool_update($cpurrd, "N:$cpu");
rrdtool_update($memrrd, "N:$memtotal:$memfree:$memused");
rrdtool_update($fdb_rrd_file, "N:$FdbAddressCount");
$graphs['fdb_count'] = TRUE;
echo("FDB Count ");
}
?>

View File

@@ -106,7 +106,7 @@ while ($device = mysql_fetch_array($device_query))
$hrSystemUptime = snmp_get($device, ".1.3.6.1.2.1.25.1.1.0", "-Oqv", "HOST-RESOURCES-MIB");
echo("UPTIMES: ".$hrSystemUptime."|".$sysUptime."]");
#echo("UPTIMES: ".$hrSystemUptime."|".$sysUptime."]");
#SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31
$sysUptime = str_replace("(", "", $sysUptime);