# Internal commands:
contact="define contact {
  contact_name $1
  alias $3
  host_notification_period 24x7
  service_notification_period 24x7
  host_notification_options d,r
  service_notification_options c,r
  host_notification_commands host-notify-by-email
  service_notification_commands notify-by-email
  email $2
}"
ncontact="define contact {
  contact_name $1
  alias $3
  host_notification_period none
  service_notification_period none
  host_notification_options n
  service_notification_options n
  host_notification_commands host-notify-by-email
  service_notification_commands notify-by-email
  email $2
}"
define host {
  max_check_attempts 3
  check_command check-host-alive
  notification_interval 240
  notification_period 24x7
  notification_options d,r
  name host_templ
  register 0
}
host="define host {
  use host_templ
  host_name $1
  alias $3
  address $2
  parents $4
  contact_groups $5
}
define hostescalation {
  host_name $1
  contact_groups $5
  first_notification 2
  last_notification 4
  notification_interval 120
}"
host_wop="define host {
  use host_templ
  host_name $1
  address $2
  alias $3
  contact_groups $4
}
define hostescalation {
  host_name $1
  contact_groups $4
  first_notification 2
  last_notification 4
  notification_interval 120
}"
phost="define host {
  use host_templ
  host_name $1
  address $2
  alias $3
  parents $4
  contact_groups $5
}
define hostescalation {
  host_name $1
  contact_groups $5
  first_notification 2
  last_notification 4
  notification_interval 120
}
define service {
  host_name $1
  service_description PING
  check_period 24x7
  max_check_attempts 3
  normal_check_interval 3
  retry_check_interval 1
  contact_groups $5
  notification_interval 240
  notification_period 24x7
  notification_options c,r
  check_command check_ping_u!100.0,30%!500.0,60%
}"
hostdep="define hostdependency {
  dependent_host_name $2
  host_name $1
  notification_failure_criteria o,d
}"
command="define command {
  command_name $1
  command_line $2
}"
contactgroup="define contactgroup {
  contactgroup_name $1
  alias $2
  members $3
}"
hostgroup="define hostgroup {
  hostgroup_name $1
  alias $2
  members $4
}"
hostgroupescalation="define hostgroupescalation {
  hostgroup_name $1
  first_notification $2
  last_notification $3
  notification_interval $4
  contact_groups $5
}"

# Commands
define command {
  command_name check_ping_u
  command_line /usr/lib/nagios/plugins/check_icmp -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}
define command {
  command_name check_ssh
  command_line /usr/lib/nagios/plugins/check_ssh -H $HOSTADDRESS$ -t 25
}
define command {
  command_name check_ssh202
  command_line /usr/lib/nagios/plugins/check_ssh -H $HOSTADDRESS$ -p 202 -t 25
}
define command {
  command_name check_https
  command_line /usr/lib/nagios/plugins/check_http -H $HOSTADDRESS$ --ssl
}
define command {
  command_name check_imap
  command_line /usr/lib/nagios/plugins/check_imap -H $HOSTADDRESS$
}
define command {
  command_name check_imapt
  command_line /usr/lib/nagios/plugins/check_imap -H $HOSTADDRESS$ -p $ARG1$
}
define command {
  command_name check_smtps
  command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p 465
}
define command {
  command_name check_urd
  command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p 465
}
define command {
  command_name check_smtpsg
  command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p 26
}
define command {
  command_name check_sagator
  command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p 27
}
define command {
  command_name check_sgcoll
  command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p 28
}
define command {
  command_name check_pop3s
  command_line /usr/lib/nagios/plugins/check_pop -S -H $HOSTADDRESS$ -p 995
}
define command {
  command_name check_imaps
  command_line /usr/lib/nagios/plugins/check_imap -S -H $HOSTADDRESS$ -p 993
}
define command {
  command_name check_ica
  command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 1494
}
define command {
  command_name check_pgsql_local
  command_line /usr/lib/nagios/plugins/check_pgsql
}

