Cacti Availability Reporting

January 29, 2008 at 9:58 pm 4 comments

When I showed off the Cacti administrative interface to the manager of our NOC, I knew I was in trouble.  He astutely spotted the “Availability” column on the Devices screen.  He quickly asked me if he could get Availability reports out of it.  I had used Cacti enough to know that there wasn’t a way to get reports like that, much less on a Monthly basis.

I decided to dig a bit to see what I could turn up.  The availability information along with the two columns that are used to determine availability are right there in the database.  Unfortunately, Cacti doesn’t reset the availability stats, so once a device misses a single poll they are forever doomed to have something less than 100.00% availability.

My management is interested in availability for two things:

1. The department manager is interested in a Monthly Availability report to have something concrete to show the WAN vendor.

2. The NOC manager is interested in a Daily Availability report.  He wants to see a list of sites that have less than 99.95% availability.  He wants to see this in an effort to be able to spot sites that might have minor problems that get missed throughout the day.

Two members of management wanting reports spanning different time spans is problematic.  The availability data is stored in a table in the Cacti database.  My initial thought was that the daily report could be created by simply clearing the appropriate rows in the database once each day, then looking at them the next day just before clearing them.  Doing this, though, wipes out the data for the month, which is important to a higher level of management.

After giving this situation some thought, I came up with what I think is a practical way to handle it.   Each day just after midnight, I’ll read the data from the current day and subtract it from the previous day’s data (that I’ve saved off elsewhere).  It is an exercise in loops and pretty simple logic, really.  That will give me the previous days number of polls and the failed number of polls.  Just perform the calculation to get the availability from my new numbers, then save off the data that I read (the raw numbers) to a file to read in the following day just after midnight.  Finally, on the 1st of the month after doing this, generate the report for the entire month (based on the raw data in the Cacti table), then just clear the fields in the database and delete my history file.

Here’s an example emailed report:

Sites with some bad availability

For anyone else interested, I’ve posted the PHP program I wrote to do this on the Cacti forums, along with a brief description of how to get it up and running on your system:

My HOWTO on the Cacti Forums

Advertisements

Entry filed under: Networking.

Tracking your finances Is MoneyWell money well spent?

4 Comments Add your own

  • 1. Christer Trasti  |  February 26, 2013 at 2:16 am

    Looks like a great script. I am having some trouble though. I’m relatively new to the world of Unix, and just set up CactiEZ.

    “In your cron, set it to run one minute after midnight:”
    That sentence in particular has me a bit stumped.. :-/

    Any help would be -greatly- appreciated!

    Reply
    • 2. ptaylor  |  February 26, 2013 at 10:44 pm

      This is potentially a BIG topic. “cron” is the unix task scheduler. Usually, you can edit this with the command “crontab -e” from the command line, which will get you in an editor (probably vi or vim) to allow you to edit your cron file. You should google cron to learn more about it. You’ll probably be using it a lot in Unix, if you go beyond CactiEZ.

      Reply
  • 3. Christer Trasti  |  February 28, 2013 at 6:40 am

    Thanks for your reply. After some googling I found it in /etc/cron. Added the “scheduled task” there, and it seems to be working! 🙂

    Now the only thing I want/need is the report to display availability like “100.00” instead of “100.00000”. Any tips here would be greatly appreciated.

    This is a great addition to Cacti! Absolutely loving it!

    Reply
    • 4. ptaylor  |  March 1, 2013 at 11:33 pm

      It should be easy to modify your copy.. Search for this text: 100,5,’.’ Change the 5 to 2. This shows up about 4 times in the script. You should change all of them, if you want your daily/weekly/monthly reports to be consistent.

      Reply

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

January 2008
S M T W T F S
« Dec   Feb »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Most Recent Posts


%d bloggers like this: