Clear state, logs, etc. What is the best way?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
skol
Posts: 29
Joined: Mon Jan 28, 2013 3:56 pm

Clear state, logs, etc. What is the best way?

Post by skol »

Summary: We're using our current production setup to test and proof checks, etc before rolling to production. We'd like to clear logs, state, etc before going live. Can I just nuke the logfiles, state dirs etc - or is there a preferred/better way?

Thanks!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Clear state, logs, etc. What is the best way?

Post by slansing »

Depending on the log file you should be able to remove it and it will re-generate, which logs are you looking to remove?
skol
Posts: 29
Joined: Mon Jan 28, 2013 3:56 pm

Re: Clear state, logs, etc. What is the best way?

Post by skol »

I'm looking to clear the:

- event log
- past notifications
- state history

If not, not a big deal.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Clear state, logs, etc. What is the best way?

Post by abrist »

Shut down the nagios service and remove the retention file:

Code: Select all

service nagios stop
rm /usr/local/nagios/var/retention.dat
service nagios start
All checks afterwards will be listed as "pending" and will be scheduled for first checks.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Clear state, logs, etc. What is the best way?

Post by slansing »

You should be able to remove these logs without running into any issues, the logs you will be targeting are:

The archived nagios.log files:

Code: Select all

/usr/local/nagios/var/archives/
skol
Posts: 29
Joined: Mon Jan 28, 2013 3:56 pm

Re: Clear state, logs, etc. What is the best way?

Post by skol »

Cool, thanks!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Clear state, logs, etc. What is the best way?

Post by slansing »

Let us know if you run into any other questions!
Locked