MySQL error messages when using Cactid poller

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

Moderators: Developers, Moderators

vcs714
Posts: 23
Joined: Thu May 05, 2005 3:53 am

MySQL error messages when using Cactid poller

Post by vcs714 »

Hi

I have recently changed poller from cmd.php to cactid, I am getting the following error messages in the cacti log file.

05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '4940-traffic_out-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '4940-traffic_in-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '4939-traffic_out-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '4939-traffic_in-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '5269-sysUpTime-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '4880-cisco_mem_used-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '3522-cisco_mem_used-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '4878-cisco_mem_free-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '3520-cisco_mem_free-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '4879-5min_cpu-2005-05-05 10:50:02' for key 1
05/05/2005 10:50:46 AM - CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry '3521-5min_cpu-2005-05-05 10:50:02' for key 1

My graphs are getting updated properly.

Vijay
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Looks like you are running 2 pollers.....

Remember, with cactid, you still execute poller.php. Poller.php will call cactid to perform the polling, and then poller.php will update the rrd from the data the poller has collected.
[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]
vcs714
Posts: 23
Joined: Thu May 05, 2005 3:53 am

Post by vcs714 »

Hi Rony

Thanks for your reply

The only time that cactid poller works is when I use the following entry in crontab.

*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

but this generates the duplicate CACTID: Poller[0] ERROR: Problem with MySQL: Duplicate entry messages.

I have tried using the following entries in crontab

*/5 * * * * /usr/local/cactid/bin/cactid > /dev/null 2> /dev/null
and
0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd /usr/local/cactid/bin; ./cactid > /dev/null 2>&1

but the cactid poller does not run via crontab.

Is there some thing I have missed

Vijay
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Run the following query on your cacti database:

Code: Select all

delete from poller_output;
This will clear the poller_output table.

Also, ensure that you do not have a crontab defined for that user:

Code: Select all

crontab -l -u cactiuser
[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]
vcs714
Posts: 23
Joined: Thu May 05, 2005 3:53 am

Post by vcs714 »

After I changed the poller I had run the "delete from poller_output;" aginst the cati database but the status is still the same.

My crontab file is as follows

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
*/5 * * * * /usr/local/cactid/bin/cactid > /dev/null 2> /dev/null
*/5 * * * * cactiuser php /var/www/html/cacti/thold/check-thold.php > /dev/null 2>&1

Regarding the crontab defined for cactiuser, I am using the thold module for which there is the following line in crontab

*/5 * * * * cactiuser php /var/www/html/cacti/thold/check-thold.php > /dev/null 2>&1.

the output of the crontab -l -u cactiuser is as follows

no crontab for cactiuser.

Another strange thing is after changing the poller to cactid , and enabling high level of logging , nothing is logged to cacti.log file, but as soon as I change the poller back to cmd.php logging starts.

Vijay
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Try running cactid manually. This is just an exercise to see what is happening. Run it while the logging level is set to Debug.
[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]
vcs714
Posts: 23
Joined: Thu May 05, 2005 3:53 am

Post by vcs714 »

The poller cactid is working when I run it manually. I am getting the following output is the log file.

05/06/2005 05:05:01 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool fetch /var/www/html/cacti/rra/pix1_net_5min_cpu_3445.rrd AVERAGE -s 1115300101 -e 1115310901
05/06/2005 05:05:01 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool fetch /var/www/html/cacti/rra/pix1_net_5min_cpu_3445.rrd AVERAGE -s 1115389802 -e 1115390702
05/06/2005 05:03:35 PM - PHPSVR: Poller[0] DEBUG: PHP Script Server Shutdown request received, exiting
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: MYSQL Free & Close Completed
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: Allocated Variable Memory Freed
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: PHP Script Server Pipes Closed
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: PHP Script Server Shutdown Started
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: Thread Cleanup Complete
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_time (poller_id, start_time, end_time) values (0, NOW(), NOW())
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: SQLCMD: replace into settings (name,value) values ('date',NOW())
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: The Value of Active Threads is 0
05/06/2005 05:03:35 PM - CACTID: Poller[0] Host[675] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (5917,'questions','2005-05-06 17:01:33','U')
05/06/2005 05:03:35 PM - CACTID: Poller[0] Host[675] SCRIPT: /usr/bin/php -q /var/www/html/cacti/scripts/mysql_stats.php status 127.0.0.1 mygraph mygraph123 Questions, output: U
05/06/2005 05:03:35 PM - CACTID: Poller[0] Host[675] WARNING: Result from SCRIPT not valid. Partial Result: Error: MySQL connect...
05/06/2005 05:03:35 PM - CACTID: Poller[0] Host[675] DEBUG: The POPEN returned the following File Descriptor 9
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (5916,'','2005-05-06 17:01:33','U')
05/06/2005 05:03:35 PM - CACTID: Poller[0] Host[675] SCRIPT: /usr/bin/php -q /var/www/html/cacti/scripts/mysql_stats.php handler 127.0.0.1 mygraph mygraph123, output: U
05/06/2005 05:03:35 PM - CACTID: Poller[0] Host[675] WARNING: Result from SCRIPT not valid. Partial Result: Error: MySQL connect...
05/06/2005 05:03:35 PM - CACTID: Poller[0] Host[675] DEBUG: The POPEN returned the following File Descriptor 9
05/06/2005 05:03:35 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (5914,'','2005-05-06 17:01:33','U')
05/06/2005 05:03:35 PM - CACTID: Poller[0] Host[675] SCRIPT: /usr/bin/php -q /var/www/html/cacti/scripts/mysql_stats.php command 127.0.0.1 mygraph mygraph123, output: U
05/06/2005 05:03:35 PM - CACTID: Poller[0] Host[675] WARNING: Result from SCRIPT not valid. Partial Result: Error: MySQL connect...
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[675] DEBUG: The POPEN returned the following File Descriptor 9
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (5915,'connections','2005-05-06 17:01:33','U')
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[675] SCRIPT: /usr/bin/php -q /var/www/html/cacti/scripts/mysql_stats.php status 127.0.0.1 mygraph mygraph123 Connections, output: U
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[675] WARNING: Result from SCRIPT not valid. Partial Result: Error: MySQL connect...
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[675] DEBUG: The POPEN returned the following File Descriptor 9
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (5918,'','2005-05-06 17:01:33','U')
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[675] SCRIPT: /usr/bin/php -q /var/www/html/cacti/scripts/mysql_stats.php thread 127.0.0.1 , output: U
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[675] WARNING: Result from SCRIPT not valid. Partial Result: Error: MySQL connect...
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[675] DEBUG: The POPEN returned the following File Descriptor 9

