# 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 $USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}
#define command {
#  command_name check_ssh
#  command_line $USER1$/check_ssh -H $HOSTADDRESS$ -t 25
#}
define command {
  command_name check_ssh202
  command_line $USER1$/check_ssh -H $HOSTADDRESS$ -p 202 -t 25
}
define command {
  command_name check_https
  command_line $USER1$/check_http -H $HOSTADDRESS$ --ssl
}
#define command {
#  command_name check_imap
#  command_line $USER1$/check_imap -H $HOSTADDRESS$
#}
define command {
  command_name check_imapt
  command_line $USER1$/check_imap -H $HOSTADDRESS$ -p $ARG1$
}
define command {
  command_name check_smtps
  command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 465
}
define command {
  command_name check_urd
  command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 465
}
define command {
  command_name check_smtpsg
  command_line $USER1$/check_smtp -H $HOSTADDRESS$ -p 26
}
define command {
  command_name check_sagator
  command_line $USER1$/check_smtp -H $HOSTADDRESS$ -p 27
}
define command {
  command_name check_sgcoll
  command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 28
}
define command {
  command_name check_pop3s
  command_line $USER1$/check_pop -S -H $HOSTADDRESS$ -p 995
}
define command {
  command_name check_imaps
  command_line $USER1$/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 $USER1$/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
  first_notification_delay 6
}
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
  first_notification_delay 6
}
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
}"
# SAGATOR SMTP policy
nrpe_policy="define service {
  use $service_templ
  host_name $1
  service_description SMTP_POLICY
  contact_groups $2
  check_command check_nrpe!check_policy
}"
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 $USER1$/check_ups -H $HOSTADDRESS$ -u $ARG1$ -T
}
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 command {
  command_name check_apcupsd
  command_line $USER1$/check_apcupsd $HOSTADDRESS$
}
apcupsd="define service {
  use $service_templ
  host_name $1
  service_description APCUPSD
  contact_groups $2
  check_command check_apcupsd
}"

# RADIUS
define command {
  command_name check_radius_u
  command_line $USER1$/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 $USER1$/check_mysql -H $HOSTADDRESS$ -u nagios
}
define command {
  command_name check_mysql_perf
  command_line $USER1$/check_mysql_perf -H $HOSTADDRESS$ -u nagios
}
mysql="define service {
  use $service_templ
  host_name $1
  service_description MySQL
  contact_groups $2
  check_command check_mysql_perf
}"
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 $USER1$/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 $USER1$/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 $USER1$/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 $USER1$/check_ldap_upjs -H $HOSTADDRESS$ -p 9999
}
ldaps="define service {
  use $service_templ
  host_name $1
  service_description LDAPS
  contact_groups $2
  check_command check_ldaps
}"

# eth
define command {
  command_name check_eth
  command_line $USER1$/check_eth eth$ARG1$ $ARG2$ 90 95
}
eth0="define service {
  use $service_templ
  host_name $1
  service_description eth0
  contact_groups $2
  check_command check_eth!0!1000
}"
eth1="define service {
  use $service_templ
  host_name $1
  service_description eth1
  contact_groups $2
  check_command check_eth!1!1000
}"
eth2="define service {
  use $service_templ
  host_name $1
  service_description eth2
  contact_groups $2
  check_command check_eth!2!1000
}"
eth3="define service {
  use $service_templ
  host_name $1
  service_description eth3
  contact_groups $2
  check_command check_eth!3!1000
}"

# NRPE
define command {
  command_name check_nrpe
  command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define command {
  command_name check_nrpe_t30
  command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -u -t 30
}
# Same as check_nrpe, only differs in different PNP4nagios template
define command {
  command_name check_nrpe_derive
  command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
nrpe_users="define service {
  use $service_templ
  host_name $1
  service_description NRPE_users
  contact_groups $2
  check_command check_nrpe!check_users
}"
nrpe_load="define service {
  use $service_templ
  host_name $1
  service_description NRPE_load
  contact_groups $2
  check_command check_nrpe!check_load
}"
disk_root="define service {
  use $service_templ
  host_name $1
  service_description disk_root
  contact_groups $2
  check_command check_local_disk!10%!5%!/
}"
disk_backuppc="define service {
  use $service_templ
  host_name $1
  service_description disk_backuppc
  contact_groups $2
  check_command check_local_disk!10%!5%!/var/lib/BackupPC
}"
nrpe_disk_var="define service {
  use $service_templ
  host_name $1
  service_description NRPE_disk_var
  contact_groups $2
  check_command check_nrpe!check_disk_var
}"
nrpe_disk_home="define service {
  use $service_templ
  host_name $1
  service_description NRPE_disk_home
  contact_groups $2
  check_command check_nrpe!check_disk_home
}"
nrpe_disk_root="define service {
  use $service_templ
  host_name $1
  service_description NRPE_disk_root
  contact_groups $2
  check_command check_nrpe!check_disk_root
}"
nrpe_disk_tmp="define service {
  use $service_templ
  host_name $1
  service_description NRPE_disk_tmp
  contact_groups $2
  check_command check_nrpe!check_disk_tmp
}"
nrpe_disk_backuppc="define service {
  use $service_templ
  host_name $1
  service_description NRPE_disk_backuppc
  contact_groups $2
  check_command check_nrpe!check_disk_backuppc
}"
nrpe_quota_apache="define service {
  use $service_templ
  host_name $1
  service_description NRPE_quota_apache
  contact_groups $2
  check_command check_nrpe!check_quota_apache
}"
nrpe_disk1="define service {
  use $service_templ
  host_name $1
  service_description NRPE_disk1
  contact_groups $2
  check_command check_nrpe!check_disk1
}"
nrpe_disk2="define service {
  use $service_templ
  host_name $1
  service_description NRPE_disk2
  contact_groups $2
  check_command check_nrpe!check_disk2
}"
nrpe_disk3="define service {
  use $service_templ
  host_name $1
  service_description NRPE_disk3
  contact_groups $2
  check_command check_nrpe!check_disk3
}"
nrpe_disk4="define service {
  use $service_templ
  host_name $1
  service_description NRPE_disk4
  contact_groups $2
  check_command check_nrpe!check_disk4
}"
nrpe_zombie_procs="define service {
  use $service_templ
  host_name $1
  service_description NRPE_zombie_procs
  contact_groups $2
  check_command check_nrpe!check_zombie_procs
}"
nrpe_total_procs="define service {
  use $service_templ
  host_name $1
  service_description NRPE_total_procs
  contact_groups $2
  check_command check_nrpe!check_total_procs
}"
nrpe_recv_mail="define service {
  use $service_templ
  host_name $1
  service_description NRPE_recv_mail
  contact_groups $2
  check_command check_nrpe!check_recv_mail
}"
nrpe_mysql="define service {
  use $service_templ
  host_name $1
  service_description NRPE_mysql
  contact_groups $2
  check_command check_nrpe!check_mysql
}"
nrpe_mailq="define service {
  use 30min
  host_name $1
  service_description NRPE_mailq
  contact_groups $2
  check_command check_nrpe_t30!check_mailq
}"
nrpe_swap="define service {
  use $service_templ
  host_name $1
  service_description NRPE_swap
  contact_groups $2
  check_command check_nrpe!check_swap
}"
nrpe_sagator="define service {
  use $service_templ
  host_name $1
  service_description NRPE_sagator
  contact_groups $2
  check_command check_nrpe_t30!check_sagator
}"
# eth
nrpe_eth0="define service {
  use $service_templ
  host_name $1
  service_description NRPE_eth0
  contact_groups $2
  check_command check_nrpe_derive!check_eth0
}"
nrpe_eth1="define service {
  use $service_templ
  host_name $1
  service_description NRPE_eth1
  contact_groups $2
  check_command check_nrpe_derive!check_eth1
}"
nrpe_eth2="define service {
  use $service_templ
  host_name $1
  service_description NRPE_eth2
  contact_groups $2
  check_command check_nrpe_derive!check_eth2
}"
nrpe_eth3="define service {
  use $service_templ
  host_name $1
  service_description NRPE_eth3
  contact_groups $2
  check_command check_nrpe_derive!check_eth3
}"
# DISKIO
nrpe_diskio_a="define service {
  use $service_templ
  host_name $1
  service_description diskio_a
  contact_groups $2
  check_command check_nrpe_derive!check_diskio_a
}"
nrpe_diskio_b="define service {
  use $service_templ
  host_name $1
  service_description diskio_b
  contact_groups $2
  check_command check_nrpe_derive!check_diskio_b
}"
nrpe_diskio_c="define service {
  use $service_templ
  host_name $1
  service_description diskio_c
  contact_groups $2
  check_command check_nrpe_derive!check_diskio_c
}"
# sync
nrpe_sync="define service {
  use $service_templ
  host_name $1
  service_description NRPE_sync
  contact_groups $2
  check_command check_nrpe!check_sync
}"
# aacraid
nrpe_aacraid="define service {
  use $service_templ
  host_name $1
  service_description AACRAID
  contact_groups $2
  check_command check_nrpe!check_aacraid
}"
# Apache & Lighttpd
define command {
  command_name check_apache
  command_line $USER1$/check_apache -H $HOSTADDRESS$
}
apache="define service {
  use $service_templ
  host_name $1
  service_description apache
  contact_groups $2
  check_command check_apache
}"
define command {
  command_name check_lighttpd
  command_line $USER1$/check_lighttpd -H $HOSTADDRESS$
}
lighttpd="define service {
  use $service_templ
  host_name $1
  service_description lighttpd
  contact_groups $2
  check_command check_lighttpd
}"
