0

Good evening to all!

I was wondering around to find solution of mass acknowledging the alerts all at once for 500+ service notification in Nagios. After a long hardship, I came across building below script own. Please help in analyzing pros and cons or if another best alternative available to it.

#!/bin/sh

for name in $(cat list.txt)
do
    domainname=$name
    now=`date +%s`
    command="/var/spool/nagios/cmd/nagios.cmd"
    service=blacklist-check

    #The show begins
    /usr/bin/printf "[%lu] ACKNOWLEDGE_SVC_PROBLEM;$domainname;$service;2;1;1;mail_it;Should be de-listed in 1 week till 18 Nov, 2021.\n" $now >> $command
    echo "$name ACKNOWLEDGED! "

done
echo "ALL COMPLETED"

Early reply will be appreciable.

Thanking You

Regards, Nishi

Lacek
  • 7,233
  • 24
  • 28

2 Answers2

0

Please provide the Nagios version you are using and as well is it opensource or Nagios X1.

Regards, Kamal

  • Welcome to Server Fault! Your answer currently does not seem to provide a workable solution to the question and might be more appropriate as a comment. Please read [How do I write a good answer?](http://serverfault.com/help/how-to-answer) and consider revising or deleting your current answer. And don't forget to take the [site tour](http://serverfault.com/tour). – Paul Nov 15 '21 at 16:55
0

This script will work, as it is basically the same as clicking through all the services on a web interface, acknowledging them one by one.

However, there is on thing you should consider. The command file (nagios.cmd) is a named pipe, and as such, has a limited buffer in which commands can be stored. Depending on how many commands you want to issue at one time, you might want to set external_command_buffer_slots and / or command_check_interval appropriately (see Nagios configuration docs for more info).

Lacek
  • 7,233
  • 24
  • 28