# Services
ping="define service {
  host_name $1
  service_description PING
  check_period 24x7
  max_check_attempts 3
  normal_check_interval 3
  retry_check_interval 1
  contact_groups $2
  notification_interval 240
  notification_period 24x7
  notification_options c,r
  check_command check_ping_u!100.0,30%!500.0,60%
}"
ping_slow="define service {
  host_name $1
  service_description PING
  check_period 24x7
  max_check_attempts 3
  normal_check_interval 3
  retry_check_interval 1
  contact_groups $2
  notification_interval 240
  notification_period 24x7
  notification_options c,r
  check_command check_ping_u!2000.0,40%!4000.0,80%
}"
service_templ="5min"
define service {
  name 5min
  register 0
  service_description TEMPLATE SERVICE
  check_period 24x7
  max_check_attempts 1
  normal_check_interval 5
  retry_check_interval 1
  notification_interval 240
  notification_period 24x7
  notification_options c,r
}
define service {
  name 30min
  register 0
  service_description TEMPLATE SERVICE
  check_period 24x7
  max_check_attempts 1
  normal_check_interval 30
  retry_check_interval 2
  notification_interval 240
  notification_period 24x7
  notification_options c,r
}
ssh="define service {
  use $service_templ
  host_name $1
  service_description SSH
  contact_groups $2
  check_command check_ssh
}"
ssh202="define service {
  use $service_templ
  host_name $1
  service_description SSH
  contact_groups $2
  check_command check_ssh202
}"
http="define service {
  use $service_templ
  host_name $1
  service_description HTTP
  contact_groups $2
  check_command check_http
}"
https="define service {
  use $service_templ
  host_name $1
  service_description HTTPS
  contact_groups $2
  check_command check_https
}"
smtp="define service {
  use $service_templ
  host_name $1
  service_description SMTP
  contact_groups $2
  check_command check_smtp
}"
smtpsg="define service {
  use $service_templ
  host_name $1
  service_description SagatorSMTP
  contact_groups $2
  check_command check_smtpsg
}"
sagator="define service {
  use $service_templ
  host_name $1
  service_description SAGATOR
  contact_groups $2
  check_command check_sagator
}"
sgcoll="define service {
  use $service_templ
  host_name $1
  service_description SagatorCollector
  contact_groups $2
  check_command check_sgcoll
}"
psql="define service {
  use $service_templ
  host_name $1
  service_description POSTGRES
  contact_groups $2
  check_command check_tcp!5432
}"
pgsql_local="define service {
  use $service_templ
  host_name $1
  service_description POSTGRES
  contact_groups $2
  check_command check_pgsql_local
}"
dnet="define service {
  use $service_templ
  host_name $1
  service_description DNET
  contact_groups $2
  check_command check_tcp!2064
}"
ftp="define service {
  use $service_templ
  host_name $1
  service_description FTP
  contact_groups $2
  check_command check_ftp
}"
dns="define service {
  use $service_templ
  host_name $1
  service_description DNS
  contact_groups $2
  check_command check_dns
}"
imap="define service {
  use $service_templ
  host_name $1
  service_description IMAP
  contact_groups $2
  check_command check_imap
}"
pop3="define service {
  use $service_templ
  host_name $1
  service_description POP3
  contact_groups $2
  check_command check_pop
}"
imaps="define service {
  use $service_templ
  host_name $1
  service_description IMAPS
  contact_groups $2
  check_command check_imaps
}"
smtps="define service {
  use $service_templ
  host_name $1
  service_description SMTPS
  contact_groups $2
  check_command check_smtps
}"
pop3s="define service {
  use $service_templ
  host_name $1
  service_description POP3S
  contact_groups $2
  check_command check_pop3s
}"
telnet="define service {
  use $service_templ
  host_name $1
  service_description TELNET
  contact_groups $2
  check_command check_telnet
}"
ica="define service {
  use $service_templ
  host_name $1
  service_description ICA
  contact_groups $2
  check_command check_ica
}"

# SIP
define command {
  command_name check_sip_u
  command_line sipsak -N -s sip:$ARG1$@$HOSTADDRESS$ -H s2.upjs.sk
}
sip="define service {
  use $service_templ
  host_name $1
  service_description SIP
  contact_groups $2
  check_command check_sip_u!8111
}"
polycom_sip="define service {
  use $service_templ
  host_name $1
  service_description SIP
  contact_groups $2
  check_command check_sip_u!
}"
define command {
  command_name check_sip5061
  command_line sipsak -N -s sip:8111@$HOSTADDRESS$ -r 5061 -H s2.upjs.sk
}
sip5061="define service {
  use $service_templ
  host_name $1
  service_description Asterisk SIP
  contact_groups $2
  check_command check_sip5061
}"

# NUT
define command {
  command_name check_ups
  command_line /usr/lib/nagios/plugins/check_ups -H $HOSTADDRESS$ -u $ARG1$
}
ups_apc="define service {
  use $service_templ
  host_name $1
  service_description UPS APC
  contact_groups $2
  check_command check_ups!apc
}"
ups_victron="define service {
  use $service_templ
  host_name $1
  service_description UPS APC
  contact_groups $2
  check_command check_ups!victron
}"
apcupsd="define service {
  use $service_templ
  host_name $1
  service_description APCUPSD
  contact_groups $2
  check_command check_tcp!3551
}"

# RADIUS
define command {
  command_name check_radius_u
  command_line /usr/lib/nagios/plugins/check_radius -H $HOSTADDRESS$ -F /etc/radiusclient/radiusclient.conf -u nagios -p gjuhaeiuh
}
radius="define service {
  use $service_templ
  host_name $1
  service_description Radius
  contact_groups $2
  check_command check_radius_u
}"

# MySQL
define command {
  command_name check_mysql_u
  command_line /usr/lib/nagios/plugins/check_mysql -H $HOSTADDRESS$ -u nagios
}
mysql="define service {
  use $service_templ
  host_name $1
  service_description MySQL
  contact_groups $2
  check_command check_mysql_u
}"
define command {
  command_name check_mysql_perf
  command_line /etc/nagios/check_mysql_perf -H $HOSTADDRESS$ -u nagios
}
mysqlp="define service {
  use $service_templ
  host_name $1
  service_description MySQL
  contact_groups $2
  check_command check_mysql_perf
}"

# PgSQL
define command {
  command_name check_pgsql_u
  command_line /usr/lib/nagios/plugins/check_pgsql -H $HOSTADDRESS$ -l nagios
}
pgsql="define service {
  use $service_templ
  host_name $1
  service_description pgsql
  contact_groups $2
  check_command check_pgsql_u
}"

# DHCP
define command {
  command_name check_dhcp
  command_line /usr/lib/nagios/plugins/check_dhcp -s $HOSTADDRESS$
}
dhcp="define service {
  use $service_templ
  host_name $1
  service_description DHCP
  contact_groups $2
  check_command check_dhcp
}"

# ms-rdp
define command {
  command_name check_rdp
  command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p 3389
}
rdp="define service {
  use $service_templ
  host_name $1
  service_description MS RDP
  contact_groups $2
  check_command check_rdp
}"

# ldaps (LDAP over SSL)
define command {
  command_name check_ldaps
  command_line /etc/nagios/check_ldaps -H $HOSTADDRESS$ -p 9999
}
ldaps="define service {
  use $service_templ
  host_name $1
  service_description LDAPS
  contact_groups $2
  check_command check_ldaps
}"
