Monitor multiple servers with 1 nagios agent

Hi Guys,

we are an IT Support provider and wish to monitor our customer sites of 2+ servers but would like to do it all through our nagios installation here, we dont want to use NRPE on each individual server having to open multipole ports making it very insecure.

we would like to have 1 “Server Agent” and then use the NSClient++ on all the other servers these would then report to the “server agent” and the “server agent” would then contact the main nagios server.

hopefully someone knows the plugin that i would require

Regards
Steve

check how to setup a distributed environment…
nagios.sourceforge.net/docs/3_0/distributed.html

Hi thats great but it tells you to install nagios without the web interface and email, how do i do this NSCA isnt very well documented for an idiot like me :slight_smile:

im not great with linux although i am improving doing all the nagios setup for our company

Regards
Steve

the data would still be passed through to the main server which HAS the web console… :slight_smile:
As for NSCA i think there are some docs on the main nagios site.

Hi,

i understand that but it says that the remote system needs nagios installed also but without the web interface and the notifications.

we already have the main server on our site setup with the NSCA Deamon installed but i dont know how to install nagios without the web interface and notifications on the remote server.

Hi me again!!

ok i have managed to get NSCA working on the localhost (main nagios server) i have also installed nagios and nsca on a remote site which works as i sent a manual test message.

one thing i am stuck with though is what need to be added to the config files on both the remote site and the central localhost?

there dont seem to be any decent tutorials online for setting up the basic config files required for it.

Steve

nagios.sourceforge.net/docs/3_0/ … hecks.html

I have already gone through all of this but that doesnt tell you what needs to be put into the onfig files for the passive checks to work. i cant figure out how to get the passive checks from my remote nagios system to my local central nagios server and then display the results in nagios.

try this: NSCA add on - how best to use?

ok thanks that was a brillaint help

i now have the services setup on my remote server and have copied this to my central server, i changed the command on the central server for each server to service_is_stale like sugested in the link you sent me.

still there is nothing reported to my server, the central server doesnt show the passive check symbol next to the service and thinks that the hosts are on the local network, what am i doing wrong?

Steve

ok i have found errors in the logs saying the folowing

Jul 13 15:05:12 localhost nagios: Warning: Attempting to execute the command "/usr/local/nagios/libexec/eventhandlers/submit_check_result MIAMI 'NSClient++ Version-remote' OK '$OUTPUT$|$PERFDATA$'" resulted in a return code of 126.  Make sure the script or binary you are trying to execute actually exists...

how do i fix this issue? i have the submit_check_result file in the correct place and here is a copy of what is in it

#!/bin/sh

# Arguments:
#  $1 = host_name (Short name of host that the service is
#       associated with)
#  $2 = svc_description (Description of the service)
#  $3 = state_string (A string representing the status of
#       the given service - "OK", "WARNING", "CRITICAL"
#       or "UNKNOWN")
#  $4 = plugin_output (A text string that should be used
#       as the plugin output for the service checks)
#
# Convert the state string to the corresponding return code
return_code=-1
	case "$3" in
   	    OK)
       	        return_code=0
           	;;
        WARNING)
   	        return_code=1
       	        ;;
        CRITICAL)
		return_code=2
       	        ;;
        UNKNOWN)
		return_code=-1
		;;

esac
# pipe the service check info into the send_nsca program, which
# in turn transmits the data to the nsca daemon on the central
# monitoring server
/bin/printf "%s\t%s\t%s\t%s\n" "$1" "$2" "$return_code" "$4" | /usr/local/nagios/bin/send_nsca -H **CentralIP** -c /usr/local/nagios/etc/send_nsca.cfg

Ok i have fixed the issues with my remote server but it doesnt seem to be logging the submit check result in the logs now that it is working? is this incorrect?

also the central server is getting this in the logs, i think that it doesnt like having the freshness check in it as the command but i cant tell what is wrong, if i try to run the check manualy it says permission denied even though i set nagios to the owner?

Jul 13 17:02:00 GAL-NAGIOS nagios: Warning: Return code of 126 for check of service 'Memory Usage-remote' on host 'MIAMI' was out of bounds. Make sure the plugin you're trying to run actually exists. 

What is the remote server getting as result from the check it does?

PS: Am on holiday with limited internet access, i hope there will be somebody else answering too, possibly using remote server solutions too :slight_smile:

Hi,

No Problem getting im just glad that at least someone can help!

ok i have taken a look deeper into the logs etc and sent a test send_nsca packet, this worked and went across fine. but when i look in the nagios.log file the only nsca packet received was the test one so it seems like the packets arent getting sent from the remote client to the central one automatically.

i have also checked the nagios.log on the remote agent and this one doesnt show up as any send_nsca checks being run.

i have checked the cfg file to make sure the oscp_command is set to submit_check_result and it is, it is also enabled :S i am getting rather confused now as to why when a service is checked on the remote client the oscp_command isnt being executed.

do i need to add the submit_check_result to the host configuration??

here is my submit_check_result script:

#!/bin/sh

# Arguments:
#  $1 = host_name (Short name of host that the service is
#       associated with)
#  $2 = svc_description (Description of the service)
#  $3 = state_string (A string representing the status of
#       the given service - "OK", "WARNING", "CRITICAL"
#       or "UNKNOWN")
#  $4 = plugin_output (A text string that should be used
#       as the plugin output for the service checks)
#
# Convert the state string to the corresponding return code
return_code=-1
	case "$3" in
   	    OK)
       	        return_code=0
           	;;
        WARNING)
   	        return_code=1
       	        ;;
        CRITICAL)
		return_code=2
       	        ;;
        UNKNOWN)
		return_code=-1
		;;

esac
# pipe the service check info into the send_nsca program, which
# in turn transmits the data to the nsca daemon on the central
# monitoring server
printf "%s\t%s\t%s\t%s\n" "$1" "$2" "$return_code" "$4" | /usr/local/nagios/bin/send_nsca -H 81.105.104.83 -c /usr/local/nagios/etc/send_nsca.cfg

No, the ocsp takes care of that… obsess_over_services=1 and ocsp_command=submit_check_result result in every service check output being parsed by the opcsp command… which means every service check is then sent via the submit_check_result script.

If you run submit:_check_result from command line does it work?
I the command called each time a service check runs?

This may help a bit…
nagios.sourceforge.net/docs/3_0/distributed.html

Hi Cheers,

ok then i have run the command manua;;y and it runs fine but says:

0 data packet(s) sent to host successfully

even if i force a service check and then run the command it says the same, almost as if the service checks arent working correctly but they are saying that they are.

i have already gone through the distribution pages on the nagios site its not much help it explains it a bit but for a n00b like me it is still confusing.

i understand that when a service check is run it is supposed to run the submit_service_result but it either doesnt run it or isnt writing the service check results to a file that the submit_service_results can read.

bump anyone know whats up?