plugin schedules never run (crontab/rights issue?)

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
fastbob
Posts: 8
Joined: Mon Dec 10, 2012 7:03 am

plugin schedules never run (crontab/rights issue?)

Post by fastbob »

I installed CactiEZ 0.8.8a and then morphed my database and rrds into it. After some tweaking everything is working fine except 1 thing. when i schedule plugins to run, for example discover or spikekill, they never do. setting up the schedule through the standard web interface tells me everyting is fine of course. to get round it i just added manual entries into /etc/crontab for the discover plugin. you can see this below

30 2 * * * apache /usr/bin/php -q /var/www/html/cacti/plugins/discovery/findhosts.php -f -d > /dev/null 2>&1

this works fine but the question is what is the schedule config through the interface actually supposed to modify? i guess it should add an entry into crontab but it simply doesn't which can easily explain why it never runs... :-? I cannot find any errors related to this in the crontab, syslog or apache logs.

for spikekill or any other plugin, i could add it manually again but this is very tedious going forward and would really like to understand and fix the problem. worked fine on my old system of course :(

for info (may or may not be linked)
1. when i modify other schedules via webmin (login root) they work fine and changing them modifies the (root) crontab no problem.
2. doing crontab -e as cactiuser tells me that
You (cactiuser) are not allowed to use this program (crontab)

i have spent a lot of time already looking at user rights and both cactiuser and apache are part of the root group at the moment but no change.

hope it is clear. this problem is driving me slowly insane :o so any help is appreciated.

fb
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: plugin schedules never run (crontab/rights issue?)

Post by cigamit »

Check for /etc/cron.allow or /etc/cron.deny
if /etc/cron.allow exists, then you need to add the user cactiuser to it (and please remove these users from the root group!)

As for discover not running, most of these types of plugins run off the poller bottom hook. There could be multiple things that could cause it not to happen, but since you imported your old DB, we can try the simple things first.

You first need to see if the poller bottom hook is registered for the plugin. You can do this via a SQL query

select * from plugin_hooks where name = 'discovery' and hook = 'poller_bottom';

Or, the easy way is just click the uninstall and then install button for it in Plugin management, you will retain your settings, but probably not your scan tables. This will re-install the hooks for those plugins.
fastbob
Posts: 8
Joined: Mon Dec 10, 2012 7:03 am

Re: plugin schedules never run (crontab/rights issue?)

Post by fastbob »

thanks for the response.

the /etc/cron.allow and /etc/cron.deny didn't exist so i created cron.allow and added root, cactiuser and apache. changes nothing but seems like this is not necessary since you kindly expalined that we would not expect to see any cron mods. i will delete cron.allow.

you can find the poller_bottom output below.

id name hook file function status
480 discovery poller_bottom setup.php discovery_poller_bottom 1
351 thold poller_bottom includes/polling.php thold_poller_bottom 1
81 fix64bit poller_bottom setup.php fix64bit_poller_bottom 1
433 syslog poller_bottom setup.php syslog_poller_bottom 1
470 flowview poller_bottom setup.php flowview_poller_bottom 1
537 spikekill poller_bottom setup.php spikekill_poller_bottom 1

concerning the poller question on the other post here is the line from /etc/crontab
*/5 * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

for info, i upped the poller logging to debug and noticed
06/12/2013 12:12:17 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /var/www/html/cacti/plugins/spikekill/poller_spikekill.php]
06/12/2013 12:12:17 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "SELECT graph_template_id FROM plugin_spikekill_templates"
06/12/2013 12:17:40 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /var/www/html/cacti/plugins/spikekill/poller_spikekill.php]
06/12/2013 12:17:40 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "SELECT graph_template_id FROM plugin_spikekill_templates"
06/12/2013 12:22:02 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /var/www/html/cacti/plugins/spikekill/poller_spikekill.php]
06/12/2013 12:22:02 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "SELECT graph_template_id FROM plugin_spikekill_templates"

spikekill should have ran at 12:15PM but i see no indication of that being the case
nothing at all for discover

