Graph Tree Item as URL!!! :-)

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Post Reply
User avatar
drub
Cacti User
Posts: 59
Joined: Thu Jan 31, 2002 7:00 pm
Location: Las Vegas
Contact:

Graph Tree Item as URL!!! :-)

Post by drub »

I think it would be cool to make an option so when you add a new graph tree that you can make it a URL link instead of a tree per say. I have 3 Cacti boxes running and what I did was change a little code so that it shows the drop down list even if there is only one graph tree, then I added my own \<option> links to cacti server 2 & 3 and named them "Page 2" and "Page 3" etc..., and so I can see 1-15 Graph Tree items on server 1 and the last items say "Page 2" and "Page 3" if I click one, I now go to server 2 and the drop down shows items 16-30 and "Page 1" and "Page 3" etc... this is cool for multi cacti pollers. and easily linking them.

I Also added a timeout for the snmpgets in the snmp_functions.php so I can poll many more devices even if an interface goes down it does not bog down the polling, I poll over 800 interfaces in about 25 seconds now.



Drub
DavidM
Posts: 34
Joined: Sat Feb 08, 2003 9:52 pm

Post by DavidM »

Can you provide sample code of how you did the timeouts?
User avatar
drub
Cacti User
Posts: 59
Joined: Thu Jan 31, 2002 7:00 pm
Location: Las Vegas
Contact:

Post by drub »

I changed:
$snmp_value = @snmpget($hostname, $community, $oid);

To:
$snmp_value = @snmpget($hostname, $community, $oid, 40000, 2);

I believe it was line 165 in include/snmp_functions.php

I also added a timeout to a couple other timeout lines these start at line 179, I added a $MyTimeout variable then added it to the end of the snmp expressions.

if (read_config_option("smnp_version") == "ucd-snmp") {
$MyTimeout = "40000"; //I ADDED THIS LINE.
$snmp_value = exec(read_config_option("path_snmpget") . " $hostname $snmp_auth -v $version $oid $MyT
imeout"); //ADDED ", $MyTimeout" TO THE END OT THIS EXPRESSION.
}elseif (read_config_option("smnp_version") == "net-snmp") {
$snmp_value = exec(read_config_option("path_snmpget") . " $snmp_auth -v $version $hostname $oid $MyT
imeout"); //ADDED ", $MyTimeout" TO THE END OT THIS EXPRESSION.
}


Basically,(and this happened today :-)) if a device goes down each poll will timeout much faster and basically skip the down interfaces much faster, what would normally take well over 5 minutes to poll durring a downtime, now takes about 30 seconds, I now poll over 1000 snmp polls in about 28-35 seconds. and about 1 minute when there is something down.
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

I feel some explanation is needed to your changes. You have added timeout values for built-in SNMP support (around line 165 like you said) and for external SNMP support (with ucd- or net-snmp package). I have one remark for each case:

1. Timeout value for built-in snmpget function is in micro seconds. This means that your modification sets 40 ms of timeout and 2 retries only. While this greatly improves performance in LAN environment you may have a lot of problems polling WAN devices. Even default timeout which is 1 sec is not enough sometimes. It's not only a matter of latency on WAN links... also quite often SNMP agents do not respond immediately to requests.

2. Syntax you are using for external support looks a bit strange to me (e.g. snmpget <hostname> <community> <OID> <timeout>). This syntax is not covered by ucd-snmp manual. If you would like to specify timeout value for external command then this should look like this: snmpget -t <timeout> <hostname> <community> <OID>. One remark here - timeout value is in seconds this time. For net-snmp this will be similar.

- bulek
User avatar
drub
Cacti User
Posts: 59
Joined: Thu Jan 31, 2002 7:00 pm
Location: Las Vegas
Contact:

I Appologize for the errors

Post by drub »

I Appologize for the errors, yes I do see where the external calls are incorrect, I initially used external snmp then switched to internal before making these changes, So I did not test to see the errors I would have recieved, good catch.

I did fail to explain my network is very fast, it is also a WAN but I need much less than one second for my devices. Maybe an SNMP timeout could be added to the settings page, and people could adjust this based on thier needs.

I also think that maybe there is a way to count timeouts by counting good polls vs. failed polls, and making it so a timeout period could dynamically change on it's own, so the more timeouts that occur the longer(or shorter) the timeout could get.

So if you have a device that is down you might want the timeout to get shorter so it skips these faster, maybe this can be done on a per device basis in the poller.

Anyway, if any of what I said makes any sense, I hope it helps some.
Sorry bout the bad external expressions, And everyone make your own call as to how short you need the timeout, I know it saved my poll times from rolling over the 5 minute interval I have it set at now, by 4 extra minutes. :-)
User avatar
drub
Cacti User
Posts: 59
Joined: Thu Jan 31, 2002 7:00 pm
Location: Las Vegas
Contact:

This is probably more like it for external.

Post by drub »

This is probably more like it for external.

$snmp_value = exec(read_config_option("path_snmpget") . " $hostname $snmp_auth -t $MyTimeout -v $ver
sion $oid");
}elseif (read_config_option("smnp_version") == "net-snmp") {
$snmp_value = exec(read_config_option("path_snmpget") . " $snmp_auth -t $MyTimeout -v $version $host
name $oid");
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests