Score:0

Mass acknowledging alert in NAGIOS

fr flag

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

Score:0
jp flag

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

Regards, Kamal

Paul avatar
cn flag
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).
Score:0
in flag

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).

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.