Skip to content

Instantly share code, notes, and snippets.

@matiasherranz
Created November 26, 2015 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matiasherranz/508362450e9a93edea9b to your computer and use it in GitHub Desktop.
Save matiasherranz/508362450e9a93edea9b to your computer and use it in GitHub Desktop.
santex@santex-VirtualBox:~/DevIT/nagios_samanage$ cat nagios.cfg
# 'notify-host-by-sam' command definition
define command{
command_name notify-host-by-sam
command_line <perl path> <script path>/sam_createcase --hostname=$HOSTNAME$ --type="$NOTIFICATIONTYPE$" --state=$HOSTSTATE$ --address=$HOSTADDRESS$ --output="$HOSTOUTPUT$" --date="$LONGDATETIME$"
}
# 'notify-service-by-sam' command definition
define command{
command_name notify-service-by-sam
command_line <perl path> <script path>/sam_createcase --hostname=$HOSTNAME$ --type="$NOTIFICATIONTYPE$" --service="$SERVICEDESC$" --hostalias="$HOSTALIAS$" --address=$HOSTADDRESS$ --state="$SERVICESTATE$" --date="$LONGDATETIME$" --output="$SERVICEOUTPUT$"
}
# Also, create a contact object which uses these commands. Modify the notification periods and notification options
# to your setup
# Create incident via samanage.com
define contact{
contact_name sam
alias samanage.com
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-sam
host_notification_commands notify-host-by-sam
email <your email address>
}
# Check availability and response time of sam
define command {
command_name check_sam
command_line <script path>/check_sam --response_warning=$ARG1$ --response_critical=$ARG2$
}
# The service definition of this script is usually connected to the nagios host itself:
define service {
host_name <your nagios host>
service_description Check SAM incidents
check_command check_sam_incidents
use generic-service
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment