Hello together,
I'm using Nagios® Core™ Version 3.2.1.
With nagios I'm monitoring some systems and also some websites.
Now I'm looking for a chance to scan for "strings" on the monitored websites.
E.g: On a website there is the string "Hello World", so I want to proof with nagios, if this string is available.
Does nagios already have an plugin or other function to realize this?
Greetings
dxUser
string check via nagios
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: string check via nagios
See the --string switch to the check_http plugin (part of the official nagios-plugins package).
Re: string check via nagios
I defined the following service:
define service{
host_name hostname
service_description websitesearch
check_command check_http!url-adress!"string"
max_check_attempts 4
normal_check_interval 4
retry_check_interval 3
check_period 24x7
notification_interval 60
notification_period 24x7
notification_options w,c,r
}
if I call from the shell:
./check_http -H url-adress -s "stringnotavailable"
this message is shown:
HTTP CRITICAL: HTTP/1.1 200 OK - string not found - 26654 bytes in 1.030 second response time |time=1.029727s;;;0.000000 size=26654B;;;0
Because the HTTP CRITICAL is OK I don't get an error in the Service Status view, but I should got an error, then the string is not found.
Any ideas?
define service{
host_name hostname
service_description websitesearch
check_command check_http!url-adress!"string"
max_check_attempts 4
normal_check_interval 4
retry_check_interval 3
check_period 24x7
notification_interval 60
notification_period 24x7
notification_options w,c,r
}
if I call from the shell:
./check_http -H url-adress -s "stringnotavailable"
this message is shown:
HTTP CRITICAL: HTTP/1.1 200 OK - string not found - 26654 bytes in 1.030 second response time |time=1.029727s;;;0.000000 size=26654B;;;0
Because the HTTP CRITICAL is OK I don't get an error in the Service Status view, but I should got an error, then the string is not found.
Any ideas?
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: string check via nagios
Are you using the check_http from the official Nagios Plugins package? What version? (That's different output than I get.)
-
- Posts: 30
- Joined: Fri Apr 22, 2011 6:50 pm
Re: string check via nagios
I'm having some trouble getting the string check to work as well. I have no trouble from the command line issuing the following command:
But if I add it to a cfg file I get the following results with these different configs:
This config returns "HTTP CRITICAL - string not found "
This config returns "HTTP OK HTTP/1.1 200 OK", but it doesn't validate the string, I can put anything in there.
This config returns "HTTP CRITICAL - string not found "
I've tried a few more different variations, but these are the major ones. Any insight into why I'm not getting it right would be appreciated. I've tried this on both 3.2.1 and 3.2.3
Code: Select all
check_http -H www.domain.com -t 5 -s "string"
This config returns "HTTP CRITICAL - string not found "
Code: Select all
define service{
use generic-service
host_name www.domain.com
service_description HTTP
check_command check_http!-H www.domain.com -t 5 -s "string"
}
Code: Select all
define service{
use generic-service
host_name www.domain.com
service_description HTTP
check_command check_http!www.domain.com!"string"
}
Code: Select all
define service{
use generic-service
host_name www.domain.com
service_description HTTP
check_command check_http!-u / -t 5 -s "string"
}
Re: string check via nagios
Kerflumpre wrote:I'm having some trouble getting the string check to work as well. I have no trouble from the command line issuing the following command:Code: Select all
check_http -H www.domain.com -t 5 -s "string"
I've tried a few more different variations, but these are the major ones. Any insight into why I'm not getting it right would be appreciated. I've tried this on both 3.2.1 and 3.2.3
Here's an example of how we do regex with check_http:
Here's the command: $USER1$/check_http -H $HOSTNAME$ -u '$ARG1$' -p $ARG2$ -t 60 -l -w 25 -c 30 -R '$ARG3$' -P '$ARG4$'
-u is the uri
-p is the port (usually 80)
-R is the regex statement (like OK or hello world)
and -P is optional, but you can put in your parameters here. Seems to work really well.
-
- Posts: 30
- Joined: Fri Apr 22, 2011 6:50 pm
Re: string check via nagios
I was able to get it working using the following:
I used the following for SSL sites:
Code: Select all
define service{
use generic-service
host_name www.domain.com
service_description HTTP
check_command check_http!-H www.domain.com -s "string"
}
Code: Select all
define service{
use generic-service
host_name www.domain.com
service_description HTTPS
check_command check_http!-H www.domain.com -S -s "string"
}