Hi ,
How do i remove the pending service that are not associated with any host/service?
It only show in XI and not in Core.
XI View
Nagios Core View.
Its been there for quite sometimes.
Thanks,
Safuan
Remove Pending service.
-
safuanmansor
- Posts: 59
- Joined: Mon Jul 16, 2018 9:16 pm
Remove Pending service.
You do not have the required permissions to view the files attached to this post.
Re: Remove Pending service.
Hello @safuanmansor
Thanks for reaching out, I see an earlier post that outlines which I went ahead blatantly copied from.
following as root to clear the message queue.
You will also, have to run the following in a root shell to stop, truncate old data and start the processes. If you are using ndo2db please go ahead and refer to the instructions found here.
Depending if your server is hosting the nagiosxi database in MYSQL, you would run this.
If it is Postgress, run this
FYI, you can run them both if you are unsure, just one of the commands will generate an error and that is normal.
let us know how things look,
Perry
Thanks for reaching out, I see an earlier post that outlines which I went ahead blatantly copied from.
following as root to clear the message queue.
Code: Select all
postsuper -d ALLCode: Select all
service npcd stop
service nagios stop
service crond stop
pkill -9 -u nagiosCode: Select all
echo "truncate table xi_events; truncate table xi_meta; truncate table xi_eventqueue;" | mysql -u root -pnagiosxi nagiosxiCode: Select all
echo "truncate table xi_events; truncate table xi_meta; truncate table xi_eventqueue;" | psql nagiosxi nagiosxiCode: Select all
/usr/local/nagiosxi/scripts/repair_databases.sh
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 /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
service httpd restart ## or systemctl start apache2 depending on distro
service nagios start
service npcd start
service crond startPerry
Re: Remove Pending service.
Hello @safuanmanor
Please also run through the following to truncate the service status too:
Thanks,
Perry
Please also run through the following to truncate the service status too:
Code: Select all
echo 'truncate nagios_hoststatus; truncate nagios_hosts; truncate nagios_services; truncate nagios_servicestatus;' |mysql -u root -pnagiosxi nagiosPerry
-
safuanmansor
- Posts: 59
- Joined: Mon Jul 16, 2018 9:16 pm
Re: Remove Pending service.
Hi Perry
The long list step is meant for removing Notifications. Appreciate if you can pinpoint the only required command to remove the faulty services.
Is it safe to just leave those tables blank after truncate it?
Thanks,
Safuan
The long list step is meant for removing Notifications. Appreciate if you can pinpoint the only required command to remove the faulty services.
Is it safe to just leave those tables blank after truncate it?
Thanks,
Safuan
Re: Remove Pending service.
Hello @safuanmansor
Thanks for following up; you are correct that we don't need to concern with the message queue since that is not directly associated with the issue. To focus on the problem.
The issue is that there are "old leftover" data in the nagios database for those four tables, and they need to be truncated and the nagios process restarted so they will be repopulated when written to with up to date data.
First, let's make a backup of the database before truncating:
To truncate the four tables:
Then restart the nagios service to sync/re-write to database:
Please PM your updated system profile if the issue persists.
To send us your system profile.
Perry
Thanks for following up; you are correct that we don't need to concern with the message queue since that is not directly associated with the issue. To focus on the problem.
The issue is that there are "old leftover" data in the nagios database for those four tables, and they need to be truncated and the nagios process restarted so they will be repopulated when written to with up to date data.
First, let's make a backup of the database before truncating:
Code: Select all
mysqldump -uroot -pnagiosxi --all-databases | gzip -c > /tmp/nagios-databases.sql.gzCode: Select all
echo 'truncate nagios_hoststatus; truncate nagios_hosts; truncate nagios_services; truncate nagios_servicestatus;' |mysql -u root -pnagiosxi nagiosCode: Select all
systemctl restart nagiosTo send us your system profile.
- Login to the Nagios XI GUI using a web browser.
- Click the "Admin" > "System Profile" Menu
- Click the "Download Profile" button
- Save the profile.zip file and send via Private Message
Perry