Errors adding and removing hosts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
JohnF
Posts: 15
Joined: Thu Oct 19, 2017 5:45 pm

Re: Errors adding and removing hosts

Post by JohnF »

[jfonseca@ussecis021 ~]$ cat /etc/init.d/nagios

Code: Select all

#!/bin/sh
#
# chkconfig: 345 99 01
# description: Nagios network monitor
#
# File : nagios
#
# Author : Jorge Sanchez Aymar ([email protected])
#
# Changelog :
#
# 1999-07-09 Karl DeBisschop <[email protected]>
#  - setup for autoconf
#  - add reload function
# 1999-08-06 Ethan Galstad <[email protected]>
#  - Added configuration info for use with RedHat's chkconfig tool
#    per Fran Boon's suggestion
# 1999-08-13 Jim Popovitch <[email protected]>
#  - added variable for nagios/var directory
#  - cd into nagios/var directory before creating tmp files on startup
# 1999-08-16 Ethan Galstad <[email protected]>
#  - Added test for rc.d directory as suggested by Karl DeBisschop
# 2000-07-23 Karl DeBisschop <[email protected]>
#  - Clean out redhat macros and other dependencies
# 2003-01-11 Ethan Galstad <[email protected]>
#  - Updated su syntax (Gary Miller)
#
# Description: Starts and stops the Nagios monitor
#              used to provide network services status.
#

mkdir -p -m 775 /var/nagiosramdisk
mkdir -p -m 775 /var/nagiosramdisk/tmp
mkdir -p -m 775 /var/nagiosramdisk/spool
mkdir -p -m 775 /var/nagiosramdisk/checkresults
chown -R nagios.nagios /var/nagiosramdisk



status_nagios ()
{

        if test -x $NagiosCGI/daemonchk.cgi; then
                if $NagiosCGI/daemonchk.cgi -l $NagiosRunFile; then
                        return 0
                else
                        return 1
                fi
        else
                if ps -p $NagiosPID > /dev/null 2>&1; then
                        return 0
                else
                        return 1
                fi
        fi

        return 1
}


printstatus_nagios()
{

        if status_nagios $1 $2; then
                echo "nagios (pid $NagiosPID) is running..."
        else
                echo "nagios is not running"
        fi
}


killproc_nagios ()
{

        kill $2 $NagiosPID

}


pid_nagios ()
{

        if test ! -f $NagiosRunFile; then
                echo "No lock file found in $NagiosRunFile"
                exit 1
        fi

        NagiosPID=`head -n 1 $NagiosRunFile`
}


# Source function library
# Solaris doesn't have an rc.d directory, so do a test first
if [ -f /etc/rc.d/init.d/functions ]; then
        . /etc/rc.d/init.d/functions
elif [ -f /etc/init.d/functions ]; then
        . /etc/init.d/functions
fi

prefix=/usr/local/nagios
exec_prefix=${prefix}
NagiosBin=${exec_prefix}/bin/nagios
NagiosCfgFile=${prefix}/etc/nagios.cfg
NagiosStatusFile=${prefix}/var/status.dat
NagiosRetentionFile=${prefix}/var/retention.dat
NagiosCommandFile=${prefix}/var/rw/nagios.cmd
NagiosVarDir=${prefix}/var
NagiosRunFile=${prefix}/var/nagios.lock
#NagiosLockDir=/var/lock/subsys
NagiosLockDir=/usr/local/nagiosxi/var/subsys
NagiosLockFile=nagios
NagiosCGIDir=${exec_prefix}/sbin
NagiosUser=nagios
NagiosGroup=nagios


# Check that nagios exists.
if [ ! -f $NagiosBin ]; then
    echo "Executable file $NagiosBin not found.  Exiting."
    exit 1
fi

# Check that nagios.cfg exists.
if [ ! -f $NagiosCfgFile ]; then
    echo "Configuration file $NagiosCfgFile not found.  Exiting."
    exit 1
fi

# See how we were called.
case "$1" in

        start)
                echo -n "Starting nagios:"
                $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
                if [ $? -eq 0 ]; then
# THESE TWO LINES WERE ADDED TO WORK WITH SUDO
                        touch $NagiosVarDir/nagios.log $NagiosRetentionFile
                        chown $NagiosUser $NagiosVarDir/nagios.log $NagiosRetentionFile
#                       su - $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"
                        rm -f $NagiosCommandFile
                        touch $NagiosRunFile
                        chown $NagiosUser:$NagiosGroup $NagiosRunFile
                        $NagiosBin -d $NagiosCfgFile
                        if [ -d $NagiosLockDir ]; then
                            touch $NagiosLockDir/$NagiosLockFile;
                            chown $NagiosUser:$NagiosGroup $NagiosLockDir/$NagiosLockFile;
                        fi
                        echo " done."
                        exit 0
                else
                        echo "CONFIG ERROR!  Start aborted.  Check your Nagios configuration."
                        exit 1
                fi
                ;;

        stop)
                echo -n "Stopping nagios: "

                pid_nagios
                killproc_nagios nagios

                # now we have to wait for nagios to exit and remove its
                # own NagiosRunFile, otherwise a following "start" could
                # happen, and then the exiting nagios will remove the
                # new NagiosRunFile, allowing multiple nagios daemons
                # to (sooner or later) run - John Sellens
                #echo -n 'Waiting for nagios to exit .'
                for i in 1 2 3 4 5 6 7 8 9 10 ; do
                    if status_nagios > /dev/null; then
                        echo -n '.'
                        sleep 1
                    else
                        break
                    fi
                done

                if status_nagios > /dev/null; then
                    echo ''
                    echo 'Warning - nagios did not exit in a timely manner'
                else

                    # Forcefully kill all other nagios processes that might be running, so we don't end up with a wierd setup

                    # Get a list of PIDs for all running Nagios daemons
                    plist=`ps axuw | grep "/usr/local/nagios/bin/nagios -d"  | awk '{print $2}'`
                    #echo "PIDS"
                    #echo $plist
                    for pid in $plist; do
                        #echo "KILL $pid"
                        kill -9 $pid > /dev/null 2>&1
                    done

                    echo 'done.'
                fi

                rm -f $NagiosStatusFile $NagiosRunFile $NagiosLockDir/$NagiosLockFile $NagiosCommandFile
                ;;

        status)
                pid_nagios
                printstatus_nagios nagios
                ;;

        checkconfig)
                printf "Running configuration check..."
                $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
                if [ $? -eq 0 ]; then
                        echo " OK."
                else
                        echo " CONFIG ERROR!  Check your Nagios configuration."
                        exit 1
                fi
                ;;

        restart)
                printf "Running configuration check..."
                $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
                if [ $? -eq 0 ]; then
                        echo "done."
                        $0 stop
                        $0 start
                else
                        echo " CONFIG ERROR!  Restart aborted.  Check your Nagios configuration."
                        exit 1
                fi
                ;;

        reload|force-reload)
                printf "Running configuration check..."
                $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
                if [ $? -eq 0 ]; then
                        echo "done."
                        if test ! -f $NagiosRunFile; then
                                $0 start
                        else
                                pid_nagios
                                if status_nagios > /dev/null; then
                                        printf "Reloading nagios configuration..."
                                        killproc_nagios nagios -HUP
                                        echo "done"
                                else
                                        $0 stop
                                        $0 start
                                fi
                        fi
                else
                        echo " CONFIG ERROR!  Reload aborted.  Check your Nagios configuration."
                        exit 1
                fi
                ;;

        *)
                echo "Usage: nagios {start|stop|restart|reload|force-reload|status|checkconfig}"
                exit 1
                ;;

esac

# End of this script
[jfonseca@ussecis021 ~]$
1st Go.PNG
You do not have the required permissions to view the files attached to this post.
JohnF
Posts: 15
Joined: Thu Oct 19, 2017 5:45 pm

Re: Errors adding and removing hosts

Post by JohnF »

2nd Go.PNG
You do not have the required permissions to view the files attached to this post.
JohnF
Posts: 15
Joined: Thu Oct 19, 2017 5:45 pm

Re: Errors adding and removing hosts

Post by JohnF »

3rd Go.PNG
You do not have the required permissions to view the files attached to this post.
JohnF
Posts: 15
Joined: Thu Oct 19, 2017 5:45 pm

Re: Errors adding and removing hosts

Post by JohnF »

4th Go.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Errors adding and removing hosts

Post by lmiltchev »

You have a configuration error. There is something wrong in the contacts config. Go back to the CCM > Tools > Write Config Files, and click on the first 2 "Go" buttons ("Write monitoring data" and "Write additional data"). Don't click on more buttons and don't apply configuration. Open a ssh terminal to your Nagios XI server, run the following command and show the output in code wraps:

Code: Select all

cat /usr/local/nagios/etc/contacts.cfg
Note: Instead of "catting" the file, you could use a FTP program, e.g. FileZilla, to transfer the file to your workstation, and then uploade it to the forum. We need to review the contacts config for errors/wrong syntax, etc. If we cannot determine what the issue is, we will need to move this to a support ticket.
Be sure to check out our Knowledgebase for helpful articles and solutions!
JohnF
Posts: 15
Joined: Thu Oct 19, 2017 5:45 pm

Re: Errors adding and removing hosts

Post by JohnF »

Code: Select all

[jfonseca@ussecis021 ~]$ cat /usr/local/nagios/etc/contacts.cfg
###############################################################################
#
# Contact configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:       2019-01-31 16:51:41
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define contact {
        contact_name                            aamaltov
        alias                                   Aimee Amaltov
        host_notification_period                aamaltov_notification_times
        service_notification_period             aamaltov_notification_times
        host_notification_options               d,u,r,s
        service_notification_options            w,u,c,r,s
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            agonzalez
        alias                                   Angel Gonzalez Torres
        host_notification_period                agonzalez_notification_times
        service_notification_period             agonzalez_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            aluzuriaga
        alias                                   Adriel.Luzuriaga
        host_notification_period                aluzuriaga_notification_times
        service_notification_period             aluzuriaga_notification_times
        host_notification_options               d,u,r,s
        service_notification_options            w,u,c,r,s
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            apontidis
        alias                                   Alex Pontidis
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            atrouchin
        alias                                   Anton Trouchin
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            avelazquez
        alias                                   Adolfo Velazquez
        host_notification_period                avelazquez_notification_times
        service_notification_period             avelazquez_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            awerr
        alias                                   andy.werr
        host_notification_period                awerr_notification_times
        service_notification_period             awerr_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            barbara
        alias                                   Barbara Seehausen
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            bb
        alias                                   Tim's Blackberry
        host_notification_period                24x7
        service_notification_period             24x7
        host_notification_options               d,u,r
        service_notification_options            w,u,c,f
        host_notification_commands              notify-by-sms
        service_notification_commands           notify-by-sms
        email                                   [email protected]
        }

define contact {
        contact_name                            blord
        alias                                   Bryan Lord
        host_notification_period                blord_notification_times
        service_notification_period             blord_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            ccuccolo
        alias                                   Carmen.Cuccolo
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            cgeneric
        alias                                   Command Center Generic
        host_notification_period                cgeneric_notification_times
        service_notification_period             cgeneric_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            cgottlieb
        alias                                   Christine Gottlieb
        host_notification_period                cgottlieb_notification_times
        service_notification_period             cgottlieb_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            cmartin
        alias                                   Celia Martin
        contactgroups                           Network Engineers
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                cmartin_notification_times
        service_notification_period             cmartin_notification_times
        host_notification_options               d,u
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            cmartinez
        alias                                   Carlos Martinez
        host_notification_period                cmartinez_notification_times
        service_notification_period             cmartinez_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            commandcenter
        alias                                   Command Center
        host_notification_period                commandcenter_notification_times
        service_notification_period             commandcenter_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            dcarpio
        alias                                   david.carpio
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                dcarpio_notification_times
        service_notification_period             dcarpio_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            ebedell
        alias                                   Eric Bedell
        host_notification_period                ebedell_notification_times
        service_notification_period             ebedell_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            emartinez
        alias                                   Edwin Martinez
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            evega
        alias                                   Ed Vega
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            falfano
        alias                                   Frank Alfano
        use                                     generic-contact
        }

define contact {
        contact_name                            galo
        alias                                   Galo Gan
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            Helpdesk - Reliant
        alias                                   Reliant Helpdesk
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            hfidler
        alias                                   Henrietta Fidler
        email                                   Henrietta [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            hkilari
        alias                                   Harsha Kilari
        host_notification_period                hkilari_notification_times
        service_notification_period             hkilari_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            irimskaya
        alias                                   Irina Rimskaya
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                24x7
        service_notification_period             24x7
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        host_notification_commands              notify-host-by-email
        service_notification_commands           notify-service-by-email
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            jallen
        alias                                   Jennifer Allen
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            jcaldwell
        alias                                   James Caldwell
        host_notification_period                jcaldwell_notification_times
        service_notification_period             jcaldwell_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            jfonseca
        alias                                   Juan Fonseca
        host_notification_period                jfonseca_notification_times
        service_notification_period             jfonseca_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            jgalicia
        alias                                   Juan Galicia
        host_notification_period                jgalicia_notification_times
        service_notification_period             jgalicia_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            jhill
        alias                                   Joshua Hill
        host_notification_period                jhill_notification_times
        service_notification_period             jhill_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            jhui
        alias                                   Jimmy Hui
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            jmendes
        alias                                   Joseph Mendes
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            jmercado
        alias                                   Juan Mercado
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            jmondesir
        alias                                   Jean Mondesir
        host_notification_period                jmondesir_notification_times
        service_notification_period             jmondesir_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            jreedy
        alias                                   Joe Reedy
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            khurtado
        alias                                   Kaleb Hurtado
        host_notification_period                khurtado_notification_times
        service_notification_period             khurtado_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            kkumar
        alias                                   Karthic Kumar
        host_notification_period                kkumar_notification_times
        service_notification_period             kkumar_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   karthik,[email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            kmacha
        alias                                   Kishore Macha
        host_notification_period                kmacha_notification_times
        service_notification_period             kmacha_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            lrojas
        alias                                   Leonardo Rojas
        host_notification_period                lrojas_notification_times
        service_notification_period             lrojas_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            lsantillan
        alias                                   Luis Felipe Santillan Mondragon
        host_notification_period                lsantillan_notification_times
        service_notification_period             lsantillan_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            lsmith
        alias                                   Lenworth Smith
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            lszikszai
        alias                                   Laszlo Szikszai
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            lweglarz
        alias                                   Larraine Weglarz
        host_notification_period                lweglarz_notification_times
        service_notification_period             lweglarz_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            mbareno
        alias                                   Miguel Bareno
        host_notification_period                mbareno_notification_times
        service_notification_period             mbareno_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            mcorona
        alias                                   miguel corona
        host_notification_period                mcorona_notification_times
        service_notification_period             mcorona_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            mdeoliveira
        alias                                   Maritza De Oliveira
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            mdilauro
        alias                                   Massimo.Di Lauro
        host_notification_period                mdilauro_notification_times
        service_notification_period             mdilauro_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            mdizon
        alias                                   Mike Dizon
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            mhenderson
        alias                                   Michael Henderson
        host_notification_period                mhenderson_notification_times
        service_notification_period             mhenderson_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            mhornstein
        alias                                   Michael Hornstein
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            mmartinez
        alias                                   Marlon Martinez
        host_notification_period                mmartinez_notification_times
        service_notification_period             mmartinez_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            mrosenberg
        alias                                   Mike Rosenberg
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            mtablado
        alias                                   Manny Tablado
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            mtarabokija
        alias                                   Matt Tarabokija
        use                                     generic-contact
        }

define contact {
        contact_name                            nagiosadmin
        alias                                   Nagios Administrator
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                nagiosadmin_notification_times
        service_notification_period             nagiosadmin_notification_times
        host_notification_options               d,u,r
        service_notification_options            w,r,f
        host_notification_commands              xi_host_notification_handler
        service_notification_commands           xi_service_notification_handler
        email                                   nagios@localhost
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            nrodriguez
        alias                                   Nelson Rodriguez
        host_notification_period                nrodriguez_notification_times
        service_notification_period             nrodriguez_notification_times
        host_notification_options               d,u,r,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            pdressner
        alias                                   Phil Dressner
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            pmahashur
        alias                                   Priyanka Mahashur
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            pmannarino
        alias                                   Peter Mannarino
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            pstead
        alias                                   Phil Stead
        host_notification_period                pstead_notification_times
        service_notification_period             pstead_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            ran
        alias                                   Ruihai.An
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            rdelise
        alias                                   Robert Delise
        host_notification_period                rdelise_notification_times
        service_notification_period             rdelise_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            redwards
        alias                                   Rodney Edwards
        host_notification_period                redwards_notification_times
        service_notification_period             redwards_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            rotero
        alias                                   Rafael Otero
        host_notification_period                rotero_notification_times
        service_notification_period             rotero_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            rpagano
        alias                                   ron.pagano
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            rrodriguez
        alias                                   Rodney Rodriguez
        use                                     generic-contact
        }

define contact {
        contact_name                            rthapa
        alias                                   Rochan Thapa
        host_notification_period                rthapa_notification_times
        service_notification_period             rthapa_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            rvillegas
        alias                                   Roberto Villegas
        host_notification_period                rvillegas_notification_times
        service_notification_period             rvillegas_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            sam
        alias                                   Sam Yin
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            sbaniel
        alias                                   Susan Baniel
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            skhanna
        alias                                   Sandeep Khanna
        host_notification_period                skhanna_notification_times
        service_notification_period             skhanna_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            smeehan
        alias                                   steve.meehan
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                smeehan_notification_times
        service_notification_period             smeehan_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            smeehantst
        alias                                   Steve Meehan
        host_notification_period                smeehantst_notification_times
        service_notification_period             smeehantst_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            SM_Test_Contact
        alias                                   For testing
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                24x7
        service_notification_period             24x7
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        host_notification_commands              xi_host_notification_handler
        service_notification_commands           xi_service_notification_handler
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        }

define contact {
        contact_name                            sservices
        alias                                   Support Services
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                Sservices_notification_times
        service_notification_period             Sservices_notification_times
        host_notification_options               d,u,r,s
        service_notification_options            w,u,c,r,f,s,n
        email                                   [email protected]
        use                                     xi_contact_generic,generic-contact
        }

define contact {
        contact_name                            tdemeri
        alias                                   Tom Demeri
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            tim
        alias                                   Tim Williams
        email                                   [email protected]
        use                                     generic-contact
        }

define contact {
        contact_name                            tstaruch
        alias                                   Todd Staruch
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                tstaruch_notification_times
        service_notification_period             tstaruch_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            usaoperations
        alias                                   US Operations
        host_notification_period                usaoperations_notification_times
        service_notification_period             usaoperations_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            vcastro
        alias                                   Viridiana Castro
        host_notification_period                vcastro_notification_times
        service_notification_period             vcastro_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        host_notifications_enabled              1
        service_notifications_enabled           1
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            xi_default_contact
        alias                                   Default Contact
        host_notification_period                xi_timeperiod_none
        service_notification_period             xi_timeperiod_none
        host_notification_options               n
        service_notification_options            n
        host_notification_commands              xi_host_notification_handler
        service_notification_commands           xi_service_notification_handler
        email                                   root@localhost
        }

###############################################################################
#
# Contact configuration file
#
# END OF FILE
#
###############################################################################
[jfonseca@ussecis021 ~]$
lmiltchev wrote:Note: Instead of "catting" the file, you could use a FTP program, e.g. FileZilla, to transfer the file to your workstation, and then uploade it to the forum. We need to review the contacts config for errors/wrong syntax, etc. If we cannot determine what the issue is, we will need to move this to a support ticket.
I am unsure how to do perform this step.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Errors adding and removing hosts

Post by lmiltchev »

You have the following contact defined in the contacts.cfg:

Code: Select all

define contact {
            contact_name                            xi_default_contact
            alias                                   Default Contact
            host_notification_period                xi_timeperiod_none
            service_notification_period             xi_timeperiod_none
            host_notification_options               n
            service_notification_options            n
            host_notification_commands              xi_host_notification_handler
            service_notification_commands           xi_service_notification_handler
            email                                   root@localhost
            }
Usually, this contact is defined in the static directory. It's possible that your configuration fails because the contact is defined in two places - in the database, and in the static. Check to see if xi_default_contact is present in the xiobjects.cfg file by running:

Code: Select all

grep 'xi_default_contact' /usr/local/nagios/etc/static/xiobjects.cfg
If you see:

Code: Select all

contact_name                    xi_default_contact
this means it's already defined in the static, and you need to remove the duplicate definition in the CCM.

Go to the CCM > Contacts, and delete the "xi_default_contact". Run the "Write Config Files" again, clicking on all "Go" buttons. The error about the contacts should be gone.
I am unsure how to do perform this step.
Log in the Nagios Support Center with your support forum credentials.

https://support.nagios.com/tickets/

Type something in the search bar, e.g. "configuration error", and click on "Continue".
example01.PNG
Scroll all the way down, and click on "Create Support Ticket".
example02.PNG
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
JohnF
Posts: 15
Joined: Thu Oct 19, 2017 5:45 pm

Re: Errors adding and removing hosts

Post by JohnF »

Got a new error.
Nagios new error.PNG
You do not have the required permissions to view the files attached to this post.
JohnF
Posts: 15
Joined: Thu Oct 19, 2017 5:45 pm

Re: Errors adding and removing hosts

Post by JohnF »

And we have a new problem.
Nagios Daemon.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Errors adding and removing hosts

Post by lmiltchev »

It is a similar error - the "xi_timeperiod_24x7" timeperiod is most probably defined in two places - the the database (CCM) and in the static directory. Check to see if you have it in static by running:

Code: Select all

grep 'xi_timeperiod_24x7' /usr/local/nagios/etc/static/xiobjects.cfg
If you have it, you will see:

Code: Select all

timeperiod_name xi_timeperiod_24x7
In order to remove the duplicate, go to the CCM > Alerting > Time Periods, and delete the "xi_timeperiod_24x7" timeperiod. Run the "Write Config Files" tool to check for more config errors. If there are no more errors, apply configuration.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked