I need help for a very silly case. I did a -y yum update of system which had updated icinga version from 2.11.2-1 to 2.11.3-1.
This has caused my /usr/share/icinga2/include/command-plugins.conf file to be restored to its default file and now i have lost my check commands which i added to that file previously.
Is there any way i can recover my previous command-plugins.conf file, since i did not take a backup copy of that file.
It might be possible but it depends on the update software and perhaps
on your filesystem.
Often, update software will save a copy of the previous configuration
file - for example something like “command-plugins.conf.old”. Look
for something like that in the same directory as the config file.
If you aren’t that lucky, then you might need to work a little harder.
Many filesystems use algorithms to select the (approximate) physical
location of the stored data on the storage medium. One reason for
this is to equalize wear on the device. For example if it is a disc,
the new data for the new file may not overwrite the storage locations
used by the old file, but may be written into a location which hasn’t
been used in a while. After the new file is written, a pointer in the
directory is updated so that it points to the new location and the old
location becomes available for the storage of something else; but is
not actually used yet - and it might not be used for quite some time
depending on the activity in the filesystem.
So if you can search the unused data on the disc for a string that you
know exists in the data you might be able to find it.
Of course there are caveats. Mostly these are that the file might be
fragmented on the disc (if it’s a short file you might be lucky and it
might all be in one storage unit, such as an ‘inode’) and there might
be many deleted copies of the file if it’s been edited a lot over its
life. Putting the fragments together in that case can be challenging,
but it’s the sort of thing I’ve done for valued customers in the past
(when I haven’t just told them not to be so silly in the future… :).