here are the configurations of my set up
Define a host for the Windows machine we’ll be monitoring
Change the host_name, alias, and address to fit your situation
define host{
use windows-server ; Inherit default values from a template
host_name winserver ; The name we’re giving to this host
alias My Windows Server ; A longer name associated with the host
address 192.168.1.2 ; IP address of the host
}
###############################################################################
###############################################################################
HOST TEMPLATES
###############################################################################
###############################################################################
Generic host definition template - This is NOT a real host, just a template!
define host{
name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
notification_period 24x7 ; Send host notifications at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
Linux host definition template - This is NOT a real host, just a template!
define host{
name linux-server ; The name of this host template
use generic-host ; This template inherits other values from the generic-host template
check_period 24x7 ; By default, Linux hosts are checked round the clock
check_interval 5 ; Actively check the host every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each Linux host 10 times (ma:evil:
check_command check-host-alive ; Default command to check Linux hosts
notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day
‘notify-host-by-email’ command definition
define command{
command_name notify-host-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 " $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **” $CONTACTEMAIL$
}
‘notify-service-by-email’ command definition
define command{
command_name notify-service-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$" | /bin/mail -s " $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}
following are the logged messages on maillog:
Sep 14 16:31:06 localhost sendmail[32074]: m8E8V6dL032074: from=nagios, size=281, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
on=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:14:24 localhost sendmail[6946]: m8H1ENM2006946: [email protected], ctladdr=nagios (502/502), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30330, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1ENHt006947 Message accepted for delivery)
Sep 17 09:14:27 localhost sendmail[6949]: m8H1ENHt006947: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=120627, relay=gmail-smtp-in.l.google.com. [209.85.143.27], dsn=2.0.0, stat=Sent (OK 1221639268 u8si349390tia.6)
Sep 17 09:15:36 localhost sendmail[6941]: m8H1ENXi006939: to=[email protected], ctladdr=[email protected] (502/502), delay=00:01:13, xdelay=00:01:13, mailer=esmtp, pri=120627, relay=e.mx.mail.yahoo.com. [216.39.53.1], dsn=5.0.0, stat=Service unavailable
Sep 17 09:15:36 localhost sendmail[6941]: m8H1ENXi006939: m8H1FaXi006941: DSN: Service unavailable
Sep 17 09:15:36 localhost sendmail[6941]: m8H1FaXi006941: to=[email protected], delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31866, dsn=2.0.0, stat=Sent
Sep 17 09:16:18 localhost sendmail[6979]: m8H1GIVK006979: from=root, size=38, class=0, nrcpts=2, msgid=[email protected], relay=root@localhost
Sep 17 09:16:18 localhost sendmail[6980]: m8H1GIg8006980: [email protected]… User unknown
Sep 17 09:16:18 localhost sendmail[6979]: m8H1GIVK006979: to=test, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60038, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Sep 17 09:16:18 localhost sendmail[6980]: m8H1GIg8006980: from=[email protected], size=335, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:16:18 localhost sendmail[6979]: m8H1GIVK006979: [email protected], ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60038, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1GIg8006980 Message accepted for delivery)
Sep 17 09:16:18 localhost sendmail[6979]: m8H1GIVK006979: m8H1GIVL006979: DSN: User unknown
Sep 17 09:16:18 localhost sendmail[6980]: m8H1GIgA006980: from=<>, size=1958, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:16:18 localhost sendmail[6979]: m8H1GIVL006979: to=root, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31062, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1GIgA006980 Message accepted for delivery)
Sep 17 09:16:18 localhost sendmail[6983]: m8H1GIgA006980: to=[email protected], delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32176, dsn=2.0.0, stat=Sent
Sep 17 09:16:23 localhost sendmail[6982]: m8H1GIg8006980: to=[email protected], ctladdr=[email protected] (0/0), delay=00:00:05, xdelay=00:00:05, mailer=esmtp, pri=120335, relay=gmail-smtp-in.l.google.com. [209.85.143.114], dsn=2.0.0, stat=Sent (OK 1221639383 d1si244053tid.11)
Sep 17 09:16:43 localhost sendmail[6999]: m8H1Ghxt006999: from=nagios, size=324, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:16:43 localhost sendmail[7000]: m8H1Gh2W007000: from=[email protected], size=621, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:16:43 localhost sendmail[6999]: m8H1Ghxt006999: [email protected], ctladdr=nagios (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30324, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1Gh2W007000 Message accepted for delivery)
Sep 17 09:16:43 localhost sendmail[7007]: m8H1GhWP007007: from=nagios, size=324, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:16:44 localhost sendmail[7008]: m8H1Ghxw007008: from=[email protected], size=621, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:16:44 localhost sendmail[7007]: m8H1GhWP007007: [email protected], ctladdr=nagios (502/502), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30324, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1Ghxw007008 Message accepted for delivery)
Sep 17 09:16:47 localhost sendmail[7010]: m8H1Ghxw007008: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=120621, relay=gmail-smtp-in.l.google.com. [209.85.143.114], dsn=2.0.0, stat=Sent (OK 1221639408 i6si3268919tid.16)
Sep 17 09:17:03 localhost sendmail[7002]: m8H1Gh2W007000: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:20, xdelay=00:00:20, mailer=esmtp, pri=120621, relay=f.mx.mail.yahoo.com. [209.191.88.247], dsn=5.0.0, stat=Service unavailable
Sep 17 09:17:03 localhost sendmail[7002]: m8H1Gh2W007000: m8H1H32W007002: DSN: Service unavailable
Sep 17 09:17:03 localhost sendmail[7002]: m8H1H32W007002: to=[email protected], delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31860, dsn=2.0.0, stat=Sent
Sep 17 09:18:13 localhost sendmail[7049]: m8H1IDuK007049: from=nagios, size=310, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:18:14 localhost sendmail[7050]: m8H1IDNu007050: from=[email protected], size=607, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:18:14 localhost sendmail[7049]: m8H1IDuK007049: [email protected], ctladdr=nagios (502/502), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30310, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1IDNu007050 Message accepted for delivery)
Sep 17 09:18:14 localhost sendmail[7057]: m8H1IEo8007057: from=nagios, size=310, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:18:14 localhost sendmail[7058]: m8H1IELY007058: from=[email protected], size=607, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:18:14 localhost sendmail[7057]: m8H1IEo8007057: [email protected], ctladdr=nagios (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30310, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1IELY007058 Message accepted for delivery)
Sep 17 09:18:17 localhost sendmail[7060]: m8H1IELY007058: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=120607, relay=gmail-smtp-in.l.google.com. [209.85.143.114], dsn=2.0.0, stat=Sent (OK 1221639498 w5si272172tib.9)
Sep 17 09:18:25 localhost sendmail[7052]: m8H1IDNu007050: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:11, xdelay=00:00:11, mailer=esmtp, pri=120607, relay=c.mx.mail.yahoo.com. [216.39.53.2], dsn=5.0.0, stat=Service unavailable
Sep 17 09:18:25 localhost sendmail[7052]: m8H1IDNu007050: m8H1IPNu007052: DSN: Service unavailable
Sep 17 09:18:25 localhost sendmail[7052]: m8H1IPNu007052: to=[email protected], delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31846, dsn=2.0.0, stat=Sent
Sep 17 09:19:43 localhost sendmail[7083]: m8H1Jh32007083: from=nagios, size=310, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:19:43 localhost sendmail[7084]: m8H1Jhor007084: from=[email protected], size=607, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:19:43 localhost sendmail[7083]: m8H1Jh32007083: [email protected], ctladdr=nagios (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30310, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1Jhor007084 Message accepted for delivery)
Sep 17 09:19:43 localhost sendmail[7091]: m8H1JhnK007091: from=nagios, size=310, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:19:43 localhost sendmail[7092]: m8H1Jhhi007092: from=[email protected], size=607, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:19:43 localhost sendmail[7091]: m8H1JhnK007091: [email protected], ctladdr=nagios (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30310, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1Jhhi007092 Message accepted for delivery)
Sep 17 09:19:47 localhost sendmail[7094]: m8H1Jhhi007092: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:04, xdelay=00:00:04, mailer=esmtp, pri=120607, relay=gmail-smtp-in.l.google.com. [209.85.143.27], dsn=2.0.0, stat=Sent (OK 1221639588 22si326573tim.10)
Sep 17 09:21:13 localhost sendmail[7129]: m8H1LDIs007129: from=nagios, size=318, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:21:13 localhost sendmail[7130]: m8H1LDAi007130: from=[email protected], size=615, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:21:13 localhost sendmail[7129]: m8H1LDIs007129: [email protected], ctladdr=nagios (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30318, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1LDAi007130 Message accepted for delivery)
Sep 17 09:21:14 localhost sendmail[7137]: m8H1LD85007137: from=nagios, size=318, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:21:14 localhost sendmail[7138]: m8H1LEKm007138: from=[email protected], size=615, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:21:14 localhost sendmail[7137]: m8H1LD85007137: [email protected], ctladdr=nagios (502/502), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30318, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1LEKm007138 Message accepted for delivery)
Sep 17 09:21:17 localhost sendmail[7086]: m8H1Jhor007084: to=[email protected], ctladdr=[email protected] (502/502), delay=00:01:34, xdelay=00:01:34, mailer=esmtp, pri=120607, relay=g.mx.mail.yahoo.com. [209.191.88.239], dsn=5.0.0, stat=Service unavailable
Sep 17 09:21:17 localhost sendmail[7086]: m8H1Jhor007084: m8H1LHor007086: DSN: Service unavailable
Sep 17 09:21:17 localhost sendmail[7086]: m8H1LHor007086: to=[email protected], delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31846, dsn=2.0.0, stat=Sent
Sep 17 09:21:18 localhost sendmail[7140]: m8H1LEKm007138: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:04, xdelay=00:00:04, mailer=esmtp, pri=120615, relay=gmail-smtp-in.l.google.com. [209.85.143.27], dsn=2.0.0, stat=Sent (OK 1221639678 b4si725923tic.14)
Sep 17 09:25:17 localhost sendmail[7203]: m8H0LCEu005892: to=[email protected], ctladdr=[email protected] (502/502), delay=01:04:05, xdelay=00:00:12, mailer=esmtp, pri=210615, relay=e.mx.mail.yahoo.com. [216.39.53.1], dsn=5.0.0, stat=Service unavailable
Sep 17 09:25:17 localhost sendmail[7203]: m8H0LCEu005892: m8H1P5Kn007203: DSN: Service unavailable
Sep 17 09:25:17 localhost sendmail[7203]: m8H1P5Kn007203: to=[email protected], delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31854, dsn=2.0.0, stat=Sent
Sep 17 09:27:25 localhost sendmail[7132]: m8H1LDAi007130: timeout waiting for input from c.mx.mail.yahoo.com. during client greeting
Sep 17 09:30:33 localhost sendmail[7304]: m8H1UX8W007304: from=nagios, size=269, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:30:33 localhost sendmail[7305]: m8H1UXVI007305: from=[email protected], size=566, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:30:33 localhost sendmail[7304]: m8H1UX8W007304: [email protected], ctladdr=nagios (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30269, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1UXVI007305 Message accepted for delivery)
Sep 17 09:30:34 localhost sendmail[7312]: m8H1UXFI007312: from=nagios, size=269, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:30:34 localhost sendmail[7313]: m8H1UYmb007313: from=[email protected], size=566, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:30:34 localhost sendmail[7312]: m8H1UXFI007312: [email protected], ctladdr=nagios (502/502), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30269, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1UYmb007313 Message accepted for delivery)
Sep 17 09:30:36 localhost sendmail[7315]: m8H1UYmb007313: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=120566, relay=gmail-smtp-in.l.google.com. [209.85.143.114], dsn=2.0.0, stat=Sent (OK 1221640237 2si315094tif.7)
Sep 17 09:32:27 localhost sendmail[7132]: m8H1LDAi007130: timeout waiting for input from a.mx.mail.yahoo.com. during client greeting
Sep 17 09:32:27 localhost sendmail[7132]: m8H1LDAi007130: to=[email protected], ctladdr=[email protected] (502/502), delay=00:11:14, xdelay=00:11:14, mailer=esmtp, pri=120615, relay=a.mx.mail.yahoo.com. [209.191.118.103], dsn=4.0.0, stat=Deferred: Connection timed out with a.mx.mail.yahoo.com.
Sep 17 09:33:33 localhost sendmail[7379]: m8H1XXqV007379: from=nagios, size=281, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:33:33 localhost sendmail[7380]: m8H1XXXU007380: from=[email protected], size=578, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:33:33 localhost sendmail[7379]: m8H1XXqV007379: [email protected], ctladdr=nagios (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30281, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1XXXU007380 Message accepted for delivery)
Sep 17 09:33:33 localhost sendmail[7387]: m8H1XXEZ007387: from=nagios, size=281, class=0, nrcpts=1, msgid=[email protected], relay=nagios@localhost
Sep 17 09:33:33 localhost sendmail[7388]: m8H1XXAt007388: from=[email protected], size=578, class=0, nrcpts=1, msgid=[email protected], proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 17 09:33:33 localhost sendmail[7387]: m8H1XXEZ007387: [email protected], ctladdr=nagios (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30281, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m8H1XXAt007388 Message accepted for delivery)
Sep 17 09:33:36 localhost sendmail[7390]: m8H1XXAt007388: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=120578, relay=gmail-smtp-in.l.google.com. [209.85.143.114], dsn=2.0.0, stat=Sent (OK 1221640417 y5si3748138tia.8)
Sep 17 09:33:42 localhost sendmail[7382]: m8H1XXXU007380: to=[email protected], ctladdr=[email protected] (502/502), delay=00:00:09, xdelay=00:00:09, mailer=esmtp, pri=120578, relay=e.mx.mail.yahoo.com. [216.39.53.1], dsn=5.0.0, stat=Service unavailable
Sep 17 09:33:42 localhost sendmail[7382]: m8H1XXXU007380: m8H1XgXU007382: DSN: Service unavailable
Sep 17 09:33:42 localhost sendmail[7382]: m8H1XgXU007382: to=[email protected], delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31817, dsn=2.0.0, stat=Sent
Sep 17 09:35:43 localhost sendmail[7307]: m8H1UXVI007305: timeout waiting for input from a.mx.mail.yahoo.com. during client greeting
Sep 17 09:40:53 localhost sendmail[7307]: m8H1UXVI007305: timeout waiting for input from e.mx.mail.yahoo.com. during client greeting
Sep 17 09:41:02 localhost sendmail[7307]: m8H1UXVI007305: to=[email protected], ctladdr=[email protected] (502/502), delay=00:10:29, xdelay=00:10:29, mailer=esmtp, pri=120566, relay=f.mx.mail.yahoo.com. [209.191.88.247], dsn=5.0.0, stat=Service unavailable
Sep 17 09:41:02 localhost sendmail[7307]: m8H1UXVI007305: m8H1f2VI007307: DSN: Service unavailable
Sep 17 09:41:02 localhost sendmail[7307]: m8H1f2VI007307: to=[email protected], delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31805, dsn=2.0.0, stat=Sent