This is my first script.
I tried to monitor trunk group load, and everything is ok, except snmp timeout.
But when I want to view dsp resources, i've got problems:
Script based on "Generic SNMPwalk to retrieve multiple values in one run"
Code: Select all
<?php
/* do NOT run this script through a web browser */
if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}
$no_http_headers = true;
/* display No errors */
error_reporting(E_ERROR);
include_once(dirname(__FILE__) . "/../lib/snmp.php");
if (!isset($called_by_script_server)) {
if (file_exists(dirname(__FILE__) . "/../include/global.php")) {
include_once(dirname(__FILE__) . "/../include/global.php");
} else {
include_once(dirname(__FILE__) . "/../include/config.php");
}
array_shift($_SERVER["argv"]);
print call_user_func_array("ss_avaya_dsp", $_SERVER["argv"]);
}
function ss_avaya_dsp($hostname, $snmp_community, $snmp_version, $snmp_port, $snmp_timeout, $snmp_auth_username="", $snmp_auth_password="", $snmp_auth_protocol="", $snmp_priv_passphrase="", $snmp_priv_protocol="", $snmp_context="") {
$result = 0;
$arr = cacti_snmp_walk($hostname, $snmp_community, ".1.3.6.1.4.1.6889.2.9.1.4.6.1.2", $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, read_config_option("snmp_retries"), SNMP_POLLER);
for ($i=0;($i<sizeof($arr));$i++) {
if (is_numeric($arr[$i]["value"])) {
$result += $arr[$i]["value"];
}
}
$cacti_result = "TotalDSPChannels:" . trim($result);
$result = 0;
$arr = cacti_snmp_walk($hostname, $snmp_community, ".1.3.6.1.4.1.6889.2.9.1.4.6.1.3", $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, read_config_option("snmp_retries"), SNMP_POLLER);
for ($i=0;($i<sizeof($arr));$i++) {
if (is_numeric($arr[$i]["value"])) {
$result += $arr[$i]["value"];
}
}
$cacti_result = $cacti_result." ActiveDSPChannels:" . trim($result);
return $cacti_result;
}
?>
But
Code: Select all
C:\net-snmp\bin>snmpwalk.exe -c public -v 2c -t 0.5 192.168.1.220 .1.3.6.1.4.1.6889.2.9.1.4.6.1.3
SNMPv2-SMI::enterprises.6889.2.9.1.4.6.1.3.101.1 = INTEGER: 9
SNMPv2-SMI::enterprises.6889.2.9.1.4.6.1.3.101.2 = INTEGER: 7
SNMPv2-SMI::enterprises.6889.2.9.1.4.6.1.3.101.3 = INTEGER: 3
SNMPv2-SMI::enterprises.6889.2.9.1.4.6.1.3.101.4 = INTEGER: 5
Script and template to monitor trunks in atachment.