I'm trying to self learn Linux and have a home lab with couple CentOS servers, one running virtualbox.
After playing around felt the need of a tool to monitor my applications and servers and came across Nagios, so new to Linux and to Nagios (great combination).
Monitoring the servers with ping was easy, so decided to move to monitor the service. Started with monitoring some cameras I have - all accessible via http, so used the defined commands without any modification and worked for some, not all.
Checking from the shell I see:
[root@nagios plugins]# ./check_http -I 10.10.10.193
HTTP OK: HTTP/1.0 200 OK - 708 bytes in 0.013 second response time |time=0.012726s;;;0.000000 size=708B;;;0
[root@nagios plugins]# ./check_http -I 10.10.10.192
HTTP OK: HTTP/1.1 200 OK - 2490 bytes in 0.123 second response time |time=0.123171s;;;0.000000 size=2490B;;;0
[root@nagios plugins]# ./check_http -I 10.10.10.191
HTTP OK: HTTP/1.0 200 OK - 710 bytes in 0.014 second response time |time=0.014048s;;;0.000000 size=710B;;;0
[root@nagios plugins]# ./check_http -I 10.10.10.182
HTTP WARNING: HTTP/1.0 401 Authorization Required - 305 bytes in 0.063 second response time |time=0.063081s;;;0.000000 size=305B;;;0
so changed to below and worked:
[root@nagios plugins]# ./check_http -I 10.10.10.182 -a user:password
HTTP OK: HTTP/1.0 200 OK - 710 bytes in 0.014 second response time |time=0.014048s;;;0.000000 size=710B;;;0
I've not made any changes to the commands, so still:
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
and the cfg for the cameras look like (and yes the http command is commented out so will start with ping):
----------------- BOF --------------
#
# Office Camera
#
define host{
use linux-server
host_name office
alias office
address 10.10.10.181
icon_image webcamera.png
statusmap_image search_server3.gd2
}
define service{
use generic-service
host_name office
service_description PING
check_command check_ping!200.0,20%!500.0,60%
#service_description HTTP
#check_command check_http
}
#
# Define an optional hostgroup for Cameras
#
define hostgroup{
hostgroup_name cameras ; The name of the hostgroup
alias ZM Cameras ; Long name of the group
members shopcamera,backporch,backyard,driveway,frontdoor,frontporch,kitchen,leavingroom,office ; Comma separated list of hosts t
}
---------------- EOF -------------
I'm not sure why I need to use the authentication for some of the cameras as all have the same requirements to access their GUI (username and password).
The only thing I can think of is deference from their firmware, causing Nagios to not authenticate without the credentials.
The ones that authenticate without are Foscan and Sercomm, the ones that wont are Lynksys - just for records for future readers.
Question: What do I need to change to add the authentication to the ones requiring it?
I've tried to change the command inside my cameras.cfg to: check_command check_http -a user:pass, but for sure I'm doing it wrong as Nagios wont start
Any directions?
Thanks!