Page 1 of 1
How to delete Nagios XI availability history data
Posted: Tue Jan 02, 2018 6:14 pm
by dyglys
Hi,
I am wondering if there is an update for the procedure to delete all availability history data.
https://support.nagios.com/forum/viewto ... 30&p=53110
The procedure above does not work for Nagios XI 5.4.11.
thx
Re: How to delete Nagios XI availability history data
Posted: Wed Jan 03, 2018 10:40 am
by dwhitfield
Is there a reason you want to do this? Are you running out of space? The instructions given in that thread do work, but it leaves out the db portion.
In the nagios db, there is a nagios_statehistory table. I'm intentionally not giving you instructions for truncating that table because once it's gone, it's gone. There's also nagios_logentries in that db.
Re: How to delete Nagios XI availability history data
Posted: Thu Jan 04, 2018 2:07 am
by dyglys
Hi,
The playaround and configuration generate a lot of Alerts.
It is reasonable to reset counters for the instance having put into the production environment.
Please send the procedure to my personal email if it is not intended to publish public.
Thank you.
dyglys
Re: How to delete Nagios XI availability history data
Posted: Thu Jan 04, 2018 10:47 am
by dwhitfield
If you want to reset the current status, then you can remove the status.dat file (with the nagios service off). This is different than removing all of the history.
However, if you want to remove historical information from the db, the four following commands should do it.
Code: Select all
mysql -u ndoutils -pn@gweb nagios -e 'TRUNCATE TABLE nagios_logentries'
mysql -u ndoutils -pn@gweb nagios -e 'TRUNCATE TABLE nagios_statehistory'
mysql -u ndoutils -pn@gweb nagios -e 'TRUNCATE TABLE nagios_servicestatus'
mysql -u ndoutils -pn@gweb nagios -e 'TRUNCATE TABLE nagios_hoststatus'
The actual configs are stored in the nagiosql db, not nagios db, so you can get rid of anything in the nagios db and retain your settings. If you really want to start over from scratch in production though, I would suggest creating a new install and then importing your configs.
Re: How to delete Nagios XI availability history data
Posted: Thu Jan 04, 2018 5:45 pm
by dyglys
Thank you for the tips, which are driving us the proper direction.
The commands did the job:
- cleared up State history
- cleared up Log entries
The commands did not do the job:
- to reset Availability Summary statistics
- to clear up the Notifications records
Would you you please give few more commands.
Thank you.
Regarding the migration the instance, it was my one of possible scenarios.
Having reviewed Knowledge Base may I ask if these are the procedures I would need to follow:
https://assets.nagios.com/downloads/nag ... tabase.pdf
https://assets.nagios.com/downloads/nag ... p-Tool.pdf
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Please confirm.
Thank you,
Re: How to delete Nagios XI availability history data
Posted: Thu Jan 04, 2018 6:00 pm
by dwhitfield
Running through and truncating these should be safe:
Code: Select all
+----------------------------------------+
| Tables_in_nagios |
+----------------------------------------+
| nagios_acknowledgements |
| nagios_commands |
| nagios_commenthistory |
| nagios_comments |
| nagios_configfiles |
| nagios_configfilevariables |
| nagios_conninfo |
| nagios_contact_addresses |
| nagios_contact_notificationcommands |
| nagios_contactgroup_members |
| nagios_contactgroups |
| nagios_contactnotificationmethods |
| nagios_contactnotifications |
| nagios_contacts |
| nagios_contactstatus |
| nagios_customvariables |
| nagios_customvariablestatus |
| nagios_dbversion |
| nagios_downtimehistory |
| nagios_eventhandlers |
| nagios_externalcommands |
| nagios_flappinghistory |
| nagios_host_contactgroups |
| nagios_host_contacts |
| nagios_host_parenthosts |
| nagios_hostchecks |
| nagios_hostdependencies |
| nagios_hostescalation_contactgroups |
| nagios_hostescalation_contacts |
| nagios_hostescalations |
| nagios_hostgroup_members |
| nagios_hostgroups |
| nagios_hosts |
| nagios_hoststatus |
| nagios_instances |
| nagios_logentries |
| nagios_notifications |
| nagios_objects |
| nagios_processevents |
| nagios_programstatus |
| nagios_runtimevariables |
| nagios_scheduleddowntime |
| nagios_service_contactgroups |
| nagios_service_contacts |
| nagios_service_parentservices |
| nagios_servicechecks |
| nagios_servicedependencies |
| nagios_serviceescalation_contactgroups |
| nagios_serviceescalation_contacts |
| nagios_serviceescalations |
| nagios_servicegroup_members |
| nagios_servicegroups |
| nagios_services |
| nagios_servicestatus |
| nagios_statehistory |
| nagios_systemcommands |
| nagios_timedeventqueue |
| nagios_timedevents |
| nagios_timeperiod_timeranges |
| nagios_timeperiods |
+----------------------------------------+
You will need to delete all of the historical nagios.log files if you want no availability and notification history.
Re: How to delete Nagios XI availability history data
Posted: Fri Jan 05, 2018 3:06 am
by dyglys
I do confirm that I have succeeded to flush historical data as per our needs.
Thank you for your support very much.
dyglys
Let us consider the tread being closed.
Re: How to delete Nagios XI availability history data
Posted: Fri Jan 05, 2018 11:06 am
by dwhitfield
Glad to hear it is resolved. I am going to lock the thread. Please feel free to post again if you have you another issue. Thank you for using the Nagios forums!