Can I use different email addresses for different types of a

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.
Locked
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Can I use different email addresses for different types of a

Post by Alan »

I am trying to figure out if I can send different emails for different types of alerts. I use google voice and Zabbix. When Zabbix sends an email alert, it is forwarded to google voice and google voice calls whoever is on call, then reads the email.

So I am wondering if I can have an email setup for servers being completely down. Then have another email setup for warnings like hard drive being 90%? I am trying to set it up in such a way that I am only getting woken up at 2 in the morning if a critical server is down. And if non-critical servers go down I just get an email.

Also, I am trying to figure out if I can have the thresholds set on time. Example, if the CPU sends a warning email at 80%. Instead of sending it an email right when it hits 80% can I have it send an email only if it is 80% or above for 30 minutes.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Can I use different email addresses for different types

Post by scottwilkerson »

Sorry, this is not a Zabbix forum and we do not know anything about their software.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: Can I use different email addresses for different types

Post by Alan »

Sorry I should of clarified this more. I am trying to move from Zabbix to Nagios and I am trying to find out if this setup is possible to do in Nagios. I was just trying to give an example of what it does in Zabbix. So I am just trying to find out if this will work and if it does how to set it up.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Can I use different email addresses for different types

Post by scottwilkerson »

Ok, that makes more sense.

You can setup multiple contacts, and each of them can have independent notification commands for hosts and services.

There is no limit to the number of contacts, or commands you can specify, and each command can be customized to your specifications.

https://assets.nagios.com/downloads/nag ... bject.html
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: Can I use different email addresses for different types

Post by Alan »

Great I will have a look at this thanks for the guidance.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Can I use different email addresses for different types

Post by scottwilkerson »

Alan wrote:Great I will have a look at this thanks for the guidance.
no problem
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: Can I use different email addresses for different types

Post by Alan »

I am trying to get two contacts setup and one contact group and I can’t seem to get it working. I have tired to add things everywhere I can think of. I get this error when running - sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Code: Select all

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
Error: Contact 'admins' is not defined anywhere!
Error: Could not add contact 'admins' to host (config file '/usr/local/nagios/etc/objects/ncpa.cfg', starting on line 147)
   Error processing object config files!
What I have configured so far:
The contacts.cfg file with

Code: Select all

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user
        email                           email@mydomian.com       ; Add email here
 }

define contact {
        contact_name                    alawoo
        use                             generic-contact
        alias                           Alan Woods
        email                           email@mydomian.com
}


define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin, alawoo
        }
The ncpa.cfg file with:

Code: Select all

define host {
    host_name               Svr-ome
    address                 172.17.20.8
    check_command           check_ncpa!-t 'CMPublic' -P 5693 -M system/agent_version
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    contacts                admins
    notification_interval   60
    notification_period     24x7
    notifications_enabled   1
    icon_image              ncpa.png
    statusmap_image         ncpa.png
    register                1
}

define service {
    host_name               Svr-ome
    service_description     CPU Load
    check_command           check_ncpa!-t 'CMPublic' -P 5693 -M cpu/percent -w 70 -c 80 -q 'aggregate=avg'
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmin
    contact_groups          admins
    register                1
}

define service {
    host_name               Svr-ome
    service_description     C:\ Drive
    check_command           check_ncpa!-t 'CMPublic' -P 5693 -M 'disk/logical/C:|/used_percent' -w 85 -c 95
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmin
    contact_groups          admins
    register                1
}

define service {
    host_name               Svr-ome
    service_description     Memory Usage
    check_command           check_ncpa!-t 'CMPublic' -P 5693 -M memory/virtual -w 80 -c 90 -u G
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmins
    contact_groups          admins
    register                1
}

define service {
    host_name               Svr-ome
    service_description     Ping
    check_command           check_ping!60.0,5%!100.0,10%
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmins
    contact_groups          admins
    register                1
}
I found a form that said I needed to add the name of the contactgroup_name admins to this file somewhere but I am not sure where. All the email works when i am just using one contact with nagiosadmin
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Can I use different email addresses for different types

Post by scottwilkerson »

change this

Code: Select all

define host {
    host_name               Svr-ome
    address                 172.17.20.8
    check_command           check_ncpa!-t 'CMPublic' -P 5693 -M system/agent_version
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    contacts                admins
    notification_interval   60
    notification_period     24x7
    notifications_enabled   1
    icon_image              ncpa.png
    statusmap_image         ncpa.png
    register                1
}
to this

Code: Select all

define host {
    host_name               Svr-ome
    address                 172.17.20.8
    check_command           check_ncpa!-t 'CMPublic' -P 5693 -M system/agent_version
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    contact_groups                admins
    notification_interval   60
    notification_period     24x7
    notifications_enabled   1
    icon_image              ncpa.png
    statusmap_image         ncpa.png
    register                1
}
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: Can I use different email addresses for different types

Post by Alan »

That worked great thanks. I now have emails going to several people and different alerts going to different people,
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Can I use different email addresses for different types

Post by scottwilkerson »

Alan wrote:That worked great thanks. I now have emails going to several people and different alerts going to different people,
perfect!
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked