You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Relocating NMIS9 and OMK logs
Summary:
This is a process for moving log files/directories and editing the configuration files that utilize it. Many may have started their monitoring with a smaller disk size and added on or want to have logs in a separate place than their other files. The purpose of this process is to show what will need to be edited and some tips to do this efficiently with as little down time as possible.
This document assumes that NMIS9 and OMK are installed in the default locations.

Steps

  1. Stop Daemons, this will also stop the logs from being written too while you make your changes.

systemctl stop nmis9d
systemctl stop rsyslog
systemctl stop snmptrapd
/usr/local/omk/bin/checkomkdaemons.sh stop

  1. Copy folders/files to new path, we are doing this recursively and also copying their permissions.

cp -rp /usr/local/nmis9/logs /mnt/nmis9_logs
cp -rp /usr/local/omk/log /mnt/omk_logs

  1. Back up current configuration files before editing

cp /usr/local/nmis9/conf/Config.nmis /usr/local/nmis9/conf/Config.nmis.backup1
cp /usr/local/omk/conf/opCommon.json /usr/local/omk/conf/opCommon.json.backup1
cp /etc/rsyslog.conf /etc/rsyslog.conf.backup1

  1. Edit the NMIS9 configuration file, we are using the patch tool found in nmis9/bin. This saves time and doesn't make the user open a text editor to make changes.

/usr/local/nmis9/admin/patch_config.pl /usr/local/nmis9/conf/Config.nmis /directories/\<nmis_logs\>=/mnt/nmis9_logs

  1. Same as step 4) but with the omk configuration file, omk/conf/opCommon.json.

/usr/local/nmis9/admin/patch_config.pl /usr/local/omk/conf/opCommon.json /nmis/\<nmis9_logs\>=/mnt/nmis9_logs
/usr/local/nmis9/admin/patch_config.pl /usr/local/omk/conf/opCommon.json /directories/\<omk_logs\>=/mnt/omk_logs

  1. Remove old folder to save space or you can rename or move it.

rm -rf /usr/local/omk/log
rm -rf /usr/local/nmis9/logs

  1. Create symlink, this makes it easier to follow wiki

ln -s /mnt/nmis9_logs /usr/local/nmis9/logs
ln -s /mnt/omk_logs /usr/local/omk/log

  1. If you are using syslog you will want to update the configuration file to match the new path. I have given an example using sed (stream editor), this was tested on ubuntu 20.04 and working. Syntax: sed -i 's:<search regex>:<replacement>:g' <input file>

Use Case: sed -i 's:/usr/local/nmis9/logs:/mnt/omk_logs:g' /etc/rsyslog.conf
NOTE: For logrotate, you do not have to change the paths as it does follow the symlinks.

  1. Start Daemons

systemctl start nmis9d
systemctl start rsyslog
systemctl start snmptrapd
/usr/local/omk/bin/checkomkdaemons.sh start

  • No labels