05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: SQLCMD: update host set status='3',status_event_count='0', status_fail_date='0000-00-00 00:00:00',status_rec_date='0000-00-00 00:00:00',status_last_error='',min_time='0.000000',max_time='0.625850',cur_time='0.000000',avg_time='0.104706',total_polls='51',failed_polls='0',availability='100.0000' where id='675'
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[675] SNMP Result: Host does not require SNMP
05/06/2005 05:03:34 PM - CACTID: Poller[0] MYSQL: Connecting to MySQL database 'cacti' on 'localhost'...
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: In Poller, About to Start Polling of Host
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: The Value of Active Threads is 1
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: Valid Thread to be Created
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: The Value of Active Threads is 0
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[670] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (5843,'traffic_out','2005-05-06 17:01:33','0')
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[670] SNMP: v1: 192.168.124.140, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.6, value: 0
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (5843,'traffic_in','2005-05-06 17:01:33','0')
05/06/2005 05:03:34 PM - CACTID: Poller[0] Host[670] SNMP: v1: 192.168.124.140, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.6, value: 0
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: The Value of Active Threads is 1
05/06/2005 05:03:34 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (5842,'traffic


Vijay
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Do you have the path set correctly in cacti for the cactid binary?
[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]
vcs714
Posts: 23
Joined: Thu May 05, 2005 3:53 am

Post by vcs714 »

I have the following path specified in cactid poller path
/usr/local/cactid/bin/cactid

My binary location on the machine is
[root@cacti log]# cd /usr/local/cactid/bin
[root@cacti bin]# ls -l
total 112
-rwxr-xr-x 1 root root 102575 Apr 22 10:43 cactid
-rw-r--r-- 1 root root 2367 May 6 17:24 cactid.conf
I have also copied cactid.conf to /etc

Vijay
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

As far as I recall, cactid.conf has to be in the same directory as cactid.

But TheWitness can answer that question better than I can.
[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]
vcs714
Posts: 23
Joined: Thu May 05, 2005 3:53 am

Post by vcs714 »

the cactid.conf file is located in /usr/local/cactid/bin/ along with the binary executable , but I have also made copy in /etc

Vijay
vcs714
Posts: 23
Joined: Thu May 05, 2005 3:53 am

Post by vcs714 »

I have switched back to cmd.php poller , I will try with Cactid sometime later.

Thank you all for all your time and effort


Vijay
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

If you look at the script output, it looks as though you are suffering from a mysql connection failed for some reason. If it runs from cmd.php, I am curious since they both use the script server to connect which uses php.
MySQL connect...
Run cactid from the command line and post the full output.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I found more information on your script. It includes a trailing space in the output. Cactid does not like trailing spaces in your output. Please remove the trailing space from your script and it will work under Cactid.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
vcs714
Posts: 23
Joined: Thu May 05, 2005 3:53 am

Post by vcs714 »

I found more information on your script. It includes a trailing space in the output. Cactid does not like trailing spaces in your output. Please remove the trailing space from your script and it will work under Cactid.

TheWitness
What do you mean by "trailing space in output " ? , How can I remove it ?

Regards

Vijay
Post Reply

Who is online

Users browsing this forum: anwaraahmad1 and 0 guests