[solved}graph display different data than snmp output

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
User avatar
_raindrop18
Cacti User
Posts: 194
Joined: Thu Jan 29, 2009 5:52 pm
Location: US

[solved}graph display different data than snmp output

Post by _raindrop18 »

I am working on CPU idle time template for checkpoint firewall, however the data on the graph is completely different than the snmp out put. I didn't use any CDEF or calculation. it appears to be instead of 97 -display 3 or 96 -4 looks like display reveres.

snmp output looks like this.
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.1.0 = INTEGER: 97
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.2.0 = INTEGER: 96
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.3.0 = INTEGER: 77
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.4.0 = INTEGER: 98
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.5.0 = INTEGER: 93
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.6.0 = INTEGER: 98
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.7.0 = INTEGER: 98
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.8.0 = INTEGER: 97
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.9.0 = INTEGER: 98
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.10.0 = INTEGER: 96
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.11.0 = INTEGER: 96
SNMPv2-SMI::enterprises.2620.1.6.7.5.1.4.12.0 = INTEGER: 97
and the graph for one of CPU
Cacti-firewall.png
Cacti-firewall.png (19.7 KiB) Viewed 1066 times
my graph template
Cacti-fw_graph-temp.png
Cacti-fw_graph-temp.png (21.33 KiB) Viewed 1066 times
so not sure where this odd numbers came from and how I can debug that. because the regular debug didn't show me any problem.
RRDTool Command:

/usr/rrdtool-1.2.19/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="firewall - CPU Idle Time Firewall- CPU0 " \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="percent" \
--slope-mode \
--font TITLE:10: \
--font AXIS:6: \
--font LEGEND:8: \
--font UNIT:6: \
DEF:a="/opt/cacti/rra/824/7422.rrd":cpu_idle:AVERAGE \
AREA:a#FF0000FF:"CPU Idle" \
GPRINT:a:LAST:"Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"
Last edited by _raindrop18 on Mon Sep 23, 2013 12:41 pm, edited 1 time in total.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: graph display different data than snmp output

Post by gandalf »

Please see the debugging guide nevertheless to find out, which data has been returned from that target
R.
User avatar
_raindrop18
Cacti User
Posts: 194
Joined: Thu Jan 29, 2009 5:52 pm
Location: US

Re: graph display different data than snmp output

Post by _raindrop18 »

yes I did debug, and still I didn't understand the out put

Code: Select all

09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7772.rrd --template cpu_idle 1379693407:0
09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7774.rrd --template cpu_idle 1379693407:0
09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7773.rrd --template cpu_idle 1379693407:1
09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7771.rrd --template cpu_idle 1379693407:1
09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7770.rrd --template cpu_idle 1379693407:3
09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7781.rrd --template cpu_idle 1379693407:1
09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7776.rrd --template cpu_idle 1379693407:1
09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7777.rrd --template cpu_idle 1379693407:0
09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7778.rrd --template cpu_idle 1379693407:1
09/20/2013 09:10:23 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.19/bin/rrdtool update /opt/cacti/local/cacti-0.8.7e/rra/831/7779.rrd --template cpu_idle 1379693407:0
and this is my script server script I am used
<?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(0);

if (isset($config)) {
include_once(dirname(__FILE__) . "/../lib/snmp.php");
}

if (!isset($called_by_script_server)) {
include_once(dirname(__FILE__) . "/../include/global.php");
include_once(dirname(__FILE__) . "/../lib/snmp.php");

array_shift($_SERVER["argv"]);

print call_user_func_array("ss_host_cpu_idle_fw", $_SERVER["argv"]);
}

