first commit

Adding scripts Primitives "install" " delete" "upgrade" and nginx conf
This commit is contained in:
Jeremy MANSON 2016-03-07 10:19:14 +01:00
parent c8ece66482
commit 93a05133b0
6 changed files with 111 additions and 0 deletions

2
README.md Normal file
View File

@ -0,0 +1,2 @@
shinken for yunohost
=============

7
conf/nginx.conf Normal file
View File

@ -0,0 +1,7 @@
location ^~ /shinken {
proxy_pass http://127.0.0.1:7677;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding';
}

32
manifest.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "Shinken",
"id": "shinken",
"description": {
"en": "Shinken is an open source computer system and network monitoring software application compatible with Nagios. It watches hosts and services, gathers performance data and alerts users when error conditions occur and again when the conditions clear."
},
"developer": {
"name": "Jeremy MANSON",
"email": "jeremy.manson@jmanson.fr",
"url": "https://www.jmanson.fr"
},
"multi_instance": "false",
"arguments": {
"install": [
{
"name": "domain",
"ask": {
"en": "Choose a domain for Shinken"
},
"example": "domain.org"
},
{
"name": "path",
"ask": {
"en": "Choose a path for Shinken"
},
"example": "/shinken",
"default": "/shinken"
}
]
}
}

45
scripts/install Normal file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# Retrieve arguments
domain=$1
path=$2
sudo yunohost app checkurl $domain$path -a shinken
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Create user
id -u shinken &>/dev/null || sudo useradd -d /home/yunohost.app/shinken shinken
# Install required packages
sudo apt-get install -y apt-get install python-cherrypy3 python-pip python-pycurl nagios-plugins
sudo bash -c "pip install shinken"
# prepare shinken
sudo pip install pymongo>=3.0.3 requests arrow bottle==0.12.8 passlib
sudo apt-get install mongodb
sudo su -c shinken --int -l shinken
sudo su -c shinken install webui2 -l shinken
# Remove trailing "/" for next commands
path=${path%/}
# Monitor service
sudo yunohost service add shinken
# Configure Nginx
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shinken.conf
# Add new shinken service
sudo update-rc.d shinken defaults
# Generate SSOwat conf
sudo service nginx restart
echo $?
sudo yunohost app ssowatconf
sudo service shinken start

11
scripts/remove Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
domain=$(sudo yunohost app setting shinken domain)
sudo rm /etc/nginx/conf.d/$domain.d/shinken.conf
sudo rm -rf /home/yunohost.app/shinken
sudo sudo update-rc.d -f shinken remove
sudo service nginx reload
sudo yunohost app ssowatconf

14
scripts/upgrade Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Retrieve arguments
domain=$(sudo yunohost app setting shinken domain)
path=$(sudo yunohost app setting shinken path)
# Remove trailing "/" for next commands
path=${path%/}
# Configure Nginx and reload
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shinken.conf
sudo service nginx reload