time period warning

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

time period warning

Post by t3dus »

I keep getting this warning and I'm not sure how to fix it.

Code: Select all

Warning: Contact 'mattphone' has no service notification time period defined!
Warning: Contact 'mattphone' has no host notification time period defined!
The contact "mattphone" looks like this. I edited out the number simply for privacy.

Code: Select all

define contact{
        contact_name                    mattphone
        alias                           Matt Phone
        service_notification_commands   notify-service-by-sms
        host_notification_commands      notify-host-by-sms
        pager                **REMOVED**@email.uscc.net
        }
The Command.cfg for sms looks like this.

Code: Select all

# 'notify-host-by-sms' command definition. Added by matt
define command{
        command_name    notify-host-by-sms
#        command_line    /usr/bin/printf "%b" "$HOSTALIAS$ is $HOSTSTATE$" |/usr/bin/mail $CONTACTPAGER$
        command_line    /usr/bin/printf "%b" "$HOSTALIAS$ is $HOSTSTATE$" |/usr/bin/mail -s "HOST" $CONTACTPAGER$
        }

define command{
        command_name    notify-service-by-sms
#        command_line    /usr/bin/printf "%b" "$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" |/usr/bin/mail $CONTACTPAGER$
        command_line    /usr/bin/printf "%b" "$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" |/usr/bin/mail -s "SERVICE" $CONTACTPAGER$
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: time period warning

Post by scottwilkerson »

Your contact needs notification time periods

such as

Code: Select all

define contact{
        contact_name                    mattphone
        alias                           Matt Phone
        service_notification_commands   notify-service-by-sms
        host_notification_commands      notify-host-by-sms
        pager                           **REMOVED**@email.uscc.net
        host_notification_period        mattphone_notification_times
        service_notification_period     mattphone_notification_times
}

then create the time period

Code: Select all

define timeperiod {
    timeperiod_name         mattphone_notification_times
    alias                   Notification Times for mattphone
    tuesday                 00:00-24:00
    monday                  00:00-24:00
    wednesday               00:00-24:00
    thursday                00:00-24:00
    saturday                00:00-24:00
    sunday                  00:00-24:00
    friday                  00:00-24:00
}
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: time period warning

Post by t3dus »

Will this not being configured with time periods also cause my sms notifications to not arrive?

It hasn't been texting my phone at all like it should be.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: time period warning

Post by scottwilkerson »

t3dus wrote:Will this not being configured with time periods also cause my sms notifications to not arrive?

It hasn't been texting my phone at all like it should be.
It will affect when ANY notification can be sent
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: time period warning

Post by t3dus »

If I read this correctly my notifications should start flowing now that I have configured this.

Thanks
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: time period warning

Post by scottwilkerson »

t3dus wrote:If I read this correctly my notifications should start flowing now that I have configured this.

Thanks
Let us know if you run into other issues
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: time period warning

Post by t3dus »

Well after fixing that problem Nagios still isn't sending text notifications to my phone.

It only sends them out if I force them in a custom notification.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: time period warning

Post by scottwilkerson »

t3dus wrote:Well after fixing that problem Nagios still isn't sending text notifications to my phone.

It only sends them out if I force them in a custom notification.
Do you see them in the notifications log?

Is mattphone a contact on the host/service you expect notifications for? Can you share a configuration for one of the hosts/services you expect to receive notifications for?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: time period warning

Post by t3dus »

scottwilkerson wrote:
t3dus wrote:Well after fixing that problem Nagios still isn't sending text notifications to my phone.

It only sends them out if I force them in a custom notification.
Do you see them in the notifications log?
In the notifications log I see it's e-mailing the normal e-mail addresses but no logs if it attempting to mail the cell phone.
scottwilkerson wrote:Is mattphone a contact on the host/service you expect notifications for? Can you share a configuration for one of the hosts/services you expect to receive notifications for?
Here is my contacts.cfg for mattphone

Contact

Code: Select all

define contact{
        contact_name                    mattphone
        alias                           Matt
        service_notification_commands   notify-service-by-sms
        host_notification_commands      notify-host-by-sms
        email                           **REMOVED**@email.uscc.net
        pager                           **REMOVED**@email.uscc.net
        host_notification_period        sms_notification_times
        service_notification_period     sms_notification_times
        }
Contact Group

Code: Select all

define contactgroup{
        contactgroup_name       sgbusiness
        alias                   Nagios Administrators
        members                 matt,mattphone
        }
And the service check that I set to fail on purpose

Code: Select all

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       snapgeek.com
        service_description             Keyword
#        check_command                   check_http_keyword! -s "Snap"
        check_command                   check_http_keyword! -s "Chicken"
        notifications_enabled           1
        max_check_attempts              5
        check_freshness                 1
        check_interval                  5
        notification_interval           5
        contact_groups                  sgbusiness
        }
And the commands.cfg check itself

Code: Select all

# 'notify-host-by-sms' command definition. Added by matt
define command{
        command_name    notify-host-by-sms
#        command_line    /usr/bin/printf "%b" "$HOSTALIAS$ is $HOSTSTATE$" |/usr/bin/mail $CONTACTPAGER$
        command_line    /usr/bin/printf "%b" "$HOSTALIAS$ is $HOSTSTATE$" |/usr/bin/mail -s "HOST" $CONTACTPAGER$
        }

define command{
        command_name    notify-service-by-sms
#        command_line    /usr/bin/printf "%b" "$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" |/usr/bin/mail $CONTACTPAGER$
        command_line    /usr/bin/printf "%b" "$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" |/usr/bin/mail -s "SERVICE" $CONTACTPAGER$
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: time period warning

Post by t3dus »

Mail Log

Code: Select all

Sep  4 12:35:28 home postfix/pickup[1853]: D15876C0255: uid=1001 from=<[email protected]>
Sep  4 12:35:28 home postfix/cleanup[4569]: D15876C0255: message-id=<[email protected]>
Sep  4 12:35:28 home postfix/qmgr[1854]: D15876C0255: from=<[email protected]>, size=707, nrcpt=1 (queue active)
Sep  4 12:35:31 home postfix/smtp[4576]: D15876C0255: to=<*REMOVED*>, relay=smtp.gmail.com[172.217.212.109]:587, delay=3.1, delays=0.17/0.31/0.65/1.9, dsn=2.0.0, status=sent (250 2.0.0 OK  1567618531 s5sm18005550iol.88 - gsmtp)
Sep  4 12:35:31 home postfix/qmgr[1854]: D15876C0255: removed
It doesn't even attempt the sms option..

if I do this command

Code: Select all

echo "test message" | mailx -s 'test subject' **REMOVED**@email.uscc.net
or if I push a custom message from nagios interface it will text the phone

Code: Select all

Sep  4 12:40:40 home postfix/pickup[1853]: 530796C0255: uid=0 from=<[email protected]>
Sep  4 12:40:40 home postfix/cleanup[4873]: 530796C0255: message-id=<[email protected]>
Sep  4 12:40:40 home postfix/qmgr[1854]: 530796C0255: from=<[email protected]>, size=363, nrcpt=1 (queue active)
Sep  4 12:40:41 home postfix/smtp[4875]: 530796C0255: to=<**REMOVED**@email.uscc.net>, relay=smtp.gmail.com[172.217.214.109]:587, delay=1.4, delays=0.08/0/0.51/0.79, dsn=2.0.0, status=sent (250 2.0.0 OK  1567618841 w10sm4381525iop.40 - gsmtp)
Sep  4 12:40:41 home postfix/qmgr[1854]: 530796C0255: removed
Locked