I want to create a nagios check that test if a certain file is available on a public website and if that file contains a certain line of text.
From the command line I have been executing:
./check_http -H 192.168.1.2 -u http://192.168.1.2/index.html -t 5 -s "Company Name"
Which passes OK and fails if I delete the file or change the text it is looking for.
Now I want to incorporate this into my nagios config files.
I create a Host which has the address of the ip address above and create a service as follows.
check_command check_http!-u /index.html -t 5 -s "Company Name"
But if I change the filename it is checking or the text it is checking it still passes even though I know they don't exist on the website.
What am I doing wrong I think I must be testing a different file or something for it to always pass.
Best Answer
When you are executing the command manually, you are calling /usr/lib/nagios/plugins/check_http correct?
When you are calling check_http from the nagios config, it looks at /etc/nagios-plugins/config/http.cfg to determine the check_http command arguments.
What you need to do is create a custom check like:
}
Then in your service configuration your check_command should be something like: