
# 'host-notify-by-email' command definition
define command {
	command_name			host-notify-by-email
	command_line			/usr/bin/printf "%b" "***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$ 2>>/usr/local/monitoring/log/mail.err$USER9$ /bin/echo -e "Node=$HOSTNAME$\nType=UP/DOWN\nResource=N/A\nMetric=N/A\nSeverity=$HOSTSTATE$\nDescription=$HOSTOUTPUT$" | /usr/local/monitoring/princeton/puevent ais-sn300w:1024 public 2>>/usr/local/monitoring/log/puevent.log
}


# route -T 1 uses the Comcast routing table
define command {
	command_name			host-notify-by-email-via-Comcast_Gmail
	command_line			$USER1$/ssh_key_include_wrapper backupvpn.Princeton.EDU 'route -T 1 exec /usr/local/monitoring/libexec/sendEmail -f "Nagios Monitoring<groundwk@Princeton.EDU>" -t $CONTACTEMAIL$ -s smtp.gmail.com:587 -o tls=yes -xu groundwk@Princeton.EDU -xp $USER30$ -u "Host $HOSTSTATE$ alert for $HOSTNAME$!" -m "***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"'
}


# route -T 2 uses the Verizon routing table
define command {
	command_name			host-notify-by-email-via-Verizon_Gmail
	command_line			$USER1$/ssh_key_include_wrapper backupvpn.Princeton.EDU 'route -T 2 exec /usr/local/monitoring/libexec/sendEmail -f "Nagios Monitoring<groundwk@Princeton.EDU>" -t $CONTACTEMAIL$ -s smtp.gmail.com:587 -o tls=yes -xu groundwk@Princeton.EDU -xp $USER30$ -u "Host $HOSTSTATE$ alert for $HOSTNAME$!" -m "***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"'
}


define command {
	command_name			host-notify-by-email-pu
	command_line			/usr/bin/printf "%b" "$HOSTNAME$ $HOSTSTATE$ at $SHORTDATETIME$\n$HOSTOUTPUT$\n" | $USER1$/custommailsend -H "Subject:$HOSTNAME$ is $HOSTSTATE$" $CONTACTEMAIL$ $CONTACTPAGER$ 2>>/usr/local/monitoring/log/mail.err$USER9$ /bin/echo -e "Node=$HOSTNAME$\nType=UP/DOWN\nResource=N/A\nMetric=N/A\nSeverity=$HOSTSTATE$\nDescription=$HOSTOUTPUT$" | /usr/local/monitoring/princeton/puevent ais-sn300w:1024 public 2>>/usr/local/monitoring/log/puevent.log
}

# 'host-notify-by-epager' command definition
define command {
	command_name			host-notify-by-epager
	command_line			/usr/bin/printf "%b" "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$" $CONTACTPAGER$
}


define command {
	command_name			host-notify-by-punotify
	command_line			/usr/bin/printf "%b" "notify_host '$LASTHOSTCHECK$'\t'$HOSTNAME$'\t'$HOSTGROUPNAMES$'\t'$HOSTSTATE$'\t'$HOSTSTATETYPE$'\t'$HOSTDURATIONSEC$'\t'$HOSTOUTPUT$'\t'$HOSTPERFDATA$'\n" >> /usr/local/monitoring/log/punotify.txt
}


define command {
	command_name			host-notify-by-sendEmail
	command_line			/usr/bin/printf "%b" "<html><b>+++++ HOST $NOTIFICATIONTYPE$ : $HOSTSTATE$ +++++<br>$LONGDATETIME$</b><br>Host: <b>$HOSTALIAS$ ($HOSTADDRESS$)</b></b><br>Message: <b>$HOSTOUTPUT$</b></html>" | $USER1$/sendEmail -q -f $ADMINEMAIL$ -t $CONTACTEMAIL$ -u "[GW] ++ $HOSTNAME$ : $HOSTSTATE$ ++" 2>>/usr/local/monitoring/log/mail.err$USER9$ /bin/echo -e "Node=$HOSTNAME$\nType=UP/DOWN\nResource=N/A\nMetric=N/A\nSeverity=$HOSTSTATE$\nDescription=$HOSTOUTPUT$" | /usr/local/monitoring/princeton/puevent ais-sn300w:1024 public 2>>/usr/local/monitoring/log/puevent.log
}


define command {
	command_name			host-notify-dummy
	command_line			/bin/true
}


define command {
	command_name			host-notify-pu-default
	command_line			$USER1$/pu_host_notify_default.sh '$LASTHOSTCHECK$' '$HOSTNAME$' '$HOSTGROUPNAMES$' '$HOSTSTATE$' '$HOSTSTATETYPE$' '$HOSTDURATIONSEC$' '$HOSTOUTPUT$' '$HOSTPERFDATA$' 2>>/usr/local/monitoring/log/mail.err$USER9$ /bin/echo -e "Node=$HOSTNAME$\nType=UP/DOWN\nResource=N/A\nMetric=N/A\nSeverity=$HOSTSTATE$\nDescription=$HOSTOUTPUT$" | /usr/local/monitoring/princeton/puevent ais-sn300w:1024 public 2>>/usr/local/monitoring/log/puevent.log
}


define command {
	command_name			launch_perfdata_process
	command_line			$USER2$/launch_perf_data_processing
}

# 'notify-by-email' command definition
define command {
	command_name			notify-by-email
	command_line			/usr/bin/printf "%b" "***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ 2>>/usr/local/monitoring/log/mail.err$USER9$ /bin/echo -e "Node=$HOSTNAME$\nType=$SERVICEDESC$\nResource=N/A\nMetric=N/A\nSeverity=$SERVICESTATE$\nDescription=$SERVICEOUTPUT$  $LONGSERVICEOUTPUT$" | /usr/local/monitoring/princeton/puevent ais-sn300w:1024 public 2>>/usr/local/monitoring/log/puevent.log
}

# 'notify-by-epager' command definition
define command {
	command_name			notify-by-epager
	command_line			/usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTPAGER$
}


define command {
	command_name			process_service_perfdata_db
	command_line			$USER2$/process_service_perf_db.pl "$LASTSERVICECHECK$" "$HOSTNAME$" "$SERVICEDESC$" "$SERVICEOUTPUT$" "$SERVICEPERFDATA$"
}


define command {
	command_name			process_service_perfdata_db_strings
	command_line			$USER2$/process_service_perf_db_strings.pl "$LASTSERVICECHECK$" "$HOSTNAME$" "$SERVICEDESC$" "$SERVICEOUTPUT$" "$SERVICEPERFDATA$"
}


define command {
	command_name			process_service_perfdata_file
	command_line			$USER2$/process_service_perf_db_file.pl
}


define command {
	command_name			service-notify-by-email-pu
	command_line			/usr/bin/printf "%b" "$HOSTNAME$ $SERVICEDESC$ $SERVICESTATE$ at $SHORTDATETIME$\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$\n" | $USER1$/custommailsend -H "Subject:$HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTEMAIL$ $CONTACTPAGER$ 2>>/usr/local/monitoring/log/mail.err$USER9$ /bin/echo -e "Node=$HOSTNAME$\nType=$SERVICEDESC$\nResource=N/A\nMetric=N/A\nSeverity=$SERVICESTATE$\nDescription=$SERVICEOUTPUT$  $LONGSERVICEOUTPUT$" | /usr/local/monitoring/princeton/puevent ais-sn300w:1024 public 2>>/usr/local/monitoring/log/puevent.log
}


# route -T 1 uses the Comcast routing table
define command {
	command_name			service-notify-by-email-via-Comcast_Gmail
	#command_line			/bin/echo /usr/bin/ssh backupvpn.Princeton.EDU "route -T 1 exec /usr/local/monitoring/libexec/sendEmail -f \"Nagios Monitoring<groundwk@Princeton.EDU>\" -t $CONTACTEMAIL$ -s smtp.gmail.com:587 -o tls=yes -xu groundwk@Princeton.EDU -xp $USER30$ -u \"** $NOTIFICATIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **\" -m \"***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\""
	command_line			$USER1$/ssh_key_include_wrapper backupvpn.Princeton.EDU "route -T 1 exec /usr/local/monitoring/libexec/sendEmail -f \"Nagios Monitoring<groundwk@Princeton.EDU>\" -t $CONTACTEMAIL$ -s smtp.gmail.com:587 -o tls=yes -xu groundwk@Princeton.EDU -xp $USER30$ -u \"** $NOTIFICATIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **\" -m \"***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT\n\""
}


# route -T 2 uses the Verizon routing table
define command {
	command_name			service-notify-by-email-via-Verizon_Gmail
	#command_line			/bin/echo /usr/bin/ssh backupvpn.Princeton.EDU "route -T 2 exec /usr/local/monitoring/libexec/sendEmail -f \"Nagios Monitoring<groundwk@Princeton.EDU>\" -t $CONTACTEMAIL$ -s smtp.gmail.com:587 -o tls=yes -xu groundwk@Princeton.EDU -xp $USER30$ -u \"** $NOTIFICATIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **\" -m \"***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\""
	command_line			$USER1$/ssh_key_include_wrapper backupvpn.Princeton.EDU "route -T 2 exec /usr/local/monitoring/libexec/sendEmail -f \"Nagios Monitoring<groundwk@Princeton.EDU>\" -t $CONTACTEMAIL$ -s smtp.gmail.com:587 -o tls=yes -xu groundwk@Princeton.EDU -xp $USER30$ -u \"** $NOTIFICATIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **\" -m \"***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$\n\""
}


define command {
	command_name			service-notify-by-email-pu-high-importance
	command_line			/usr/bin/printf "%b" "$HOSTNAME$ $SERVICEDESC$ $SERVICESTATE$ at $SHORTDATETIME$\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$\n" | $USER1$/custommailsend -H "X-Message-Flag:Follow up" -H "Importance:high" -H "Subject:$HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTEMAIL$ 2>>/usr/local/monitoring/log/mail.err$USER9$ /bin/echo -e "Node=$HOSTNAME$\nType=$SERVICEDESC$\nResource=N/A\nMetric=N/A\nSeverity=$SERVICESTATE$\nDescription=$SERVICEOUTPUT$  $LONGSERVICEOUTPUT$" | /usr/local/monitoring/princeton/puevent ais-sn300w:1024 public 2>>/usr/local/monitoring/log/puevent.log
}


define command {
	command_name			service-notify-by-punotify
	command_line			/usr/bin/printf "%b" "notify_service '$LASTHOSTCHECK$'\t'$HOSTNAME$'\t'$SERVICEDESC$'\t'$HOSTGROUPNAMES$'\t'$SERVICEGROUPNAME$'\t'$SERVICESTATE$'\t'$SERVICESTATETYPE$'\t'$SERVICEDURATIONSEC$'\t'$HOSTDURATIONSEC$'\t'$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$'\t'$SERVICEPERFDATA$'\n" >> /usr/local/monitoring/log/punotify.txt
}


define command {
	command_name			service-notify-by-sendEmail
	command_line			/usr/bin/printf "%b" "<html><b>+++++ SERVICE $NOTIFICATIONTYPE$ : $SERVICESTATE$ +++++<br>$LONGDATETIME$</b><br>Host: <b>$HOSTALIAS$ ($HOSTADDRESS$)</b></b><br>Message: <b>$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$</b></html>" | $USER1$/sendEmail -q -f $ADMINEMAIL$ -t $CONTACTEMAIL$ -u "[GW] ++ $HOSTNAME$ : $SERVICEDESC$ : $SERVICESTATE$ ++" 2>>/usr/local/monitoring/log/mail.err$USER9$ /bin/echo -e "Node=$HOSTNAME$\nType=$SERVICEDESC$\nResource=N/A\nMetric=N/A\nSeverity=$SERVICESTATE$\nDescription=$SERVICEOUTPUT$  $LONGSERVICEOUTPUT$" | /usr/local/monitoring/princeton/puevent ais-sn300w:1024 public 2>>/usr/local/monitoring/log/puevent.log
}


define command {
	command_name			service-notify-dummy
	command_line			/bin/true
}


define command {
	command_name			service-notify-pu-default
	command_line			$USER1$/pu_service_notify_default.sh '$LASTHOSTCHECK$' '$HOSTNAME$' '$SERVICEDESC$' '$HOSTGROUPNAMES$' '$SERVICEGROUPNAME$' '$SERVICESTATE$' '$SERVICESTATETYPE$' '$SERVICEDURATIONSEC$' '$HOSTDURATIONSEC$' "$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$" "$SERVICEPERFDATA$" 2>>/usr/local/monitoring/log/mail.err$USER9$ /bin/echo -e "Node=$HOSTNAME$\nType=$SERVICEDESC$\nResource=N/A\nMetric=N/A\nSeverity=$SERVICESTATE$\nDescription=$SERVICEOUTPUT$  $LONGSERVICEOUTPUT$" | /usr/local/monitoring/princeton/puevent ais-sn300w:1024 public 2>>/usr/local/monitoring/log/puevent.log
}


define command {
	command_name			service-notify-pu-igor
	command_line			/bin/echo '$LASTHOSTCHECK$' '$HOSTNAME$' '$SERVICEDESC$' '$HOSTGROUPNAME$' '$SERVICEGROUPNAME$' '$SERVICESTATE$' '$SERVICESTATETYPE$' '$SERVICEDURATIONSEC$' '$HOSTDURATIONSEC$' '$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$' '$SERVICEPERFDATA$' | $USER1$/pu_service_notify_default.sh.igor 2>>/usr/local/monitoring/log/mail.err
}


define command {
	command_name			service-notify-system
	command_line			/usr/bin/printf "%b" "***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ 2>>/usr/local/monitoring/log/mail.err
}
