Poller Bug

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

Moderators: Developers, Moderators

Post Reply
skizot722
Posts: 3
Joined: Wed Dec 14, 2005 5:23 pm

Poller Bug

Post by skizot722 »

I believe I've found a bug with the way the cacti poller works - specifically in cmd.php. First, here's some information about my problem:

Version: 0.8.6j
OS: Gentoo Linux
Problem: I am currently graphing about 25 machines, 10 of which are behind a firewall. Everything had been working great for these 10 machines for the past 2 years, until the external IP for that machine was switched to something else. Now, the way I had SNMP setup was to have the firewall forward ports 162-171 to port 161 on the respective machines behind the firewall. Everything was working fine until the IP of the firewall changed.

So, before you start saying it's a problem with the firewall, etc., etc. let me explain how these "devices" were setup in cacti and what I changed about them. When things were working I had an entry in my hosts file on the polling machine (where cacti runs) for each of these machines (even though they had the same external IP, which was the firewall IP). That is also how I had them setup in cacti as well, with the "Hostname" field populated with the hostname I had in my hosts file (such as ep-apache1, ep-apache2, ep-apache3, etc) and the correct port in "SNMP Port" field (162/162/163/etc).

So, when the firewall IP changed, instead of going into the hosts file on my polling machine, I just updated the "Hostname" field in cacti to the new IP for each of the 10 machines. From that point forward, only 1 out of the 10 machines behind the firewall was being graphed. argh!

I turned on full logging to watch the poller as it ran, and I noticed it was only picking up the first of the 10 hosts, ep-apache1. So, I started tracing through the code and came to the following lines in cmd.php:

Code: Select all

.....
$current_host = $item["hostname"];

if ($current_host != $last_host) {
	$new_host = true;
.....
This will obviously not work if you've got multiple hosts you're polling that are on the same IP, but are polled via different ports. Since SNMP allows you to use a different port than the default 161, and since cacti allows you to specify that port for each "device", the cmd.php script should be using the hostname *PLUS* the port number to uniquely identify hosts. Only looking at the hostname will result in the problem I've described above.

Yes, I know I can just update my hosts file and get things working again, but this is obviously a bug that I feel should be taken care of. I'd be willing to submit a fix if needed.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Please post a bug/feature request at: http://www.cacti.net/bugs.php
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
skizot722
Posts: 3
Joined: Wed Dec 14, 2005 5:23 pm

Post by skizot722 »

OK. I will post a bug report (and hopefully it's not seen as a "feature request"). :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest