Page 1 of 1

delete all CCM entries

Posted: Tue Jun 23, 2015 5:37 pm
by kendallchenoweth
Because I'm will be only the contents of the /usr/local/nagios/etc/static directory data content within a production instance of Nagios XI, I need to delete everything from the CCM. I did this once successfully, but I'm unable to recreate that effort now. What's the best way to delete everything from the CCM? I've clicked on delete for everything and deleted everything from the from the /usr/local/nagios/etc/static, but the static contents always come back along with references to some of the CCM entries references in the error. I also see these files in /usr/local/nagios/etc/cfgprep.

Since I've done this on one server, can I create an archive on that server and import into the other server? If so, how?

Thanks in advance!

Re: delete all CCM entries

Posted: Tue Jun 23, 2015 6:49 pm
by Box293
There has to be at least something defined for nagios to verify, hence this is why it comes with a localhost host and services. If you are deleting everything in CCM and static, then the verify will fail.
kendallchenoweth wrote:but the static contents always come back along with references to some of the CCM entries references in the error.
So whenever there is a problem applying config, everything is put back as it was before apply config was done.

As a rule of thumb, in CCM:
De-activate all dependencies and escalations and apply config.
De-activate all services and apply config.
De-activate the hosts and apply config.
If all is working OK then delete the objects.

Re: delete all CCM entries

Posted: Tue Jun 23, 2015 8:47 pm
by kendallchenoweth
Got it. Thanks. For anybody else reading this, I've attached a minimal cfg.

Code: Select all

define command {
       command_name                             check_dummy
       command_line                             $USER1$/check_dummy 0
}

define command {
       command_name                             xi_host_event_handler
       command_line                             /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore
_notification.php --notification-type=host --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --typ
e=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$
NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdi
splayname="$HOSTDISPLAYNAME$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --lasthoststate=$LASTHOS
TSTATE$ --lasthoststateid=$LASTHOSTSTATEID$ --hoststatetype=$HOSTSTATETYPE$ --currentattempt=$HOSTATTEMPT$
 --maxattempts=$MAXHOSTATTEMPTS$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --hostoutput=
"$HOSTOUTPUT$" --longhostoutput="$LONGHOSTOUTPUT$" --datetime="$LONGDATETIME$"
}

define command {
       command_name                             xi_service_event_handler
       command_line                             /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore
_notification.php --notification-type=service --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --
type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments
="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hos
tdisplayname="$HOSTDISPLAYNAME$" --service="$SERVICEDESC$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTAT
EID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$
 --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICE
ATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEP
ROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$" --datetime="$LONGDAT
ETIME$"
}


define contact {
        contact_name                            dummy
        alias                                   dummy
        host_notifications_enabled              0
        service_notifications_enabled           0
        host_notification_period                dummy
        service_notification_period             dummy
        host_notification_commands              xi_host_event_handler
        service_notification_commands           xi_service_event_handler
        email                                   [email protected]
        }


define service {
        host_name                       dummy
        service_description             dummy
        check_command                   check_dummy!!!!!!!!
        max_check_attempts              1
        check_interval                  5
        retry_interval                  5
        check_period                    dummy
        register                        1
        }


define host {
        host_name                       dummy
        alias                           dummy
        address                         127.0.0.1
        max_check_attempts              1
        check_interval                  5
        retry_interval                  5
        check_period                    dummy
        notification_period             dummy
        notifications_enabled           0
        _instance                       ah
        register                        1
        }


define timeperiod {
        timeperiod_name                         dummy
        alias                                   dummy
        monday                                  00:00-24:00
        }

Re: delete all CCM entries

Posted: Wed Jun 24, 2015 8:35 am
by tmcdonald
Mind if I lock this up then?

Re: delete all CCM entries

Posted: Wed Jun 24, 2015 10:44 pm
by kendallchenoweth
Lock it up! Thanks for your help!