Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun Jul 23, 2017 7:52 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Nagios plugin to monitor Cacti log
PostPosted: Thu Aug 03, 2006 8:37 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6030
Location: Michigan, USA
Well, I was on a kick to write a shell script monitor a Cacti server, I figure I might as well write a nagios plugin to monitor the Cacti log.

Parameters can be set from command line or by editing the script.

Code:
Cacti log monitoring plugins for Nagios
Copyright (C) 2006 The Cacti Group

Syntax:

  cacti_log_check.sh <Path> <Warn> <Critical> <Interval>

    <Path> - Path to Cacti log file, default:
             /var/www/htdocs/cacti/log/cacti.log
    <Warn> - Size to alert warning in bytes, default: 536870912
    <Critical> - Size to alert critical in bytes, default: 1073741824
    <Interval> - Polling interval in seconds, default: 300


Questions, concerns, comments, let me know! :)


Attachments:
File comment: Nagios Plugin for monitoring Cacti log
cacti_log_check.sh [4.69 KiB]
Downloaded 1868 times

_________________
Tony Roman
Experience is what causes a person to make new mistakes instead of old ones.
There are only 3 way to complete a project: Good, Fast or Cheap, pick two.
With age comes wisdom, what you choose to do with it determines whether or not you are wise.
Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 04, 2006 12:27 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6030
Location: Michigan, USA
Also should note, if you are using Cacti not on the same machine as Nagios, I would suggest using NRPE to use the plugin on the Cacti server.

_________________
Tony Roman
Experience is what causes a person to make new mistakes instead of old ones.
There are only 3 way to complete a project: Good, Fast or Cheap, pick two.
With age comes wisdom, what you choose to do with it determines whether or not you are wise.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 12, 2006 12:43 pm 
Offline
Cacti User

Joined: Wed Sep 28, 2005 1:39 pm
Posts: 495
I'm thinking this goes into services.cfg - so what is the format one should use for the check_command? Whatabout the checkcommands.cfg file?

I've edited the script for my system and can run it correctly from the command line (just running it) but Nagios is showing:


Code:
Check Cacti service   UNKNOWN    09-12-2006 12:37:00    0d 1h 1m 41s    3/3    CACTI UNKNOWN: Log file not found


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 18, 2006 2:30 pm 
Offline
Cacti User

Joined: Wed Sep 28, 2005 1:39 pm
Posts: 495
So, any news on this? I haven't yet been able to get Nagios to work with this script - via Nagios (run manually, again, it reports everything OK). I think its just an issue with my configuration of the service in the config file - so perhaps just an example of your setup?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 18, 2006 5:28 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6030
Location: Michigan, USA
Are you running the plugin on the same server that Cacti is installed on? Does the user that nagios is running as have access to the Cacti log file?

_________________
Tony Roman
Experience is what causes a person to make new mistakes instead of old ones.
There are only 3 way to complete a project: Good, Fast or Cheap, pick two.
With age comes wisdom, what you choose to do with it determines whether or not you are wise.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 19, 2006 8:29 am 
Offline
Cacti User

Joined: Wed Sep 28, 2005 1:39 pm
Posts: 495
It is on the same server and the cacti log file is RW for user and group - the group is "users" and nagios is in that group.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 19, 2006 9:09 am 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6030
Location: Michigan, USA
In your nagios services configuration, surround the path on the service check with single quotes.

_________________
Tony Roman
Experience is what causes a person to make new mistakes instead of old ones.
There are only 3 way to complete a project: Good, Fast or Cheap, pick two.
With age comes wisdom, what you choose to do with it determines whether or not you are wise.


Top
 Profile  
 
 Post subject: setup
PostPosted: Wed Feb 28, 2007 12:49 am 
Offline
Cacti User

Joined: Mon Oct 16, 2006 11:50 pm
Posts: 56
someone asked what to do with the checkcommands.cfg

I added
    define command{
    command_name check-cacti-log
    command_line $USER1$/cacti_log_check.sh
    }

i added the following to the server.cfg file
    # Define a service to check the cacti log
    define service{
    use generic-service ; Name of service template to use
    host_name <server>
    service_description Cacti log
    is_volatile 0
    check_period 24x7
    max_check_attempts 4
    normal_check_interval 5
    retry_check_interval 1
    contact_groups admins
    notification_options w,c,r
    notification_interval 1440
    notification_period daytime
    check_command check-cacti-log
    }

_________________
"The difference between theory and practice, is that in theory, there is no difference between theory and practice."

"The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time" - Murphy's Law


Last edited by Hiney on Wed Feb 28, 2007 5:34 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 9:48 am 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6030
Location: Michigan, USA
Thanks, I don't have a Nagios installation to test on and haven't used it in years.. :)

_________________
Tony Roman
Experience is what causes a person to make new mistakes instead of old ones.
There are only 3 way to complete a project: Good, Fast or Cheap, pick two.
With age comes wisdom, what you choose to do with it determines whether or not you are wise.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 03, 2007 7:05 am 
Offline

Joined: Sun Sep 11, 2005 9:51 am
Posts: 23
Location: Paris, France
Hi,

I made a post some time ago, but this is an update.
I made a patch to threshold plugin so the alert can be passed to Nagios as a passive check.
Feel free to check and download it from my blog :

http://www.lecentre.net/blog/archives/77

If your Nagios install is on a remote host, change the script to send the alarm by scp or ssh.

Hope this can help

_________________
--
Prune
(Dual G5/4go/RAID)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group