shinken-solutions / shinken

Flexible and scalable monitoring framework
http://www.shinken-monitoring.org
GNU Affero General Public License v3.0
1.13k stars 336 forks source link

[procedure] How to install shinken on Rocky/centos/redhat > 7 + gift for saltstack integration ❤️ #2033

Open garadar opened 7 months ago

garadar commented 7 months ago

Introduction

Shinken doesn't support Python3 yet, making it a bit tricky to install on newer operating systems like Rocky 8. However, I've put together a step-by-step guide for installation that I've personally tested and confirmed to work.

I have integrated all this procedure on salt repository available here (with thruk integration): https://github.com/garadar/shinken_salt

My architecture:

Arbiter and thruk on dedicated VM Rocky8 for monitoring. No other service on it Poller/broker on a server with other thing runnint on it

Procedure

Create user and group :

useradd shinken
useradd nagios
groupadd shinken
groupadd nagios

Install rpm dependencies for shinken:

dnf install python2 python2-pip python2-devel gcc libcurl-devel openssl-devel

Shinken does not work because of Python's standard, which requires you to specify a version (Python2 or Python3, making this an annoying choice! But we don't want to deal with that here). So, we need to set Python alternative:

alternatives --set python /usr/bin/python2

You should have something like that:

alternatives  --list |grep python
python                  manual  /usr/bin/python2
python3                 auto    /usr/bin/python3.6

Install PycURL with a Specific Version Required by Shinken:

PYCURL_SSL_LIBRARY=openssl pip2 install pycurl==7.43.0.4 --compile --no-cache-dir

Install shinken with pip:

pip2 install shinken

Initialize Shinken and Install All Modules:

shinken --init
shinken install pickle-retention-file-scheduler livestatus named-pipe logstore-sqlite

Reload systemd to Create Generic Service:

systemctl daemon-reload

You should see a new service created by systemd-sysv-generator:

systemctl cat shinken-broker.service 
# /run/systemd/generator.late/shinken-broker.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/rc.d/init.d/shinken-broker
Description=LSB: Shinken broker daemon
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=all.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SuccessExitStatus=5 6
ExecStart=/etc/rc.d/init.d/shinken-broker start
ExecStop=/etc/rc.d/init.d/shinken-broker stop
ExecReload=/etc/rc.d/init.d/shinken-broker reload

Now it should be workind without errors (working for me). You need to include your config file to make it work.

garadar commented 2 months ago

Hi everyone,

It's working also on rocky8 :)