also this may not be linked (and doesnn't seem to cause any issues with ping) but i also noticed in the logs
SPINE: Poller[0] WARNING: Spine NOT running asroot. This is required if using ICMP. Please run "chmod +s;chown root:root spine" to resolve.#012
not wanting to break anything i haven't chown'd spine yet but i can if required. please note that cactiuser is launching the poller (above) and i remember specifically changing spine to run as cactiuser as well because it was not working.
-rwxr-xr-x. 1 cactiuser users 108263 Apr 16 2012 spine
-rwxr-xr-x 1 cactiuser users 2788 Mar 5 15:54 spine.conf



lastly, when i update the discovery settings it does appear to update correctly
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_header'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_header'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_subnet'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_subnet'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_dns'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_dns'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_protocol'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_protocol'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_readstrings'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_readstrings'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_collection_timing'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_collection_timing'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_base_time'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_base_time'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_query_rerun'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_query_rerun'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_interface_up_only'"
06/12/2013 11:59:53 AM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_interface_up_only'"
06/12/2013 12:00:09 PM - CMDPHP: Poller[0] DEVEL: SQL Exec: "replace into settings (name,value) values ('discovery_subnet', '10.255.224.0/20')"
06/12/2013 12:00:09 PM - CMDPHP: Poller[0] DEVEL: SQL Exec: "replace into settings (name,value) values ('discovery_dns', '')"
06/12/2013 12:00:09 PM - CMDPHP: Poller[0] DEVEL: SQL Exec: "replace into settings (name,value) values ('discovery_protocol', '2')"
06/12/2013 12:00:09 PM - CMDPHP: Poller[0] DEVEL: SQL Exec: "replace into settings (name,value) values ('discovery_readstrings', 'xxxxxx:yyyyyy')"
06/12/2013 12:00:09 PM - CMDPHP: Poller[0] DEVEL: SQL Exec: "replace into settings (name,value) values ('discovery_collection_timing', '1440')"
06/12/2013 12:00:09 PM - CMDPHP: Poller[0] DEVEL: SQL Exec: "replace into settings (name,value) values ('discovery_base_time', '12:05PM')"
06/12/2013 12:00:09 PM - CMDPHP: Poller[0] DEVEL: SQL Exec: "replace into settings (name,value) values ('discovery_query_rerun', '')"
06/12/2013 12:00:09 PM - CMDPHP: Poller[0] DEVEL: SQL Exec: "replace into settings (name,value) values ('discovery_interface_up_only', '')"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_header'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_header'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_subnet'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_subnet'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_dns'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_dns'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_protocol'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_protocol'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_readstrings'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_readstrings'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_collection_timing'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_collection_timing'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_base_time'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_base_time'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_query_rerun'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_query_rerun'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Assoc: "select value from `cacti`.`settings` where name='discovery_interface_up_only'"
06/12/2013 12:00:11 PM - CMDPHP: Poller[0] DEVEL: SQL Cell: "select value from settings where name='discovery_interface_up_only'"


fb
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: plugin schedules never run (crontab/rights issue?)

Post by cigamit »

fastbob wrote: concerning the poller question on the other post here is the line from /etc/crontab
*/5 * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
You say in the 1st post that you installed CactiEZ (maybe you just meant Cacti itself?), yet that isn't where CactiEZ places its cacti install (no /cacti/ folder). With CactiEZ, the biggest point is that all this is already setup for you, no need to change anything (poller as root for ICMP, etc...), just move your rrds and mysql database, scripts, templates, etc... It uses custom rpms also, so moving the cacti folder would have some mess with them also.
fastbob
Posts: 8
Joined: Mon Dec 10, 2012 7:03 am

Re: plugin schedules never run (crontab/rights issue?)

Post by fastbob »

No i'm sure it was cactiEZ on 64bit CentOS. I modified the path because I have lots of other things that point back to my original install which was ..../html/cacti. it just seemed easier to change the path than change everything else. if you are telling me that this would prevent certain things working correctly then that is a shame. i admit i can't see how though because it is only a path. as i said before everything works ok, only scheduling plugins does not. it will be a lot of tweaking to change this back to/html and frankly i'm far from convinced it will sort the problem. is there anything else i could look at?

thank you
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: plugin schedules never run (crontab/rights issue?)

Post by cigamit »

What would stop working is any future updates to cacti or any of the plugins. Technically, downloading an updated RPM (when I push out fixes) would probably mess things up a bit since the paths are hardcoded in there. You could always just not install any new updates, but what fun is that.

I doubt the path is your issue, that was just something that popped out at me, since I know that isn't the default path. It seems that spikekill is attempting to run every 5 minutes, which probably shouldn't be happening either.
What are the permissions on /var/www/html/cacti/plugins/spikekill/poller_spikekill.php ?
fastbob
Posts: 8
Joined: Mon Dec 10, 2012 7:03 am

Re: plugin schedules never run (crontab/rights issue?)

Post by fastbob »

hard coded paths in updates sounds a little, well, medieval. i'm sure i'm not the only one who had to tweak some things when he/she migrated from a home made install to the excellent cactiEZ.

anyway, this is where i will now look silly. i was having a look through some of the db tables last night and in 'setings' i noticed the following
spikekill_lastrun 1371148612
stats_spikekill Time:327.7500 Graphs:943 Kills:46

that translates to last night - 13 june 2013 20:36:52 GMT+2

so great. i guess it seems to be working. what is really unfortunate is that there is nothing in any log to tell you that it ran and when the base time is set to 1420 hrs (as it was), running at 2031hrs doesn't make any sense either, but anyway.

i still have a problem with discovery, i know that is not running at all via the poller hook but i put it directly into cron and can live with that.

so, thank you. keep up the good work.
fb
ps - just for your info, to use spikekill via a browser you need to disable the jquery skin since it prevents the menu from appearing (at least on my machine anyway)
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: plugin schedules never run (crontab/rights issue?)

Post by cigamit »

Ya, spikekill is doing something nonstandard (read as "bad") and loading its div and js via the tab hook. I looked into fixing that, but I think it will require a new hook so that it has a better place to do what it wants.

As far as hardcoded paths, that is exactly how most rpms work. Even the debian packages hard code to /usr/share/cacti/site/ we just use a different location. Ideally, if you want to add stuff to your CactiEZ, you should leave everything in /var/www/html alone, and instead modify the apache config to add directories for everything else. For instance, I have mantis installed on mine /var/www/mantis/ and modified apache to point to it. CactiEZ was made to be more of an appliance like install for those people who don't know their way around linux.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests