Need Solution for polling scripts when running Cactid

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

Moderators: Developers, Moderators

Post Reply
twebster
Posts: 27
Joined: Wed Dec 18, 2002 9:58 am

Need Solution for polling scripts when running Cactid

Post by twebster »

We are currently running Cactid 0.8.4 using Cactid for polling. From previous posts I understand that Cactid doesn't not poll Data Sources with Host set to None, below is a quote from Ian

"At this point in time, cactid does not poll any data sources that have their host set to "None". That may be the cause of those data sources not being polled."

Ok, so I have removed my test host, configured it as a host with the SNMP Community blank. Now the host won't poll SNMP, then I use a graph templete for Linux load averages. It uses netsaint_statd to remotely poll hosts for their load average.

My theory, I am now using a Host instead of just a Data Source, so maybe it should work. Wrong. The host does not even appear in the Poller Cache.

Now here is my delima. We are using cactid because our polling was taking too long, even on our dual 2.6 Ghz zeon, but we need to poll host using our scripts.

questions.
1. How can I use Cactid and still continue to Poll via scripts? We can't continue to run two different servers.
2. Should my theory above work? Should cactid be polling my Host.
3. Could cmd.php be hacked to ignore the hosts that are using SNMP and only poll hosts when scripts are used to poll?

thanks,
twebster

past posts referenced:

http://raxnet.net/board/viewtopic.php?t=2887
http://raxnet.net/board/viewtopic.php?t=2953
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Re: Need Solution for polling scripts when running Cactid

Post by raX »

twebster wrote:1. How can I use Cactid and still continue to Poll via scripts? We can't continue to run two different servers.
Yes. As long as the data sources that are associated with these scripts are associated with a host, you'll be fine. Cactid is completely capable of gathering data from script output.
twebster wrote:2. Should my theory above work? Should cactid be polling my Host.
Yes, but just creating a host is not enough. You actually need to associate your data sources with the host. After doing this, you should see items in the poller cached related to this host.
twebster wrote:3. Could cmd.php be hacked to ignore the hosts that are using SNMP and only poll hosts when scripts are used to poll?
Of course, but this should not be necessary.

-Ian
twebster
Posts: 27
Joined: Wed Dec 18, 2002 9:58 am

How I add a host, step by step, please correct

Post by twebster »

Rax,

Below is my process for create a Host and giving it a Data source of a perl script (netsaint_statd).

1. Add new Polling Host
- Host Name - testhost
- Template - Linux Remote Machine
- ip address
- Delete SNMP community, I am not using snmp on this host
- Click Create

2. Create Data Source
- Data Template - "Linux - Load Average"
- Host - "testhost"
- Click Create

