Cacti monitoring
I wanted to monitor Internet access within UK and continental routes to US. My setup varies but relays on SOHO routers connected over 3G mobile network, ADSL or radio point-to-point link. None of my devices are SNMP enabled therefore having a little options I would like to use continuous ping to certain POP and analysing a ping latency it should provide me with reliability of the link.
In course to accomplish this I have chosen Cacti http://www.cacti.net/index.php to draw nice graphs and coupled with Nectar plugin http://docs.cacti.net/plugin:nectar to email me on a regular basis.
My linux box is Ubuntu 13.04
Install email system and dependency packages
Cacti relays on a few packages and even though these will be installed as required dependency I prefer install them before cacti it self
sudo apt-get install apache2 snmp snmpd
Then installing email system to allow send emails MTA
sudo apt-get install exim4
Run the following command to configure exim4
sudo dpkg-reconfigure exim4-config
Set the following (Google smtp services: smtp.gmail.com:465 or smtp.gmail.com:587)
General type of mail configuration: mail sent by smarthost; no local mail System mail name: (default) IP-addresses to listen on for incoming SMTP connections: 127.0.0.1 Other destinations for which mail is accepted: (default) Visible domain name for local users: hostname.pio2pio.vot.pl IP address or host name of the outgoing smarthost: smtp.gmail.com::587 Keep number of DNS-queries minimal (Dial-on-Demand)? No Split configuration into small files? No
The exim4 SMTP server is now set to route emails thru Gmail. Now all we need to do is to tell exim4 the username and password we are going to use. To accomplish this create a text file called /etc/exim4/passwd.client. Update the file to read:
# password file used when the local exim is authenticating to a remote # host as a client. # # see exim4_passwd_client(5) for more documentation # # Example: ### target.mail.server.example:login:password gmail-smtp.l.google.com:you@gmail.com:password *.google.com:you@gmail.com:password smtp.gmail.com:you@gmail.com:password
Replace you@gmail.com:password with your login information.
Reload the exim4 server:
sudo /etc/init.d/exim4 reload
To test the configuration launch a terminal and type:
echo 'ok' | mail -s 'Gmail SMTP Relay Test' youremail@domain.com
To preview exim4 logs
cat /var/log/exim4/mainlog tail -1000f /var/log/exim4/mainlog
To check connection to smtp.gmail.com:587, you should receive these 3 lines:
telnet smtp.gmail.com 587 Trying 173.194.67.108... Connected to gmail-smtp-msa.l.google.com. Escape character is '^]'. 220 mx.google.com ESMTP w4sm36472599wia.9 - gsmtp
Changing ISP is showing that email system works. It must have been blocked by Sky/O2 broadband.
Install Cacti
Please issue the command below to install cacti, it will download ~127Mb
sudo apt-get install cacti
You will be prompt for MySql "root" user password Please accept information about changed path Select 'apache2' as webserver, installation script will start configuring all necessary
You will be prompted:
Configure database for cacti with dbconfig-common? Yes Please provide the password for the administrative account with which this package should create its MySQL database and user. Password of the database's administrative user: ****
Please provide a password for cacti to register with the database server. If left blank, a random password will be generated. MySQL application password for cacti: ****
Now your Cacti is configured. Please go to http://localhost/cacti/ to finish configuration.
Select 'New Install', and details should be as follow, press next
The following information has been determined from Cacti's configuration file. If it is not correct, please edit 'include/config.php' before continuing. Database User: cacti Database Hostname: localhost Database: cacti Server Operating System Type: unix
Check for dependency programs, press next
Default username: admin Default password: admin
Then you will be forced to change admin password.
Nectar plugin installation
!!! Need brush up
Install plugins:
Navigate to Cacti install path: /usr/share/cacti/site/
piotr@ubuntu:/usr/share/cacti/site/plugins$ cat README.Plugins If you read this and care about keeping your system maintainable, please change the layout of the plugins structure of cacti. Due to the way a lot of plug-ins are written (details in bug #681558) in combination with Debian policy, I can not fix this in the package.
- Create a directory /usr/local/share/cacti/plugins:
mkdir /usr/local/share/cacti/plugins
- Move all content of /usr/share/cacti/site/plugins to
/usr/local/share/cacti/plugins mv /usr/share/cacti/site/plugins/* /usr/local/share/cacti/plugins/
- Remove the empty /usr/share/cacti/site/plugins directory
rmdir /usr/share/cacti/site/plugins
- Create the following symlinks:
ln -s /usr/local/share/cacti/plugins /usr/share/cacti/site/plugins ln -s /usr/share/cacti/site/include /usr/local/share/cacti/include ln -s /usr/share/cacti/site/lib /usr/local/share/cacti/lib
-- Paul Gevers <elbrus@debian.org> Wed, 01 Aug 2012 22:32:32 +0200
Follow steps below to make correct plugin structure ! apparently ver 0.8.8a has PIA build in
How to install plugins in ver 0.8.8a
The latest plugins can be downloaded from http://docs.cacti.net/plugins
In order to install the plugin, change to the directory where it was downloaded. The default directory for cacti plugins is /usr/local/share/cacti/plugins/
Execute the following command:
sudo tar -xvf <insert-plugin-file-name-here>.tgz -C /usr/local/share/cacti/plugins/
The newly installed plugin should now be showing up in the cacti menu Console --> Plugin Management