Difference between revisions of "Cacti monitoring"
Line 141: | Line 141: | ||
=== Settings plugin installation === | === Settings plugin installation === | ||
On the top of Nectar plugin the 'Settings' plugin is required to properly sent emails. Please follow to install the plugin | On the top of Nectar plugin the 'Settings' plugin is required to properly sent emails. It provides additional API features like: DNS Lookup API and a Mailer API. Please follow to install the plugin. Nectar plugin link http://docs.cacti.net/plugin:settings | ||
*Download | *Download | ||
wget http://docs.cacti.net/_media/plugin:settings-v0.71-1.tgz -O ~/settings-v0.71-1.tgz | wget http://docs.cacti.net/_media/plugin:settings-v0.71-1.tgz -O ~/settings-v0.71-1.tgz | ||
Line 147: | Line 147: | ||
sudo tar -xvf settings-v0.71-1.tgz -C /usr/local/share/cacti/plugins/ | sudo tar -xvf settings-v0.71-1.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 | 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 | ||
Then go to Settings and you find a new Mail/DNS tab. | |||
[[File:Cacti-settings-plugin.PNG|none|600px|thumb|left|Cacti-settings-plugin]] | |||
== How to configure Cacti == | == How to configure Cacti == |
Revision as of 17:40, 24 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
Default username: admin
Default password: admin
Then you will be forced to change admin password.
Nectar plugin installation
- PIA preparation
The Plugin Architecture (PIA) is a set of code changes to core cacti. The Plugin Architecture for Cacti was designed to be both simple in nature and robust enough to allow freedom to do almost anything in Cacti. - http://docs.cacti.net/manual:087:1_installation.9_pia
!!Cacti ver 0.8.8a has PIA 3.1 built-in however symbolic links are still required by Debian based distros (not sure about other distributions), therefore please proceed as follow:
- 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.
The latest plugins can be downloaded from http://docs.cacti.net/plugins we are going to install Nectar plugin to email graphs on a regular basis.
- Download Nectar plugin to a user home folder
wget http://docs.cacti.net/_media/plugin:nectar-v0.35a.tgz -O ~/nectar-v0.35a.tgz
In order to install the plugin, change to the directory where it was downloaded and extract plugin to the default Cacti's plugins directory: /usr/local/share/cacti/plugins/
sudo tar -xvf nectar-v0.35a.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
Settings plugin installation
On the top of Nectar plugin the 'Settings' plugin is required to properly sent emails. It provides additional API features like: DNS Lookup API and a Mailer API. Please follow to install the plugin. Nectar plugin link http://docs.cacti.net/plugin:settings
- Download
wget http://docs.cacti.net/_media/plugin:settings-v0.71-1.tgz -O ~/settings-v0.71-1.tgz
- Extract
sudo tar -xvf settings-v0.71-1.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
Then go to Settings and you find a new Mail/DNS tab.
How to configure Cacti
- Update Localhost device
Go to Devices > click on Localhost > in SNMP Option section choose SNMP Version 2 from drop down menu > press save. If snmp and snmpd packages are installed you will see SNMP Information at top left corner.
- Add new devices
Go to Devices > press Add (right top corner) > set to as below and leave other settings with defaults > press Create
Description: Ping Google-8.8.8.8 Hostname: 8.8.8.8 Downed Device Detection: Ping Ping Method: ICMP Ping SNMP Version: Not In Use
-Then at Associated Graph Templates section choose from drop down menu: Unix - Ping Latency, then press Add in the same line. This adds graph template to the device
- Add graphs to the device
- Then at the top of screen click link '*Create Graphs for this Host', Host field will be already populated with the host name Google-8.8.8.8
- Tick next to Create: Unix - Ping Latency and press create
- Add Legend Text: Ping Latency, press Create to finish creating a graph for the device
- Add Data Sources to the device
- Press at the Device menu '*Data Source List', host will be populated, tick next to Unix - Ping Host and Choose an action: Enable, then press Go.