define service{
  active_checks_enabled          1
  check_freshness                0
  check_interval                 1
  check_period                   testconfig-24x7
  contacts           testconfig-singlecontact,testconfig-michi
  contact_groups                 testconfig-michi
  event_handler_enabled          1
  failure_prediction_enabled     1
  flap_detection_enabled         1
  is_volatile                    0
  max_check_attempts             3
  name                           test-generic-service
  normal_check_interval          5
  notification_interval          0
  notification_options           w,u,c,r
  notification_period            testconfig-24x7
  notifications_enabled          1
  obsess_over_service            1
  parallelize_check              1
  passive_checks_enabled         1
  process_perf_data              1
  icon_image             s.gif' width='0' height='0' border='0'></a><a href='/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$'><img width='20' height='20' src='/icinga/images/logos/Stats2.png' border='0
  register                       0
  retain_nonstatus_information   1
  retain_status_information      1
  retry_check_interval           3
  retry_interval                 1
}

define host{
  check_interval                 1
  check_period                   testconfig-24x7
  contact_groups                 testconfig-michi
  event_handler_enabled          1
  failure_prediction_enabled     1
  flap_detection_enabled         1
  max_check_attempts             5
  name                           test-generic-host
  normal_check_interval          120
  notification_interval          0
  notification_options           d,u,r
  notification_period            testconfig-24x7
  notifications_enabled          1
  process_perf_data              1
  icon_image             s.gif' width='0' height='0' border='0'></a><a href='/pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_'><img width='20' height='20' src='/icinga/images/logos/Stats2.png' border='0
  register                       0
  retain_nonstatus_information   1
  retain_status_information      1
  retry_check_interval           60
  retry_interval                 1
}

define timeperiod{
    timeperiod_name testconfig-24x7
    alias           24 Hours A Day, 7 Days A Week
    sunday          00:00-24:00
    monday          00:00-24:00
    tuesday         00:00-24:00
    wednesday       00:00-24:00
    thursday        00:00-24:00
    friday          00:00-24:00
    saturday        00:00-24:00
}

define timeperiod{
name testconfig-workhours
timeperiod_name testconfig-workhours
alias Normal Work Hours
monday 06:15-18:15
tuesday 06:15-18:15
wednesday 06:15-18:15
thursday 06:15-18:15
friday 06:15-18:15
}


define command{
    command_name    testconfig-check-host-alive
    command_line    $USER1$/test_hostcheck.pl --type=$ARG1$ --failchance=2% --previous-state=$HOSTSTATE$ --state-duration=$HOSTDURATIONSEC$ --hostname $HOSTNAME$
    ;command_line    test_hostcheck.pl --type=$ARG1$ --failchance=2% --previous-state=$HOSTSTATE$ --state-duration=$HOSTDURATIONSEC$ --hostname $HOSTNAME$
}
define command{
    command_name    testconfig-check-host-alive-parent
    command_line    $USER1$/test_hostcheck.pl --type=$ARG1$ --failchance=2% --previous-state=$HOSTSTATE$ --state-duration=$HOSTDURATIONSEC$ --parent-state=$ARG2$ --hostname $HOSTNAME$
    ;command_line    test_hostcheck.pl --type=$ARG1$ --failchance=2% --previous-state=$HOSTSTATE$ --state-duration=$HOSTDURATIONSEC$ --parent-state=$ARG2$ --hostname $HOSTNAME$
}
define command{
    command_name    testconfig-notify-host
#    command_line    sleep 1 && /bin/true
        command_line    ( /usr/bin/printf "%b" "***** Icinga  *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: $SERVICEOUTPUT$\n\nComment: [$NOTIFICATIONAUTHORNAME$] $NOTIFICATIONCOMMENT$\n\n" && /usr/bin/printf "Host:$USER3$/status.cgi?host=$HOSTNAME$\nService:$USER3$/extinfo.cgi?type=2&host=$HOSTNAME$&service=$SERVICEDESC$" | /bin/sed -e s%\ %+%g -e s%:%:\ % )  | /usr/bin/mail -s "$NOTIFICATIONTYPE$ - $HOSTNAME$ - $SERVICEDESC$ - $SERVICESTATE$" $CONTACTEMAIL$

}
define command{
    command_name    testconfig-notify-service
#    command_line    sleep 1 && /bin/true
        command_line    ( /usr/bin/printf "%b" "***** Icinga  *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: $SERVICEOUTPUT$\n\nComment: [$NOTIFICATIONAUTHORNAME$] $NOTIFICATIONCOMMENT$\n\n" && /usr/bin/printf "Host:$USER3$/status.cgi?host=$HOSTNAME$\nService:$USER3$/extinfo.cgi?type=2&host=$HOSTNAME$&service=$SERVICEDESC$" | /bin/sed -e s%\ %+%g -e s%:%:\ % )  | /usr/bin/mail -s "$NOTIFICATIONTYPE$ - $HOSTNAME$ - $SERVICEDESC$ - $SERVICESTATE$" $CONTACTEMAIL$

}
define command{
    command_name    testconfig-check_service
    command_line    $USER1$/test_servicecheck.pl --type=$ARG1$ --failchance=5% --previous-state=$SERVICESTATE$ --state-duration=$SERVICEDURATIONSEC$ --total-critical-on-host=$TOTALHOSTSERVICESCRITICAL$ --total-warning-on-host=$TOTALHOSTSERVICESWARNING$ --hostname $HOSTNAME$ --servicedesc $SERVICEDESC$
    ;command_line    test_servicecheck.pl --type=$ARG1$ --failchance=5% --previous-state=$SERVICESTATE$ --state-duration=$SERVICEDURATIONSEC$ --total-critical-on-host=$TOTALHOSTSERVICESCRITICAL$ --total-warning-on-host=$TOTALHOSTSERVICESWARNING$ --hostname $HOSTNAME$ --servicedesc $SERVICEDESC$
}


define command{
    command_name   testconfig-count
    command_line   /usr/bin/perl $USER1$/test.pl "$SERVICEPERFDATA$"
}


# 'testconfig-notify-host-by-email' command definition
define command{
        command_name            testconfig-notify-host-by-email
        command_line            /usr/bin/printf "%b" "***** Icinga *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usb/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'testconfig-notify-service-by-email' command definition
define command{
        command_name            testconfig-notify-service-by-email
        command_line            /usr/bin/printf "%b" "***** Icinga *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}


define contactgroup{
    contactgroup_name       testconfig-test_contact_group
    alias                   testconfig-test_contacts_alias
    members                 testconfig-test_contact
}
define contactgroup{
    contactgroup_name       testconfig-michi
    alias                   testconfig-michi 
    members                 testconfig-michi
}

define contact{
    contact_name                    testconfig-test_contact
    alias                           testconfig-test_contact_alias
    service_notification_period     testconfig-24x7
    host_notification_period        testconfig-24x7
    service_notification_options    w,u,c,r
    host_notification_options       d,r
    service_notification_commands   testconfig-notify-service
    host_notification_commands      testconfig-notify-host
    email                           icinga@localhost
}

define contact{
    contact_name                    testconfig-michi
    alias                           testconfig-michi
    service_notification_period     testconfig-24x7
    host_notification_period        testconfig-24x7
    service_notification_options    w,u,c,r
    host_notification_options       d,r
    service_notification_commands   testconfig-notify-service
    host_notification_commands      testconfig-notify-host
    email                           icinga@localhost
}


define contact{
    contact_name                    testconfig-singlecontact
    alias                           foobar
    service_notification_period     testconfig-24x7
    host_notification_period        testconfig-24x7
    service_notification_options    w,u,c,r
    host_notification_options       d,r
    service_notification_commands   testconfig-notify-service
    host_notification_commands      testconfig-notify-host
    email                           icinga@localhost
}