3. Finish Editting Data Source
- Change Data Source Description - "testhost - Load Average"
- Data source path - <path_rra>/testhost_load_avg.rrd
- Custom Data - Enter IP address again. (this should use the HOST ip but doesn't since it is a script)
- Click save to save Data Source.

4. Graph Management
- Click Add
- Graph Template - "Linux - Remote Load Average"
- Host - Select testhost
- Click create

5. Finish editing Graph Items
- All Graph Items are loaded from load average template
- Select 1min, 10min and 5min Graph Item Inputs
- Change Title - "testhost - Load Average"
- Click Save to save graph

6. Utilities
- View Poller Cache
- Search page by IP and host name, no results found
- Next, Clear Poller Cache
- Do a search again, nothing there regarding testhost

The host I created with the Data Source is not in the Poller Cache.

questions.
1. Am I setting up the Polling Host correctly?
2. What am I missing, why is this not working? Seems pretty easy, cacti is easy to setup but this just is not working.
3. In my Data Source, how can I use the HOST ip address instead of custom data field with IP Address? Is this even possible?

Thanks for the help.
tony
User avatar
golemb
Posts: 30
Joined: Mon Jun 02, 2003 12:47 pm

Post by golemb »

Hello;

I am in the same boat, but only with a php script. The cmd.php will poll datasources when the host is set to none, but cactid skips them. I also tried creating a dud host and running cactid. Cactid polls but throws an error about an ERROR: Field name ' ' not in field cache!

Code: Select all

[1] MUTLI command: /usr/local/php/bin/php /usr/local/apache2/htdocs/scripts/fetchweather.php CAXX0541, output: curtemp:-12.777777777778 windchill:-28.271604938272 feelstemp:-18.888888888889

MULTI expansion: found fieldname: current_temp, found rrdname: curtemp, local_data_id: 22
MULTI expansion: found fieldname: wind_temp, found rrdname: windchill, local_data_id: 22
MULTI expansion: found fieldname: feels_temp, found rrdname: feelstemp, local_data_id: 22
ERROR: Field name '
' not in field cache!
RRDCMD: update '/usr/local/apache2/htdocs/rra/weather_temp_22.rrd' --template current_temp:wind_temp:feels_temp:
 N:-12.777777777778:-28.271604938272:-18.888888888889
twebster
Posts: 27
Joined: Wed Dec 18, 2002 9:58 am

Similiar error on my Graph debug

Post by twebster »

Cactid polls but throws an error about an ERROR: Field name ' ' not in field cache!
I am having similiar error with my test host. After I create the Host, Data Source and Graph, my graph Debug says,

ERROR: opening '

Is Cacti possibly not creating a variable or loading a variable correctly, such that the poller does not have all the required input?

I will verify the output of my cactid poll script to look for any error messages there.

Thanks,
tony
twebster
Posts: 27
Joined: Wed Dec 18, 2002 9:58 am

Items not showing in Poller Cache

Post by twebster »

Ok, I have tried many different options but still none of my new hosts are being entered into the Poller Cache.

1. I have upgraded to 0.8.5
2. I have created a seperate new install of cacti 0.8.5
3. I have tried adding a new linux host device both with SNMP enabled and SNMP disabled.

Basically, I perform the following.

1. Click devices
2. Add new, put in desc, hostname, set host template to "Linux Remote Machine" enter community string and select SNMP version 2c.
3. After saving, click Create Graphs for this Host"
4. Select graph template I created called "Linux - Remote Load Average", (netsaint_statd program call, input is ip address, output is 1min, 5min, 10min)

5. Fill Host desc, and Data source name, and fill in custom data of IP address.
6. Look in graph management, graph settings look fine.
7. Look in Poller Cache and nothing is there. Why is my new graph not in poller cache?
8. "Clear poller" cache does not help either.

Note, I have also tried using snmp instead of netstaint_statd to get load average but same poller cache problem occur.

Question.
1. Why are my devices not being inserted into the Poller cache?
2. Is there a bug here or am I doing something wrong?
3. Could a "goofy" template prevent the device from getting into the poller cache.

Thanks,
tony
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Re: Items not showing in Poller Cache

Post by raX »

twebster wrote:3. Could a "goofy" template prevent the device from getting into the poller cache.
Yes, but this is really only known to happen with data queries. Sometimes if you incorrectly create a data query, it just won't work (ie. no items in the poller cache). However in your case it looks like you are just calling a script that has three outputs... not a data query.

Typically when I run into a problem like this, I try and grab the exact SQL insert that is failing and causing your items not to end up in the poller cache. There are also certain situations where Cacti never makes it to the insert, which usually indicates some other issue.

To debug, try inserting the following line of code at line 139 of 'lib/utility.php'.

Code: Select all

print "insert into data_input_data_cache (local_data_id,host_id,data_input_id,action,hostname,
					snmp_community,snmp_version,snmp_timeout,snmp_username,snmp_password,snmp_port,rrd_name,rrd_path,
					command,rrd_num) values ($local_data_id," . (empty($host["id"]) ? 0 : $host["id"]) . "," . $data_input["id"] . ",$action_type,'" . $host["hostname"] . "',
					'" . $host["snmp_community"] . "','" . $host["snmp_version"] . "','" . $host["snmp_timeout"] . "',
					'" . $host["snmp_username"] . "','" . $host["snmp_password"] . "','" . $host["snmp_port"] . "',
					'" . get_data_source_name($data_template_rrd_id) . "',
					'" . addslashes(clean_up_path(get_data_source_path($local_data_id,true))) . "','" . addslashes($command) . "',1)<br>";
When you clear your poller cache, you should see each insert that Cacti is trying to execute.

-Ian
twebster
Posts: 27
Joined: Wed Dec 18, 2002 9:58 am

debug shows cacti not making to insert

Post by twebster »

Rax,

You are correct the output of the debug in the "Clear Poller Cache" does not show any of my new devices that I have created including my Linux netsaint_statd hosts and a Cisco Switch.

The only items I see in the Clear Poller Cache debug output in my brand new 0.8.5 testing installation is the default localhost scripts.

Cacti is not even trying to insert my new hosts into the Cache.

Where should I debug next?

Thanks for the help,
tony
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Could you export your "Linux - Remote Load Average" graph template to XML and attach it here? I might be able to spot something by importing it on my installation and taking a closer look. If I cannot find anything there, we can debug the code further.

-Ian
twebster
Posts: 27
Joined: Wed Dec 18, 2002 9:58 am

export of "linux - remote load average"

Post by twebster »

attached is output of graph template "Linux - Remote Load Average"

Thanks for the help. We have been struggling for weeks trying to find a solution to this problem. Currently we are running 0.8.6 on our new server and the old 0.6.4 on an old machine that handles the external scripts.

thanks,
tony
Attachments
cacti_graph_template_linux_remote_load_average.xml
export of linux -remote load average
(11.73 KiB) Downloaded 158 times
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I think I found it...

If you take a look at the "Linux - Loadavg" data input method, the "Input Type" is set to "Script Query". Since you are just executing a single script and expecting back a result, you should select "Script/Command" here.

-Ian
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest