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

All times are UTC - 5 hours




Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Cacti Server Monitoring script for Unix
PostPosted: Wed Aug 02, 2006 6:28 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6029
Location: Michigan, USA
Attached is a monitoring script for monitoring the cacti server.

What the script monitors:
  • httpd is running or not running
  • mysql is running
  • if mysql is a replication slave, that it is currently up to date
  • that the Cacti poller is running
  • that the Cacti log is not to large
  • that the mounted volumes are not filling up


Just add this to your crontab for either root or the user that runs the poller every 5 minutes or the same interval you run the poller.

If you find any issues, please let me know either here or via pm/email.


Attachments:
File comment: Cacti Monitoring Script

Version 1.0.2 - Added a feature to error out when unable to locate a suitable mailing program.

cacti_monitor.sh [10.2 KiB]
Downloaded 2663 times
File comment: Cacti Monitoring Script

Version 1.0.1 - Fixed a bug where log rotation would cause a false positive of poller failure.

cacti_monitor.sh [10.16 KiB]
Downloaded 828 times
File comment: Cacti Monitoring Script

Version 1.0.0 - Initial release

cacti_monitor.sh [9.76 KiB]
Downloaded 995 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.


Last edited by rony on Wed Nov 15, 2006 3:59 pm, edited 4 times in total.
Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 4:43 pm 
Offline
Cacti User
User avatar

Joined: Tue May 24, 2005 6:23 pm
Posts: 110
Hi sounds nice but when i edit the path en run i get the following error any ideas?

linux:/bin # ./cacti_monitor.sh
: bad interpreter: No such file or directory


Thanks in advance,

Marcel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 4:54 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6029
Location: Michigan, USA
Edit the first line of the script and alter it to use bash.

To find the full path to bash use the `which bash` command.

It's designed to work with bash, so if you don't have bash installed, I suggest you do.

_________________
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: Sat Sep 02, 2006 2:08 am 
Offline
Cacti User
User avatar

Joined: Tue May 24, 2005 6:23 pm
Posts: 110
Thanks for your reply.

these are the first lines in the monitor file:

#!/bin/bash
###############################################################################
# +-------------------------------------------------------------------------+
# | Copyright (C) 2006 The Cacti Group

when i perform a search for bash i get these results:
linux:~ # find / -name 'bash'
/bin/bash
/usr/share/doc/packages/bash
find: . changed during execution of find


Can you tell me what to change? do i need to uncomment the first line?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 02, 2006 8:49 am 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6029
Location: Michigan, USA
Nope, you probably need to change the permissions on the script to rwx for that user you are going to run it as.

Use the following to change the permissions:
Code:
chmod 755 cacti_monitor.sh

_________________
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: Good job!
PostPosted: Wed Oct 18, 2006 12:39 pm 
Offline

Joined: Thu May 12, 2005 1:32 am
Posts: 21
Location: Romania
Make some screenshots.
We like screenshots.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 18, 2006 12:44 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6029
Location: Michigan, USA
Screenshots of what? The outputted alert email?

There is no graphical parts to this, it's a shell script that does some basic system checks.

_________________
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: Wed Oct 18, 2006 12:48 pm 
Offline

Joined: Thu May 12, 2005 1:32 am
Posts: 21
Location: Romania
rony wrote:
Screenshots of what? The outputted alert email?

There is no graphical parts to this, it's a shell script that does some basic system checks.


YES! ! i test the script and i see. Is a nice script.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 5:24 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6029
Location: Michigan, USA
Version 1.01 posted in the first post.

Minor update to fix false positives when the cacti.log file is empty after being rotated.

_________________
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: Thu Oct 26, 2006 1:10 pm 
Offline
Cacti User

Joined: Tue May 03, 2005 8:54 am
Posts: 292
Location: GA
Nice script........looks awesome. I was testing on my system and got an error when shutting down httpd...I get an error on line 313 where mail is listed..........is that piece of code that actually mails out?? what is required there to have the mail portion work?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 26, 2006 1:38 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6029
Location: Michigan, USA
What OS and Version of OS are you running?

Do the following commands and report the results:

Code:
uname -a

Code:
which mail

Code:
which mailx

_________________
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: Thu Oct 26, 2006 1:42 pm 
Offline
Cacti User

Joined: Tue May 03, 2005 8:54 am
Posts: 292
Location: GA
netstat:/home/cacti# uname -a
Linux netstat 2.6.8-2-386 #1 Thu May 19 17:40:50 JST 2005 i686 GNU/Linux
netstat:/home/cacti# which mail
netstat:/home/cacti# which mailx
netstat:/home/cacti#


Running Debian ..........

Thanks Tony


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 26, 2006 1:47 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6029
Location: Michigan, USA
Not sure what package has it but you need to install the mail or mailx utility.

_________________
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: Thu Oct 26, 2006 1:52 pm 
Offline
Cacti User

Joined: Tue May 03, 2005 8:54 am
Posts: 292
Location: GA
Thanks Tony...just needed apt-get install mailx

CYA


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 26, 2006 1:59 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6029
Location: Michigan, USA
I'm currently modifying to script to tell you it can't find a mailing program... Maybe in the future I will make it use sendmail... :lol:

_________________
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  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 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