Smart Monitor Data Collector Upgrade
Pre-Upgrade Preparation
Legend:
SM_INSTALLER- directory where Smart Monitor installation package is extractedLS_HOME- Logstash installation directory (typically/app/logstash)LS_CONFIG- Logstash configuration directory (typically/app/logstash/config)LS_DATA- Logstash data directory (typically/app/data/logstash)
Smart Monitor Data Collector is based on Logstash and may be referred to as such in this document.
If uninterrupted data collection is critical, migrate current pipeline configurations to another Logstash instance and redirect all data collection to it.
In high-load installations, Smart Monitor Data Collector might not stop via the update script. Manually stop it before upgrading:
sudo systemctl stop logstash
Create backups of these directories:
LS_CONFIGLS_DATA
mkdir -p /app/backup/logstash/
cp -r ${LS_CONFIG} /app/backup/logstash/config_$(date +%Y%m%d)/
cp -r ${LS_DATA} /app/backup/logstash/data_$(date +%Y%m%d)/
Upgrade Process
The script requires these pre-installed packages:
curlzipunzip
The automated update script streamlines the upgrade process and is located at $SM_INSTALLER/logstash/update.sh. When executing the script, you may specify a configuration file: $SM_INSTALLER/logstash/example_config_dashboards.yaml. The YAML file format matches the installation configuration file.
The update script supports the following runtime parameters:
-c, --config <path_to_config_file_yaml>- specify upgrade configuration file-h, --help- display command help
When executed, the script will create a backup of the systemd service file, logstash.yml, and the configuration directory into the temporary directory $SM_INSTALLER/logstash/staging/.
The update script does not perform any actions with the data and logs directories, while the configuration directory and systemd files will be saved into the temporary directory $SM_INSTALLER/logstash/staging/.
The staging directory contents will be cleared if the script is rerun.
To perform the upgrade, execute:
$SM_INSTALLER/logstash/update.sh
The script automatically detects these key server paths:
Logstash Home Directory- Logstash installation path (typically/app/logstash)Logstash Conf Directory- Configuration files location (typically/app/logstash/config/)Logstash Data Directory- Data storage location (typically/app/data/logstash)Logstash Logs Directory- Log files location (typically/app/logs/logstash)
================================================================================
SMART MONITOR INSTALL SCRIPT - LOGSTASH
================================================================================
Current working directory: /app/distr/sm_5.1/logstash
Current name of install's archive: logstash-oss-8.13.4-linux-x86_64.tar.gz
Current version of Logstash: 8.13.4
================================================================================
-- STEP 1. INSTALLATION DIRECTORIES
logstash.service file found. Will get necessary paths from there
Final Logstash home directory: /app/logstash
Final Logstash conf directory: /app/logstash/config
Final Logstash data directory: /app/data/logstash
Final Logstash logs directory: /app/logs/logstash
Is this correct? [y/n]:
After entering the directory paths, confirm your entries by pressing y, or manually re-enter them by pressing n.
The next step allows disabling all operations requiring privilege escalation to root during the update.
It is not possible to complete the update without root privileges. Some operations must be performed by the root user, then the installer must be run under the user account that runs Smart Monitor Data Collector. After the script finishes, some operations must again be performed by the root user. The list of operations will be displayed by the installer.
Failure to execute these commands before updating may result in data loss.
To launch the installer as the logstash user:
sudo -u logstash $SM_INSTALLER/logstash/update.sh
The first prompt will ask whether to disable commands requiring root privilege escalation.
Then you need to enter the user and group under which Smart Monitor Data Collector runs.
Finally, the system will display a checklist of operations that must be completed before executing the update script.
-- STEP 2. DISABLE OPERATIONS WHERE ROOT RIGHTS ARE REQUIRED
Want to install SMART MONITOR without root privileges? [y/N]: y
Final you set the non-root flag to: y
Linux username for SMART MONITOR [logstash]:
Linux groupname for SMART MONITOR [logstash]:
Final SMART MONITOR username: logstash
Final SMART MONITOR groupname: logstash
Is this correct? [Y/n]:
ATTENTION!
Before installing SMART MONITOR, you must run the following commands as a user with root privileges.
Change user, group and directories as needed
systemctl stop logstash
chown -R logstash:logstash /app/logstash /app/logstash/config /app/data/logstash /app/logs/logstash /app/distr/sm_5.1/logstash
!!! Are you sure you have done everything from the list above? [y/N]:
At the final step, you must confirm that all root user commands were executed.
Enter y to proceed - otherwise, the update will be aborted.
Then, preparatory steps for the update will be performed. Before applying the update, you will be prompted to confirm whether to proceed. Up to this point, no actions that affect the system's functionality are performed.
!!! AT THIS POINT WE START TO MAKE CHANGES IN OPERATING SYSTEM !!!
Do you want to continue? [y/N]:
If you selected the update option without commands requiring root privileges, the system will display an information block listing all commands that must be executed as the root user.
================================================================================
ATTENTION!
After installing SMART MONITOR, you must run the following commands as a user with root privileges.
Change user, group and directories as needed.
cp /app/distr/sm_5.1/logstash/staging/services/logstash.service /etc/systemd/system/
chown root:root /etc/systemd/system/logstash.service
chcon -Rv -u system_u -r object_r -t bin_t /app/logstash/bin
chcon -Rv -u system_u -r object_r -t bin_t /app/logstash/jdk/bin
chown -R logstash:logstash /app/logstash /app/logstash/config /app/data/logstash /app/logs/logstash
systemctl daemon-reload
systemctl enable logstash
systemctl start logstash
systemctl status logstash
================================================================================
-- SMART MONITOR SUCCESSFULLY UPDATED!
-- For further instructions, please refer to the documentation: https://docs.smartmonitor.ru
================================================================================
And this too: upon successful completion of the update script, the corresponding text SMART MONITOR SUCCESSFULLY UPDATED will be displayed.
Before running Logstash, it's recommended to check all pipeline configurations using the following command:
sudo -u logstash $LS_HOME/bin/logstash --config.test_and_exit -f <pipeline-config>