How to upgrade to Shinken? [Quick Guide]

4:15 pm April 10, 201710407

I. introduction

Installer Shinken is one thing, but to update is another. When a new version of Shinken sees the day, must then be able to update it on the production platform, without losing the information and content of the site of supervision .

Recall that there are two major strategies of installation of Shinken and for (for now), no package allowing to automate the installation phase:

– Installation by.tar.gz source files
– Installation by the utilities easy_install or pip

, the update of the version of Shinken is still mainly a security target (bug correction) and also scalability (update of the system operating). But, regardless of the method used to implement Shinken, when one wishes to upgrade its production platform, should always use the same method, over time.

WARNING : regardless of the method used to install and update Shinken, to systematically do a backup preventive before making any changes.

Then, he must then create the directories to restore on a new server:

– / etc/shinken
– / var/lib/shinken
– / var/run/shinken
– / var/log/shinken

must of course set the rights of belonging to account for these different directories shinken:

 # chown - R shinken:shinken/etc/shinken # chown - R shinken:shinken/var/lib/shinken # chown - R shinken : shinken/var/run/shinken # chown - R shinken:shinken/var/log/shinken 

you can then launch the installation of Shinken depending on the choice made in advance. We can eventually draw the ticket on the installation Shinken in 10 steps:

– initialization of environment & prerequisites
– Installation of additional tools
– cloning of the Shinken project git Branch
– Shinken application Installation
– implemented rights
– initialization of Shinken
– Installation basic modules
start services
– connection to Shinken

once the installation of the new vm , or of the new machine in a general way, is installed, you can then copy the content of the old version to the new tree.

Note: you can use a check-in, via the tar command, containing all of the production configuration or use a copy: cp, scp or rsync.

II. Full backup of the supervision of production site

in order to perform a complete backup of site supervision of production, we can use the tar command:

 $ tar cvf SaveFullShinken.tar/etc/shinken/var/lib/shinken 

of course, initially installing Shinken, allows to generate scripts to control (in the directory /etc/init.d) , as well as the process files (in / var/run/shinken ) and trace files (in / var/log/shinken ).

So, only two directories / etc/shinken and / var/lib/shinken, that contains definitions of objects and controls of supervision, as well as the Python code, modules and interface WebUI are necessary to recover the current production environment.

III. restoration of archive Shinken

to install the new version, two cases arise:

– we install the new version on the same server
– either we install a new server

personally, I tend to prefer the second solution, because there is less risk of one version by another crash. In this case, simply reinstall a new server (see the tutorial on installing Shinken in ten steps).

A. Installation to a new server

once you installed the new site Shinken, it remains more then to re-inject the previous backup content:

 $ tar xvf - atime-preserve - preserve - same-owner tmp/SaveFull/shinken.tar

Ainsi, we find all the scripts and related to our supervision of production models, retaining permissions , the current owners as well as the timestamp. This last property ensures a total adequacy with the date and time of the current files, to provided, of course that the new server is also synchronized on the same time server NTP, than that of production.

ATTENTION: directories containing modules have changed since version 2.0 Shinken. So, if you copy a previous distribution version, it will work, but may encounter problems when using the mode command Shinken.

B. Installation on the same server

in this case, things are a little more complicated. [StartwithstopShinkenservicestobeabletorenamedirectoriesasabackup:

 # systemctl stop shinken # cp/etc/shinken /etc/shinken.sav # cp //var/lib/shinken /var/lib/shinken.sav # cp/var/run/shinken /var/run/shinken.sav # cp/var/log/shinken var/log/shinken.sav

Note: must also rename the scripts in/etc/init.d startup and stop. Indeed, perhaps the new version also brings a lot of changes during the phases of initialization.

You can then install the new version (still following the tutorial about installing Shinken in ten steps). We should then have the new directories below as well as start-up scripts in/etc/init. :

– / etc/shinken
– / var/log/shinken
– / var/run/shinken
– / var/lib/shinken

well, now, there are more to re-inject the content of tarball created previously to reinject all scripts and the configuration of the production site:

 $ tar xvf - atime-preserve - preserve - same-owner /tmp/SaveFull/shinken.tar

On should be able to start all the services retained the production configuration and in having migrated on the new version Shinken:

 # start shinken systemctl 

IV. Checks

when all services and content are restored, we can then start the services Shinken.

caution: always make sure to have full recovery of the modules, previously reported in the/var/lib/shinken/modules directory before you start the services Shinken.

It must therefore list the modules already active on the site of production with the command below and compare the result with the new site:

 $ shinken inventory 

it is imperative that the two coincide. Otherwise, something is missing, and services may not start or may not work properly.

Some modules may also require an update, to be operational in the new context. In this case, he must execute the command below, many times there are modules to update:

 $ shinken update  

where is the name of the module (s) to be updated.

Whatever it is, there are also scrutinizing the newspapers of logs (in / var/log/shinken ), to ensure that on the new server, when restarting, with new version, no error is detected. One can also check that no bad file * for been generated in the/tmp directory: sign that an error for occurred during the start-up phase of the services.

Note: do not change operating system or distribution during migration. The update must be done on a system equivalent to that of the original production site.