Error in Maintenance Schedule

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
djeronimol337
Posts: 1
Joined: Thu Feb 14, 2013 12:31 pm

Error in Maintenance Schedule

Post by djeronimol337 »

Hey Gang

I have setup a maintenance schedule but there is no devices showing up under the device tab.

Here is the error message from the log.

CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1054', SQL:"SELECT h.*, (SELECT schedule FROM plugin_maint_hosts WHERE host = h.id AND schedule = 2) AS associated FROM host as h WHERE type=1 AND schedule=2 LIMIT 0,100"
Vard0
Posts: 13
Joined: Wed Feb 27, 2013 5:31 am

Re: Error in Maintenance Schedule

Post by Vard0 »

Hi.

I am also getting this error but the fact that your post hasn´t had any replies means I´m not holding out too much hope.

My error is

CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1054', SQL:"SELECT h.*, (SELECT schedule FROM plugin_maint_hosts WHERE host = h.id AND schedule = 1) AS associated FROM host as h WHERE h.host_template_id=4 AND type=1 AND schedule=1 LIMIT 0,30"

If anyone has any solution to this it would be very much appreciated.

I´m not a SQL boffin I´m afraid.

Thanks
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Error in Maintenance Schedule

Post by phalek »

Can you take that SQL statement and execute it on the mysql CLI ? It provides some better information. Also check if there's a table named "plugin_maint_hosts" in your Cacti db
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Vard0
Posts: 13
Joined: Wed Feb 27, 2013 5:31 am

Re: Error in Maintenance Schedule

Post by Vard0 »

Thanks for the response Phalek.

Like i said, I'm a complete noob with MYSQL, but I managed to get into the database and check for the table and the columns.

This was the output:

SHOW COLUMNS from plugin_maint_hosts
-> \G
*************************** 1. row ***************************
Field: type
Type: int(6)
Null: NO
Key: PRI
Default: NULL
Extra:
*************************** 2. row ***************************
Field: host
Type: int(12)
Null: NO
Key: PRI
Default: NULL
Extra:
*************************** 3. row ***************************
Field: schedule
Type: int(12)
Null: NO
Key: PRI
Default: NULL
Extra:
3 rows in set (0.00 sec)


I also ran:-

mysql> SELECT schedule FROM plugin_maint_hosts
-> \G
Empty set (0.00 sec)


Does this provide any further insight into the problem?
Last edited by Vard0 on Thu Apr 11, 2013 12:41 pm, edited 1 time in total.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Error in Maintenance Schedule

Post by phalek »

Yep, now from that CLI where you executed the show command, simply execute this statement:

Code: Select all

SELECT h.*, (SELECT schedule FROM plugin_maint_hosts WHERE host = h.id AND schedule = 1) AS associated FROM host as h WHERE h.host_template_id=4 AND type=1 AND schedule=1 LIMIT 0,30
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Vard0
Posts: 13
Joined: Wed Feb 27, 2013 5:31 am

Re: Error in Maintenance Schedule

Post by Vard0 »

Whoa .... that was a fast response. :D

I ran the statement and this was the result:

mysql> SELECT h.*, (SELECT schedule FROM plugin_maint_hosts WHERE host = h.id AND schedule = 1) AS associated FROM host as h WHERE h.host_template_id=4 AND type=1 AND schedule=1 LIMIT 0,30
-> \G
ERROR 1054 (42S22): Unknown column 'type' in 'where clause'
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Error in Maintenance Schedule

Post by phalek »

try this version. It has some enhanced date/time controls as well ...

EDIT: Version removed. New version has been uploaded a few posts below.
Last edited by phalek on Thu Apr 11, 2013 11:34 pm, edited 1 time in total.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Vard0
Posts: 13
Joined: Wed Feb 27, 2013 5:31 am

Re: Error in Maintenance Schedule

Post by Vard0 »

Thanks Phalek.

No dice I´m afraid.

Still getting the same error.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Error in Maintenance Schedule

Post by phalek »

Now, here we go. I think I found the error.
Attachments
maint_v0.4.zip
(27.17 KiB) Downloaded 117 times
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Vard0
Posts: 13
Joined: Wed Feb 27, 2013 5:31 am

Re: Error in Maintenance Schedule

Post by Vard0 »

Thanks again for the responses Phalek.

I'm afraid the hosts still aren't showing up when I try to add a maintenance schedule.

I'm getting a slightly different error now though

CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1054', SQL:"SELECT h.*, (SELECT schedule FROM plugin_maint_hosts WHERE host = h.id AND schedule = 1) AS associated FROM host as h WHERE h.host_template_id=1 AND plugin_maint_hosts.type=1 AND schedule=1 LIMIT 0,30"

I almost forgot ..... runing the q=statemnet from within mysql produced the following error:

SELECT schedule FROM plugin_maint_hosts WHERE host = h.id AND schedule = 1) AS associated FROM host as h WHERE h.host_template_id=1 AND plugin_maint_hosts.type=1 AND schedule=1 LIMIT 0,30
-> \G
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS associated FROM host as h WHERE h.host_template_id=1 AND plugin_maint_hosts' at line 1
Last edited by Vard0 on Fri Apr 12, 2013 8:57 am, edited 1 time in total.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Error in Maintenance Schedule

Post by phalek »

Another try. Missed one line :-)
Attachments
maint_v0.4.zip
(27.5 KiB) Downloaded 108 times
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Vard0
Posts: 13
Joined: Wed Feb 27, 2013 5:31 am

Re: Error in Maintenance Schedule

Post by Vard0 »

Thanks again Phalek.

Sorry for the late response. It has been a hectic Monday.

I tried the new code and for some reason I´m not getting any errors at all in the cacti log.

But I´m still not getting any devices showing up when I try to create a new maintenance schedule?

I cant figure it out. Am I doing something wrong????
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Error in Maintenance Schedule

Post by phalek »

Nothing. It's just that it's not v1.0 yet. At least for this plugin this means it is not yet finished.

try v0.5. It should provide you with a list (thold enabled) hosts. It does NOT list all Cacti hosts, just the ones which have a Thold Threshold set.
Attachments
maint_v0.5.zip
(21.68 KiB) Downloaded 531 times
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Vard0
Posts: 13
Joined: Wed Feb 27, 2013 5:31 am

Re: Error in Maintenance Schedule

Post by Vard0 »

Thanks Phalek.

I've tried this latest vesion and I'm still not getting any devices showing up and neither am I getting any errors or related messages showing up in the cacti log file.

I definitely have 4 devices with thresholds enabled and I do get notifications when the thresholds are breached.

I'm hoping to get maintenance windows to work so that we don't get alerts outside of working hours for some of these devices.
Attachments
ScreenCapture.PNG
ScreenCapture.PNG (2.33 KiB) Viewed 4361 times
Vard0
Posts: 13
Joined: Wed Feb 27, 2013 5:31 am

Re: Error in Maintenance Schedule

Post by Vard0 »

Hi Phalek

Great News!!!

I finally got it working. Devices are now showing up when I add maintenance schedules :D

I noticed that the file permissions of the plugin folder and files were set to root as the owner when I copied them across and installed them. I changed these to apache to match the other plugins that are installed.

I also rebooted the server (not sure if this had any bearing) and then the devices started showing up.

My apologies if these were basic oversights of steps that you would have expected me to be doing by default. I guess my noob status remains intact.

If you'd like me to be of any assistance for further testing of this plugin, please don't hesitate to ask.

Thanks so much again for all your help.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest