By mistake if nagios.cfg got deleted???

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
dspatil7768
Posts: 7
Joined: Thu Jan 19, 2017 7:43 am

By mistake if nagios.cfg got deleted???

Post by dspatil7768 »

My question is suppose if nagios.cfg got deleted. And still, the daemon is running using pre-configuration. How to recover old configuration data with help of running daemon information??? I have not tried deleting it but I want to know it??

Thank you,

Devendra Patil
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: By mistake if nagios.cfg got deleted???

Post by rkennedy »

I don't believe this is going to be possible at a simple level, and a bit beyond what we can provide support for on the Nagios side. You may be able to recover it from memory somehow.
Former Nagios Employee
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: By mistake if nagios.cfg got deleted???

Post by avandemore »

Well if you deleted it and didn't have a backup it would be hard to recover especially in Nagios Core. XI would have created a backup automatically.

Otherwise if the file is still open and you know the inode:

Code: Select all

cp /proc/<pid>/fd/<fdno> /usr/local/nagios/etc/nagios.cfg
Previous Nagios employee
dspatil7768
Posts: 7
Joined: Thu Jan 19, 2017 7:43 am

Re: By mistake if nagios.cfg got deleted???

Post by dspatil7768 »

I found pid in nagios.lock file. As mentioned above I looked into /proc/<PID>. But still didn't get any useful information about configuration. The only file which have some configuration information is /usr/local/nagios/var/retention.dat .

Thank you, sir @rkennedy and @avandemore
Attachments
retention.txt
(21.74 KiB) Downloaded 158 times
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: By mistake if nagios.cfg got deleted???

Post by avandemore »

I checked and the configuration is not held open, just read and closed. If you have deleted the file and not backed it up it is gone. There may be some file system recovery tool, but that is beyond the scope of this forum.
Previous Nagios employee
dspatil7768
Posts: 7
Joined: Thu Jan 19, 2017 7:43 am

Re: By mistake if nagios.cfg got deleted???

Post by dspatil7768 »

I'm new to Nagios and just queried that question to know.☺



Thank you,
Devendra patil
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: By mistake if nagios.cfg got deleted???

Post by dwhitfield »

It complicates things, but you can use NDOUtils to deal with this in in some regards: https://assets.nagios.com/downloads/nag ... OUtils.pdf

The best thing to do is just set things up in a VM, take regular snapshots and if things go awry, roll back.

That all said, are we ready to lock this up?
dspatil7768
Posts: 7
Joined: Thu Jan 19, 2017 7:43 am

Re: By mistake if nagios.cfg got deleted???

Post by dspatil7768 »

That is the thing that I do every time, Just rolling back.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: By mistake if nagios.cfg got deleted???

Post by dwhitfield »

Great to hear of best practices out in the wild. Did you have any other questions, or are we ready to lock this thread?
dspatil7768
Posts: 7
Joined: Thu Jan 19, 2017 7:43 am

Re: By mistake if nagios.cfg got deleted???

Post by dspatil7768 »

I want to ask one question again. I have installed Nagios 4.2.0 and Nagiosgraph 1.5.2. And I have added one Linux Remote host and I'm getting empty graphs for Localhost as well as Remote Linux host. And I'm getting graphs using MRTG.
Any Solution??

Thank you,
Devendra Patil
Locked