Posts Tagged ‘snmp’

Remote Server Monitoring using phpSysInfo XML – SysInfoRM Concept

By Mark Davidson on February 10th, 2010

Recently I have been checking out a number of different solutions for monitoring remote servers and alerting or warning depending on certain metrics. For this I have looked at a number of different solutions including Server Density, Cloudkick, Cacti, Nagios and some others. Each of these has various advantages and disadvantages.Which I will give a very brief run down of below.

Server Density
The Good

  • iPhone Application
  • Push Notifications for iPhone Application
  • Easy to Deploy Agent

The Bad

  • Costs Per Server for Full Version
  • Limited Services it can monitor.

Cloudkick
The Good

  • Incredibly easy to setup monitoring of multiple hosts if your with one of the supported providers. I was using vps.net when I tried them out and it worked very well.
  • Very good metric monitoring.
  • Very nice interface.

The Bad

  • Limited to monitoring of supported providers.
  • Need to hand over API key for it to work.
  • In my opinion incredibly expensive.

Cacti
The Good

  • SNMP Integration
  • Great Interface
  • Very good metric support
  • Cost – Free

The Bad

  • Not Really a Remote Monitoring Solution as does not provide alerting. I know that it was never designed to be but definitely has potential to be expanded on.

Nagios
The Good

  • Highly Configurable
  • Support for Custom Monitoring Scripts
  • Great Alerting Configuration
  • Cost – Free

The Bad

  • Complicated to configure even for basic monitoring
  • Runs on single host meaning all network monitoring lost of host goes down.

Since none of the above solutions exactly suite my needs I have decided to produce my own monitoring solution. To do this I am going to take advantage of the fact that phpSysInfo provides the majority of the statistics that I wish to monitor and I already run it on most of my servers. phpSysInfo can supply its data in XML form this is that data I can use for monitoring.
So I plan to develop my own solution in Python to read the XML data from multiple remote hosts and then take a defined action if a rule is matched. Since I needed a name for this project I decided to call it SysInfoRM or System Information Remote Monitor.

Here is the basic feature plans for now

Initial Release Features for SysInfoRM

  • Parsing of 1 – n XML from either phpSysInfo or pySysInfo (Since it can supply data in same XML format and should be good for remote monitoring of non web hosts).
  • Ability to define monitoring rules and actions for when they are matched.
  • Easy / Understandable Configuration.
  • Heart Beat Monitoring of Script Itself. Basically run the script in two locations if the Primary fails the other should take over the monitoring.
  • Can be run as a Daemon or as interactive script.

Future Planned Features for SysInfoRM

  • Curses interface for viewing and configuration.
  • Web interface for viewing and configuration.

Python Libraries

  • urllib2
  • smtplib

I am hoping to have something working in the next couple of days just need to get my Python skills up to scratch. I am going to attempt to incorporate all the best bits from the other currently available monitoring tools and as few of the bad bits as possible. I should also mention I was inspired by and am drawing on another good monitoring script from the tomubuntu blog. Tom has done a really good job with this script and I suggest people check it out its a good simple script that can monitor Load Average, Memory and other stats; it can then alert using sSMTP.

That is all for now please check back soon I’ll be providing updates on the progress of SysInfoRM as I develop it and will post the SVN or Git Repos once I get one set up.

Installing & Configuring Cacti Under Gentoo

By Mark Davidson on February 9th, 2010

Cacti is a front end to RRDTool, the purpose of which to provide an effective network graphing solution for monitoring devices within a Network. It can be used with SNMP to monitor various statistics about a device including but not limited to Load Average, Bandwidth, Disk Usage and Processes.

The following are the steps to install Cacti under Gentoo

  1. Modify your /etc/make.conf and modify your use flags adding “mysql xml sockets vhosts”, which should give you a line reading something similar to
    USE="symlink mmx sse sse2 bash-completion vhosts xml sockets snmp"
  2. Now emerge Apache, PHP, Cacti and webapp-config. You may already have some of these installed but it is important to rebuild them with the new use flags.
    sudo emerge apache php cacti webapp-config

    Once completed if everything has installed correctly procede to the next step if you get an error saying “Could not read settings from webapp-config” I found the easiest way to solve this was to unmerege webapp-config and reinstalled it.

  3. Update your /etc/ config files if required
    sudo etc-update
  4. Create a vhost if you don’t already have one and then run the following. Then install cacti to the vhost using webapp-config. Remember to change the -h option to reflect the name of your vhost and that you may need to set a different cacti version number if cacti has been updated since I posted this article.
    sudo webapp-config -I -h yourdomain.com -d cacti cacti 0.8.7e-r1
  5. Its now time to setup the database that Cacti will be using.
    mysqladmin -p --user=root create cacti
    mysql -p --user=root cacti < /var/www/yourdomain.com/htdocs/cacti/cacti.sql # Remember to change this to reflect the path to your cacti install.
    mysql -p --user=root mysql
    GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY  'somepassword'; # Just a note I like to use apg to generate my passwords.
    flush privileges;
  6. Now that the database has been created your need to set the database settings in cacti. Modify /var/www/yourdomain.com/htdocs/cacti/include/config.php if your installing with a local database and only changed the password above that’s all you need to update in the config file.
  7. The last step of the install is to add a cron entry to your tab to get Cacti to update. Add the following entry to your crontab updating the path as needed.
    */5 * * * * apache /usr/bin/php  /var/www/yourdomain.com/htdocs/cacti/poller.php > /dev/null  2>&1
  8. That should be it for Cacti base install visit http://yourdomain.com/cacti and you should be meet with a login screen use admin as the username and admin as the password. You should now see the Cacti inteface.
  9. Click on the Graphs tab accross the top and after a while once data starts coming in your should see the graphs start to be drawn. At the moment these graphs will display localhost data.

Thats all for now in the next post I will cover setting up net-snmpd on a host and then configuring Cacti to monitor it.