Kibana logging and daemon process


(Pierre J. Nelson) #1

I've been trying to get Kibana up and running through a daemon but I don't seem to be very smart when it comes to this and hoping to get some help.

Currently trying to get this to run on SLES 11.3 SP6. Right now everything goes to stdout and I have to break out if I want my shell back.


(Court Ewing) #2

I'm not very familiar with SUSE, but you'll probably want to set up the SUSE equivalent of a startup script to manage starting Kibana. With apt-get/yum, you get that for free, but for other systems you'll need to wire it up according to the individual operating system.


(Pierre J. Nelson) #3

You are more than right, I being new to SLES as well was hoping someone would be willing to share what they have gotten configured so I can get it up and running.


(Court Ewing) #4

Ah, I understand. Sorry I'm not more help on that, but maybe someone else with SUSE experience can weigh in. Stack overflow may be a good place to ask questions about this as well.


(Pierre J. Nelson) #5

Here is how we got it to work on our version of SLES. We pretty much took a script that was out there and re did it a little bit.


#!/bin/sh

/etc/init.d/kibana -- startup script for Kibana

Written by Jason Stirnaman

BEGIN INIT INFO

Provides: kibana

Description: Starts kibana as a daemon.

END INIT INFO

. /lib/lsb/init-functions

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/kibana/bin
KIBANA_PATH=/data/kibana-4.4.2-linux-x64/bin
NAME=kibana
DESC="Kibana Dashboard"
PID_FILE=/var/run/$NAME.pid
KIBANA_LOG_FILE=/var/log/$NAME.log
DAEMON=

if [ id -u -ne 0 ]; then
echo "You need root privileges to run this script"
exit 1
fi

Load the rc.status script for this service.

. /etc/rc.status

Reset status of this service

rc_reset

start_command="$KIBANA_PATH/$NAME"

Start command wraps node and node executable is what ps observes.

chk_command=/data/kibana-4.4.2-linux-x64/bin/../node/bin/node

case $1 in
start)
echo "Starting $DESC"
/data/kibana-4.4.2-linux-x64/bin/kibana&
;;
stop)
echo -n "Stopping $DESC: "
## Stop daemon with killproc(8) and if this fails
## killproc sets the return value according to LSB.
killproc -p $PID_FILE $chk_command

      # Remember status and be verbose
      rc_status -v

      ;;
    status)
            echo -n "Status for $DESC:"
            ## Check status with checkproc(8), if process is running
            ## checkproc will return with exit status 0.

            # Status has a slightly different for the status command:
            # 0 - service running
            # 1 - service dead, but /var/run/  pid  file exists
            # 2 - service dead, but /var/lock/ lock file exists
            # 3 - service not running

            # NOTE: checkproc returns LSB compliant status values.
            checkproc -p $PID_FILE $chk_command
             # NOTE: rc_status knows that we called this init script with
            # "status" option and adapts its messages accordingly.
            rc_status -v
            ;;
    *)
            echo "Usage: $0 {start|stop|restart|status}"
            exit 1
            ;;

esac

exit 0


(system) #6