Difference between revisions of "Cacti monitoring"

From Ever changing code
Jump to navigation Jump to search
Line 140: Line 140:


  sudo tar -xvf <insert-plugin-file-name-here>.tgz -C /usr/local/share/cacti/plugins/
  sudo tar -xvf <insert-plugin-file-name-here>.tgz -C /usr/local/share/cacti/plugins/
got
The newly installed plugin should now be showing up in the cacti menu Console --> Plugin Management. To activate go to Console/Utilities/User Management and enable the 'Plugin Management' realm for your admin user, then go to Console/Configuration/Plugin Management and click the 'Enable Plugin' icon
The newly installed plugin should now be showing up in the cacti menu Console --> Plugin Management. To activate go to Console/Utilities/User Management and enable the 'Plugin Management' realm for your admin user, then go to Console/Configuration/Plugin Management and click the 'Enable Plugin' icon

Revision as of 16:46, 23 July 2013

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, if every path is green, then press next

Cacti resource paths

Default username: admin
Default password: admin

Then you will be forced to change admin password.

Nectar plugin installation

Install plugins:

Navigate to Cacti install path: /usr/share/cacti/site/ and preview README.Plugins file

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

Issue all commands from above.

!! Cacti ver 0.8.8a has PIA build in however symbolic links are still required in Ubuntu box (not sure about other distributions)

How to install plugins in ver 0.8.8a

The latest plugins can be downloaded from http://docs.cacti.net/plugins

wget http://docs.cacti.net/_media/plugin:nectar-v0.35a.tgz -O ~/nectar-v0.35a.tgz
sudo mkdir /usr/local/share/cacti/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. To activate go to Console/Utilities/User Management and enable the 'Plugin Management' realm for your admin user, then go to Console/Configuration/Plugin Management and click the 'Enable Plugin' icon