Bulk updates to services


#1

Hi All,

5 services on 10 hosts - so 50 services that are have notifications disabled. Don’t ask why \ who did this, but I’m trying to find a quick and easy way to re-enable all of them.

Where is this information stored?

Thanks
Warrick


#2

Don’t know where the state is stored or whether it is modifiable by simply, say, editing a file (I think it would be unlikely) but a couple of ideas on how to achieve your end goal would be…

  1. Modify the service template(s) which your services inherit to put all the services in one service group. You can then enable all service notifications for the entire group through the GUI in one hit

  2. Enable external command checking (see nagios.sourceforge.net/docs/3_0/extcommands.html) and do a big push of ENABLE_SVC_NOTIFICATIONS commands for all your services into your command file…

HTH

/S


#3
  1. using a finely written sed -e command (or vi -c) to edit all your cfg files in one go :wink:
    (that’s what I’d do)

#4

So nobody knows where the status info is stored?


#5

Very well then, It’s stored in status.dat & retention.dat as “notifications_enabled=[0 or 1]” for each host and service - making changes to these files is not a good idea
for instance, if it was me, I would use one of the previous ideas… I would **definatley not **

[list]first make sure I had a decent backup[/list:u]
[list]ensure I had “retain_state_information=1” in my main configuration file (to ensure it would load up retention.dat as it’s working values when nagios is started)[/list:u]
[list]then stop nagios and edit all the notifications_enabled parameters to make them 1[/list:u]
[list]then finally restart nagios.[/list:u]

No sir, you won’t find me remotely considering that as a course of action. Who knows how it might turn out. Not to mention the big scary warnings at the top of the files…

########################################
#          NAGIOS STATUS FILE
#
# THIS FILE IS AUTOMATICALLY GENERATED
# BY NAGIOS.  DO NOT MODIFY THIS FILE!
########################################

########################################
#      NAGIOS STATE RETENTION FILE
#
# THIS FILE IS AUTOMATICALLY GENERATED
# BY NAGIOS.  DO NOT MODIFY THIS FILE!
########################################

:o


#6

Thanks. I now I see why you were a little hesitant to share the info. I’ll go with one of the earlier suggestions. It is good to know where this info is stored though - rather a unique format, but easy to read for a change so I certainly won’t complain.


#7

Delete status.dat and retention.dat if you want. It will just clear all your host/service downtimes & comments and status.
Stop nagios, delete those dat files, then start nagios again.
All your checks will turn into “Pending” and nagios will start populating status.dat again. no biggie, won’t break stuff, you just temporarily lose status info and you have ot re-set downtimes and whatnot.