+ Reply to Thread
Results 1 to 7 of 7

Thread: Quick Nagios Problem

  Share/Bookmark
  1. #1

    Reputation
    DanW's Avatar
    Join Date
    Oct 2007
    Posts
    223
    Thank Post
    34
    Thanked 9 Times in 9 Posts
    Rep Power
    8

    Default Quick Nagios Problem

    Checking my config file and i'm getting the following two errors...


    Code:
    Error: Service notification command 'notify-by-email' specified for contact 'nagios' is not defined anywhere!
    
    Error: Host notification command 'host-notify-by-email' specified for contact 'nagios' is not defined anywhere!
    

    where do i specify these options as i can't see anything in the documentation.....


    Dan

  2. #2

    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation
    rush_tech's Avatar
    Join Date
    Jul 2006
    Location
    Nottingham
    Posts
    962
    Thank Post
    73
    Thanked 185 Times in 131 Posts
    Rep Power
    45

    Default

    Quote Originally Posted by DanW View Post
    Checking my config file and i'm getting the following two errors...


    Code:
    Error: Service notification command 'notify-by-email' specified for contact 'nagios' is not defined anywhere!
    
    Error: Host notification command 'host-notify-by-email' specified for contact 'nagios' is not defined anywhere!
    
    where do i specify these options as i can't see anything in the documentation.....


    Dan
    Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.
    nano /usr/local/nagios/etc/objects/contacts.cfg

  3. #3

    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation
    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    10,833
    Blog Entries
    1
    Thank Post
    97
    Thanked 392 Times in 337 Posts
    Rep Power
    101

    Default

    I have the following in my commands.cfg

    Code:
    # 'host-notify-by-email' command definition
    define command{
            command_name    host-notify-by-email
            command_line    /usr/bin/printf "%b" "***** Nagios 2.6 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
            }
    
    
    # 'notify-by-email' command definition
    define command{
            command_name    notify-by-email
            command_line    /usr/bin/printf "%b" "***** Nagios 2.6 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "* *$NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
            }
    
    They appear to be installation defaults.

  4. #4

    Reputation
    DanW's Avatar
    Join Date
    Oct 2007
    Posts
    223
    Thank Post
    34
    Thanked 9 Times in 9 Posts
    Rep Power
    8

    Default

    Quote Originally Posted by rush_tech View Post
    Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.
    nano /usr/local/nagios/etc/objects/contacts.cfg
    I already did that


    Quote Originally Posted by Geoff View Post
    I have the following in my commands.cfg

    Code:
    # 'host-notify-by-email' command definition
    define command{
            command_name    host-notify-by-email
            command_line    /usr/bin/printf "%b" "***** Nagios 2.6 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
            }
    
    
    # 'notify-by-email' command definition
    define command{
            command_name    notify-by-email
            command_line    /usr/bin/printf "%b" "***** Nagios 2.6 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "* *$NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
            }
    
    They appear to be installation defaults.

    Geoff - yours command.cfg seems to give me errors ...

    Code:
    Nagios 3.0.1
    Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
    Last Modified: 04-01-2008
    License: GPL
    
    Reading configuration data...
    
    Error: Invalid command object directive 'Address:'.
    Error: Could not add object property in file '/usr/local/nagios/etc/objects/commands.cfg' on line 38.
    
    ***> One or more problems was encountered while processing the config files...
    
         Check your configuration file(s) to ensure that they contain valid
         directives and data defintions.  If you are upgrading from a previous
         version of Nagios, you should be aware that some variables/definitions
         may have been removed or modified in this version.  Make sure to read
         the HTML documentation regarding the config files, as well as the
         'Whats New' section to find out what has changed.
    

  5. #5

    Reputation
    Reputation Reputation Reputation Reputation Reputation Reputation
    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    7,612
    Thank Post
    90
    Thanked 619 Times in 477 Posts
    Rep Power
    143

    Default

    What is on line 38 of that file?

  6. #6

    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation
    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    10,833
    Blog Entries
    1
    Thank Post
    97
    Thanked 392 Times in 337 Posts
    Rep Power
    101

    Default

    I'm using nagios 2.6. You are using nagios 3.01. I suspect the command definitions differ.

  7. #7

    Reputation
    DanW's Avatar
    Join Date
    Oct 2007
    Posts
    223
    Thank Post
    34
    Thanked 9 Times in 9 Posts
    Rep Power
    8

    Default

    Think i've solved the problem .... was a classic case of PEBKAC ....

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Nagios - MRTG
    By rush_tech in forum *nix
    Replies: 5
    Last Post: 13-07-2010, 04:27 PM
  2. Replies: 51
    Last Post: 10-11-2009, 05:23 AM
  3. Nagios Problems
    By DanW in forum *nix
    Replies: 5
    Last Post: 07-05-2008, 01:56 PM
  4. nagios error
    By dezt in forum *nix
    Replies: 13
    Last Post: 13-03-2008, 02:02 PM
  5. Nagios Problem
    By sqdge in forum *nix
    Replies: 10
    Last Post: 25-04-2007, 09:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts