Step 1: Write a script to monitor service using any scripting languages. In this article, I use perl to monitor port 8888
=================================
root@restmq:/usr/local/nagios/etc/objects# less ~/nagios/checkrestmq.pl
#!/usr/bin/perl -w
my $restmq_result = `netstat -na | grep 8888` ;
#print "$restmq_result" ;
# OK WARNING UNKNOWN CRITICAL
if ($restmq_result)
{
print "OK\n"
}
else
{
print "CRITICAL\n"
}
Step 2 : Add this perl into nagios command.cfg
Default location:
/usr/local/nagios/etc/objects/commands.cfg
define command{
command_name check_restmq
command_line /home/chang/nagios/checkrestmq.pl
}
Step 3: Add this command into service localhost.cfg
#check_restmq
define service{
use local-service ; Name of service template to use
host_name localhost
service_description RestMQ
check_command check_restmq
notifications_enabled 0
}
Step 4: restart nagios
/etc/init.d/nagios stop
/etc/init.d/nagios start
Subscribe to:
Post Comments (Atom)
-
Step 1, New a project rails new demo Step 2, Update Gemfile add paperclip, mysql2 gem, enable JavaScript runtime gem 'mysql2' ...
-
I used 7z to zip this file under Windows, try to unzip it under linux [ang@walker temp]$ gunzip 2011.sdf.zip gunzip: 2011.sdf.zip: unkno...
-
When trying to access transmission from web-browswer i got the message : 403: Forbidden Unauthorized IP Address. Either disable the IP ad...
No comments:
Post a Comment