Hi to all,
all tips will be appreciated, and apologize for my bad english..
I've succesfully installed Nagios Core 4.1.1, and now I need to monitor a specif text in a specific site.
I found a third party plug-in named check_http_content.
I put it in /usr/lib/nagios/plugins, and if i do:
./check_http_content -U http://google.com -m "google" -t 30
I receive:
CONTENT OK: EXPR FOUND
This is the help plug-in:
Retrieve an http/s URL and looks in its output for a given text.
Returns CRITICAL is not found, OK if found, UNKNOWN otherwise.
--help shows this message
--version shows version information
-U URL to retrieve (http or https)
-m <text> Text to match in the output of the URL
-t Timeout in seconds to wait for the URL to load. If the page fails to load,
$plugin_name will exit with UNKNOWN state (default 60)
(I don't know if I can put the link of the plug-in)
Then I add in
/usr/local/nagios/etc/objects/commands.cfg
this line:
define command{
command_name check_http_content
command_line $USER1$/check_http_content -U $ARG1$ -m $ARG2$ -t $ARG3$
}
Then I add in
/usr/local/nagios/etc/servers
this simple host in:
define host {
use linux-server
host_name google.com
address google.com
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
}
define service{
use generic-service
host_name google.com
service_description monitor http site
check_command check_http_content -U http://google.com -m "google" -t 30
notifications_enabled 0
}
if I try:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
the answer is:
Error: Service check command 'check_http_content -U http://google.com -m "google" -t 30' specified in service 'sem.i' for host 'google.com' not defined anywhere!
What I am missing?
My goal is to monitor my site to make sure everything works and nobody has changed anything.
Thanks to all those who will try to help me, and also to all those who lost time to read my loooong post
Monitor specific http text
Re: Monitor specific http text
Try changing your service definition to this:
then verify configuration:
Did this help?
Code: Select all
define service{
use generic-service
host_name google.com
service_description monitor http site
check_command check_http_content!http://google.com!"google"!30
notifications_enabled 0
}
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Monitor specific http text
Quick and perfect!
This help very much!
Thank you!!
This help very much!
Thank you!!
Re: Monitor specific http text
Is it alright if we lock this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Monitor specific http text
Yes,
thanks again!
thanks again!