Trouble getting thold and settings plugins working

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
wej
Posts: 3
Joined: Sun Nov 13, 2011 12:15 am

Trouble getting thold and settings plugins working

Post by wej »

So I have been using Cacti for a long time, and recently have been tasked with a way to get alerts when bandwidth usage moves out of a certain threshold. Lucky for me, I found that Cacti has a plugin that does exactly what I want!

I am having a problem getting it configured. I'm doing this on a brand new, clean install of Cacti in a virtual machine, so I don't mess up my production server. I am having a problem configuring the "settings" plugin that is the prerequisite for Threshold.

These are the steps I have taken so far in attempt to get Cacti configured to send me alerts:
1. Installed a fresh copy of Ubuntu 12.04.2 LTS x86_64 server version including the LAMP stack.
2. Installed cacti 0.8.7i, which is the latest version available for Ubuntu 12.04.
3. Realized that I need 0.8.8a or higher to easily get plugins in Cacti.
4. Found a PPA that has a backport of Cacti 0.8.8a and added it to my repository list: add-apt-repository ppa:micahg/ppa. I tried using the PPA of Paul Gevers but he only has the i386 packages, and his PPA breaks my apt-get update functionality.
5. apt-get install cacti, which upgraded to the latest version 0.8.8a.
6. Refreshed my http://host/cacti/ main page and let it go through the database upgrade to 0.8.8a.
7. Downloaded the settings and thold plugins from the docs.cacti.net wiki.
8. Extracted the tgz files, copied the entire plugin directory for each plugin into the proper directory:
cp -R settings /usr/local/share/cacti/plugins/
cp -R thold /usr/local/share/cacti/plugins
9. Logged back into the administrative interface for Cacti, went to the plugin management section, clicked the Install button for each plugin, settings first, then thold, then clicked enable for settings then thold.
10. Went to the Settings section of the Admin panel, clicked the Mail /DNS tab, filled out the options properly.

Code: Select all

Test Email: myaddress@mydomain.com
Mail Services: PHP Mail() Function
From Email Address: cacti-alerts@mydomain.com
From Name: Cacti Monitoring
Word Wrap: 120
Sendmail Path: Not Found
SMTP Hostname: mail.mydomain.com
SMTP Port: 25
SMTP Username: validuser@mydomain.com
SMTP Password: validuser'spassword
Primary DNS IP Address: 172.16.21.1 (main router running BIND, same as in my /etc/resolv.conf file)
11. Saved settings and tried sending the Send a Test Email link.
12. Dialog pops up that says "Checking Configuration..." but doesn't do anything else. I let it sit for the 500 millisecond DNS timeout without any result. I thought maybe it was 500 seconds and labeled wrong, so I let it set for 10 minutes and still nothing.
13. At this point, I realize that postfix is probably not installed/configured. I created a separate PHP script to test that theory:

Code: Select all

<?php mail("myemail@mydomain.com", "Test Message", "This is a test\n\nCool", "From: cacti-alerts@mydomain.com\nContent-type: text/plain"); ?>
and it was unable to send an email. syslog mentioned that my live mail server had a problem accepting email from www-data@experimental-vm so I figured that it didn't like that the domain wasn't a FQDN.
14. So next I installed postfix, configured as an Internet site using my domain cacti.mydomain.com.
15. I ran my test PHP script again, and this time I received my test message. So I attempted to send the test message from Cacti. Cacti now detects a valid path for sendmail, but no matter which option I choose for the Mail Services, I get the same results.
16. I get nothing past "Checking Configuration..." and nothing in my syslog or mail logs stating that a connection is being attempted for sending a test message.

At this point, I don't know what else to configure. I've tried changing options from localhost to our live mail server and different and such. I can successfully send mail with my own PHP scripts, but I can't get Cacti to send out the test mail. If it can't send out a test, I doubt it will be able to send out real alerts.

Sorry for such a long winded post, but I wanted to give as much detail as possible to hopefully help me figure this out.

Thanks in advance for any suggestions you may have, and if you need me to supply anymore information, please let me know!
-Joey
wej
Posts: 3
Joined: Sun Nov 13, 2011 12:15 am

Re: Trouble getting thold and settings plugins working

Post by wej »

Aha!

I did some poking through the plugin files, specifically the email-test.php script, and I noticed the following code:

Code: Select all

chdir('../../');

include_once("./include/auth.php");
Well, on a fresh install of Cacti on Ubuntu 12.04, it puts the files in /usr/share/cacti/ but the plugins path is a symbolic link to the location where I installed my plugins, /usr/local/share/cacti/plugins. Since that code above is using a relative path, I think it was changing directory into /usr/local/share/cacti, which doesn't have the other files that it needs to include for the test to work. I changed my code to the following and it successfully sent the test message:

Code: Select all

chdir('/usr/share/cacti/site');

include_once("./include/auth.php");
It looks like it's a packaging issue more than anything else. Either the PPA where I got the 0.8.8a backport is not correct, or something else fishy happened. I'm going to try and configure the rest of Cacti to see if it will send alerts and it was just a problem with the email tester, or if there is an inherent problem with paths throughout the plugin.
wej
Posts: 3
Joined: Sun Nov 13, 2011 12:15 am

Re: Trouble getting thold and settings plugins working

Post by wej »

I found the following files needed to have their paths changed in order for the plugin to work properly:

Code: Select all

root@experimental-vm:/usr/local/share/cacti/plugins/thold# grep -R "chdir('../../')" *
cli_thresholds.php:     chdir('../../');
listthold.php:chdir('../../');
thold_add.php:chdir('../../');
thold_graph.php:chdir('../../');
thold.php:chdir('../../');
thold_templates.php:chdir('../../');
Changing each reference to chdir to show my exact path instead of the invalid relative path allows me to view and configure thresholds through the web interface now, and they work as expected.
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Trouble getting thold and settings plugins working

Post by cigamit »

Plugins are meant to reside in the plugins folder directly in the cacti folder. They will not work if a distribution decides to place them in any other place.
testuser11
Posts: 1
Joined: Fri Jun 28, 2013 5:53 am

Re: Trouble getting thold and settings plugins working

Post by testuser11 »

I had the same problem
Realties who knows how to solve it?
ojeysky
Posts: 3
Joined: Thu Nov 14, 2013 3:58 am

Re: Trouble getting thold and settings plugins working

Post by ojeysky »

testuser11 wrote:I had the same problem
Realties who knows how to solve it?
Solution is just move the plugin directory to the cacti main directory(no longer as a link).

Cheers!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests