Page 1 of 1

how to clear pending Notification

Posted: Mon Jan 04, 2021 5:07 am
by zaji_nms
Dear Expert

Wishing you all HAPPY NEW YEAR and all the best during these days.

Nagios Server was up and running however some reachability issue occurred (assume main Gateway Router/Switch) was down.

Now when Nagios came UP its started sending old accumulated pending Notification in bulk, how to clear those from Nagios server?

Regards

Re: how to clear pending Notification

Posted: Mon Jan 04, 2021 4:24 pm
by tgriep
If you login to the XI interface and go to the Admin > Email Settings menu and is the Mail Method is set to Sendmail, you would run the following as root to clear the message queue.

Code: Select all

postsuper -d ALL

You will also, have to run the following in a root shell to stop, truncate old data and start the processes.

Code: Select all

service npcd stop
service nagios stop
service ndo2db stop
service crond stop
pkill -9 -u nagios
Depending if your server is hosting the nagiosxi database in MYSQL, you would run this.

Code: Select all

echo "truncate table xi_events; truncate table xi_meta; truncate table xi_eventqueue;" | mysql -u root -pnagiosxi nagiosxi
If it is Postgress, run this

Code: Select all

echo "truncate table xi_events; truncate table xi_meta; truncate table xi_eventqueue;" | psql nagiosxi nagiosxi
FYI, you can run them both if you are unsure, just one of the commands will generate an error and that is normal.

Code: Select all

mysqlcheck -f -r -u root -pnagiosxi --all-databases --use-frm
if grep --quiet pgsql /usr/local/nagiosxi/html/config.inc.php; then service postgresql stop; fi;
service mysqld restart
rm -f /usr/local/nagios/var/rw/nagios.cmd
rm -f /usr/local/nagios/var/nagios.lock
rm -f /var/run/nagios.lock
rm -f /usr/local/nagios/var/ndo.sock
rm -f /usr/local/nagios/var/ndo2db.lock
rm -f /var/lib/mrtg/mrtg_l
rm -f /usr/local/nagiosxi/var/*.lock
rm -f /usr/local/nagiosxi/tmp/*.lock
for i in `ipcs -q | grep nagios |awk '{print $2}'`; do ipcrm -q $i; done
pkill python
if grep --quiet pgsql /usr/local/nagiosxi/html/config.inc.php; then service postgresql start; fi;
service httpd restart
service ndo2db start
service nagios start
service npcd start
service crond start
All of the old pending Notifications should be gone now.

Re: how to clear pending Notification

Posted: Tue Jan 05, 2021 5:52 am
by zaji_nms
Thanks tgriep for detail reply,

NagiosXI having Feature to Enable/Disable NOTIFICATIONS, same way ...

i suggest to have WEB Feature to truncate/delete all pending Email/Notifications, easy and safe.

should have Feature Request....as we want better NagiosXI in future.

Regards

Re: how to clear pending Notification

Posted: Tue Jan 05, 2021 10:16 am
by tgriep
That is a good idea to add the ability to remove queued up notifications in the web interface.
I can submit a feature request on your behalf if you'd like. Please keep in mind that the decision to implement the enhancement is at the sole discretion of our development team.

Re: how to clear pending Notification

Posted: Wed Jan 06, 2021 3:50 am
by zaji_nms
Yes tgriep

Please submit new Feature Request

everything should be on fingertip (here away only one/two mouse click)

regards

Re: how to clear pending Notification

Posted: Wed Jan 06, 2021 10:27 am
by tgriep
A Feature Request has been put in for this.