NAGIOS | poor mans report scripting

You wanna report some stuff to nagios the easy way? Try this. Nagios server side: Install netcat. Run a eternal loop script: # while true; do nc -l -p <THE_PORT_YOU_WANNA_LISTEN_TO> >> /var/nagios/rw/nagios.cmd; done& Client side: Install netcat. Drop your info to the NAGIOS server with something like: # echo -e “[$(date +%s)] PROCESS_SERVICE_CHECK_RESULT;<NAGIOSCONFIG_SERVER_NAME>;<NAGIOSCONFIG_SERVICE_NAME>;<RESULT_0_or_1_or_2>;<YOUR_IMPORTANT_MESSAGE>” | nc […]

Scripting SMTP with netcat

(echo EHLO $USER@$HOSTNAME sleep 1 echo MAIL FROM: $USER@$HOSTNAME sleep 1 echo RCPT TO: $EMAIL_TO sleep 1 echo “DATA From: $USER@HOSTNAME To: $EMAIL_TO Subject: $EMAIL_SUBJECT $EMAIL_DATA” sleep1 echo ‘.’ sleep 1 echo QUIT) | netcat 25