-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use runit for kibana; future plans to use it for all
- Loading branch information
Showing
13 changed files
with
134 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,98 @@ | ||
#!/bin/bash | ||
### BEGIN INIT INFO | ||
# Provides: kibana | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: Runs kibana daemon | ||
# Description: Runs the kibana daemon as a non-root user | ||
### END INIT INFO | ||
|
||
# Process name | ||
NAME=kibana | ||
DESC="Kibana4" | ||
PROG="/etc/init.d/kibana" | ||
PID_FOLDER=/var/run/kibana/ | ||
# pid file for daemon | ||
PID_FILE=/var/run/kibana/$NAME.pid | ||
LOCK_FILE=/var/lock/subsys/$NAME | ||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:$KIBANA_BIN | ||
|
||
# this left blank | ||
# Configure the daemon & kibana variables based on Kibana location | ||
KIBANA_BIN=/usr/local/bin/ | ||
KIBANA_LOG=/var/log/kibana.log | ||
# Daemon name | ||
DAEMON="$KIBANA_BIN/kibana -c /etc/kibana.yml" | ||
# User to run as daemon process | ||
DAEMON_USER=kibana | ||
|
||
RETVAL=0 | ||
|
||
if [ `id -u` -ne 0 ]; then | ||
echo "You need root privileges to run this script" | ||
exit 1 | ||
fi | ||
|
||
# Function library | ||
. /etc/init.d/functions | ||
|
||
start() { | ||
echo -n "Starting $DESC : " | ||
|
||
pid=`pidofproc -p $PID_FILE kibana` | ||
if [ -n "$pid" ] ; then | ||
echo "Already running." | ||
exit 0 | ||
else | ||
# Start Daemon | ||
if [ ! -d "$PID_FOLDER" ] ; then | ||
mkdir $PID_FOLDER | ||
fi | ||
daemon --user=$DAEMON_USER --pidfile=$PID_FILE "$DAEMON" 1>"$KIBANA_LOG" 2>&1 & | ||
sleep 2 | ||
pidofproc node > $PID_FILE | ||
RETVAL=$? | ||
[[ $? -eq 0 ]] && success || failure | ||
echo | ||
[ $RETVAL = 0 ] && touch $LOCK_FILE | ||
return $RETVAL | ||
fi | ||
} | ||
|
||
reload() | ||
{ | ||
echo "Reload command is not implemented for this service." | ||
return $RETVAL | ||
} | ||
|
||
stop() { | ||
echo -n "Stopping $DESC : " | ||
killproc -p $PID_FILE $DAEMON | ||
RETVAL=$? | ||
echo | ||
[ $RETVAL = 0 ] && rm -f $PID_FILE $LOCK_FILE | ||
} | ||
|
||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
status) | ||
status -p $PID_FILE $DAEMON | ||
RETVAL=$? | ||
;; | ||
restart) | ||
stop | ||
start | ||
;; | ||
reload) | ||
reload | ||
;; | ||
*) | ||
# Invalid Arguments, print the following message. | ||
echo "Usage: $0 {start|stop|status|restart}" >&2 | ||
exit 2 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
cd /home/kibana | ||
exec 2>&1 | ||
|
||
exec /usr/bin/env kibana -c /etc/kibana.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
version '0.1.0' | ||
|
||
depends 'elk' | ||
depends 'runit' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
kibana_service 'default' do | ||
action [:create, :enable] | ||
action [:create] | ||
end | ||
|
||
kibana_config 'default' do | ||
port 8080 | ||
action :create | ||
notifies :restart, 'kibana_service[default]' | ||
end |