function ss_host_cpu_idle_fw($hostname, $host_id, $snmp_auth, $cmd, $arg1 = "", $arg2 = "") {
$snmp = explode(":", $snmp_auth);
$snmp_version = $snmp[0];
$snmp_port = $snmp[1];
$snmp_timeout = $snmp[2];
$ping_retries = $snmp[3];
$max_oids = $snmp[4];

$snmp_auth_username = "";
$snmp_auth_password = "";
$snmp_auth_protocol = "";
$snmp_priv_passphrase = "";
$snmp_priv_protocol = "";
$snmp_context = "";
$snmp_community = "";

if ($snmp_version == 3) {
$snmp_auth_username = $snmp[6];
$snmp_auth_password = $snmp[7];
$snmp_auth_protocol = $snmp[8];
$snmp_priv_passphrase = $snmp[9];
$snmp_priv_protocol = $snmp[10];
$snmp_context = $snmp[11];
}else{
$snmp_community = $snmp[5];
}

$oids = array(
"index" => "1.3.6.1.4.1.2620.1.6.7.5.1.1",
"usage" => "1.3.6.1.4.1.2620.1.6.7.5.1.4"
);

if (($cmd == "index")) {
$arr_index = ss_host_cpu_idle_fw_get_indexes($hostname, $snmp_community, $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids);

for ($i=0;($i<sizeof($arr_index));$i++) {
print $arr_index[$i] . "\n";
}

}elseif (($cmd == "num_indexes")) {
$arr_index = ss_host_cpu_idle_fw_get_indexes($hostname, $snmp_community, $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids);

print sizeof($arr_index);

} elseif ($cmd == "query") {
$arg = $arg1;

$arr_index = ss_host_cpu_idle_fw_get_indexes($hostname, $snmp_community, $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids);
$arr = ss_host_cpu_idle_get_cpu_fw_usage($hostname, $snmp_community, $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids);

for ($i=0;($i<sizeof($arr_index));$i++) {
if ($arg == "usage") {
print $arr_index[$i] . "!" . $arr[$i] . "\n";
}elseif ($arg == "index") {
print $arr_index[$i] . "!" . $arr_index[$i] . "\n";
}
}
} elseif ($cmd == "get") {
$arg = $arg1;
$index = rtrim($arg2);

$arr_index = ss_host_cpu_idle_fw_get_indexes($hostname, $snmp_community, $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids);
$arr = ss_host_cpu_idle_get_cpu_fw_usage($hostname, $snmp_community, $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids);
if (isset($arr_index[$index])) {
return $arr[$index];
} else {
return "ERROR: Invalid Return Value";
}
}
}

function ss_host_cpu_idle_get_cpu_fw_usage($hostname, $snmp_community, $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids) {
$arr = ss_host_cpu_idle_fw_reindex(cacti_snmp_walk($hostname, $snmp_community, ".1.3.6.1.4.1.2620.1.6.7.5.1.4", $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids, SNMP_POLLER));
$return_arr = array();

$j = 0;

for ($i=0;($i<sizeof($arr));$i++) {
if (is_numeric($arr[$i])) {
$return_arr[$j] = $arr[$i];
$j++;
}
}

return $return_arr;
}

function ss_host_cpu_idle_fw_get_indexes($hostname, $snmp_community, $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids) {
$arr = ss_host_cpu_idle_fw_reindex(cacti_snmp_walk($hostname, $snmp_community, "1.3.6.1.4.1.2620.1.6.7.5.1.1", $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids, SNMP_POLLER));
$return_arr = array();

$j = 0;

for ($i=0;($i<sizeof($arr));$i++) {
if (is_numeric($arr[$i])) {
$return_arr[$j] = $j;
$j++;
}
}

return $return_arr;
}

function ss_host_cpu_idle_fw_reindex($arr) {
$return_arr = array();
for ($i=0;($i<sizeof($arr));$i++) {
$return_arr[$i] = $arr[$i]["value"];
}
return $return_arr;
}

?>
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: graph display different data than snmp output

Post by gandalf »

The debug output shows, that those low numbers are returned from the script. So I suppose that there's an issue with that
R.
User avatar
_raindrop18
Cacti User
Posts: 194
Joined: Thu Jan 29, 2009 5:52 pm
Location: US

[solved]Re: graph display different data than snmp output

Post by _raindrop18 »

thanks, yes the script was the issue, using snmp queries instead of script server and now it works.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests