Skip to content

Commit

Permalink
Merge pull request #63 from blackcobra1973/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dnaeon committed Sep 1, 2014
2 parents a5c8417 + c2718ec commit 5f028ac
Show file tree
Hide file tree
Showing 25 changed files with 10,972 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*~
\#*
build/
dist/
src/vpoller.egg-info/

4 changes: 2 additions & 2 deletions README.gentoo.md → contrib/README.gentoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ mv vpoller-cclient /usr/local/bin/

- Install init scripts

cp src/init.d/vpoller-proxy.gentoo /etc/init.d/vpoller-proxy
cp src/init.d/vpoller-worker.gentoo /etc/init.d/vpoller-worker
cp contrib/init.d/gentoo/vpoller-proxy /etc/init.d/vpoller-proxy
cp contrib/init.d/gentoo/vpoller-worker /etc/init.d/vpoller-worker

- Install the logrotate template

Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions contrib/conf.d/vpoller-proxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# conf.d file for vpoller-proxy

## Standalone proxy
#USER=vpoller
#GROUP=vpoller
### Proxy on zabbix server
USER=zabbix
GROUP=zabbix

####
DESC="vpoller-proxy daemon"
DAEMON=/usr/bin/vpoller-proxy
MGMT_INTERFACE="tcp://localhost:9999"
CONF_DIR=/etc/vpoller
CONF_FILE=${CONF_DIR}/vpoller.conf
PID_DIR=/var/run/vpoller
LOG_DIR=/var/log/vpoller
PID_FILE=${PID_DIR}/vpoller-proxy.pid

20 changes: 20 additions & 0 deletions contrib/conf.d/vpoller-worker
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# conf.d file for vpoller-worker

### Select which user to use
## Standalone proxy
#USER=vpoller
#GROUP=vpoller
### Proxy on zabbix server
USER=zabbix
GROUP=zabbix

####
DESC="vpoller-worker daemon"
DAEMON=/usr/bin/vpoller-worker
MGMT_INTERFACE="tcp://localhost:10000"
CONF_DIR=/etc/vpoller
CONF_FILE=${CONF_DIR}/vpoller.conf
PID_DIR=/var/run/vpoller
LOG_DIR=/var/log/vpoller
PID_FILE=${PID_DIR}/vpoller-worker.pid

103 changes: 103 additions & 0 deletions contrib/init.d/debian/vpoller-proxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: vpoller-proxy
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs
# X-Start-Before:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: vPoller Proxy daemon
### END INIT INFO

#
# Author: Kurt Dillen
#

### Change depending on installation: standalone or together with zabbix
USER=zabbix
GROUP=zabbix

### Variables
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
DESC="vpoller-proxy daemon"
NAME=vpoller-proxy
DAEMON=`which $NAME`
DAEMON_ARGS="-d start"
SCRIPTNAME=/etc/init.d/"$NAME"
MGMT_INTERFACE="tcp://localhost:9999"
PID_DIR=/var/run/vpoller
LOG_DIR=/var/log/vpoller
PID=${PID_DIR}/vpoller-proxy.pid

### Create needed directories and set right permissions
if [ ! -d ${PID_DIR} ]; then
mkdir -p ${PID_DIR}
chown ${USER}:${GROUP} ${PID_DIR}
fi
if [ ! -d ${LOG_DIR} ]; then
mkdir -p ${LOG_DIR}
chown ${USER}:${GROUP} ${LOG_DIR}
fi

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start() {
start-stop-daemon --start --quiet --pidfile $PID \
--exec $DAEMON --chuid $USER:$GROUP -- $DAEMON_ARGS >/dev/null 2>&1 || return 2
}

do_stop() {
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PID --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
rm -f $PID
return "$RETVAL"
}

do_full_status() {
${DAEMON} -e ${MGMT_INTERFACE} status
}

case "${1}" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
reset|stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
fullstatus)
do_full_status
;;
reload|restart|force-reload)
do_stop
do_start
;;
*)
log_success_msg "usage: ${0} {start|stop|status|fullstatus||reload|restart|force-reload|reset}" >&2
;;
esac
103 changes: 103 additions & 0 deletions contrib/init.d/debian/vpoller-worker
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: vpoller-worker
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs
# X-Start-Before:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: vPoller Worker daemon
### END INIT INFO

#
# Author: Kurt Dillen
#

### Change depending on installation: standalone or together with zabbix
USER=zabbix
GROUP=zabbix

### Variables
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
DESC="vpoller-worker daemon"
NAME=vpoller-worker
DAEMON=`which vpoller-worker`
DAEMON_ARGS="-d start"
SCRIPTNAME=/etc/init.d/"$NAME"
MGMT_INTERFACE="tcp://localhost:10000"
PID_DIR=/var/run/vpoller
LOG_DIR=/var/log/vpoller
PID=${PID_DIR}/vpoller-worker.pid

### Create needed directories and set right permissions
if [ ! -d ${PID_DIR} ]; then
mkdir -p ${PID_DIR}
chown ${USER}:${GROUP} ${PID_DIR}
fi
if [ ! -d ${LOG_DIR} ]; then
mkdir -p ${LOG_DIR}
chown ${USER}:${GROUP} ${LOG_DIR}
fi

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start() {
start-stop-daemon --start --quiet --pidfile $PID \
--exec $DAEMON --chuid $USER:$GROUP -- $DAEMON_ARGS >/dev/null 2>&1 || return 2
}

do_stop() {
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PID --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
rm -f $PID
return "$RETVAL"
}

do_full_status() {
${DAEMON} -e ${MGMT_INTERFACE} status
}

case "${1}" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
reset|stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
fullstatus)
do_full_status
;;
reload|restart|force-reload)
do_stop
do_start
;;
*)
log_success_msg "usage: ${0} {start|stop|status|fullstatus||reload|restart|force-reload|reset}" >&2
;;
esac
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,17 @@

#. /etc/init.d/functions.sh

extra_started_commands="fullstatus"
extra_commands="fullstatus"

description_fullstatus="Gives the full status of the server."

DESC="vpoller-proxy daemon"
DAEMON=/usr/bin/vpoller-proxy
MGMT_INTERFACE="tcp://localhost:9999"
CONF_DIR=/etc/vpoller
CONF_FILE=${CONF_DIR}/vpoller.conf
PID_DIR=/var/run/vpoller
LOG_DIR=/var/log/vpoller
PID_FILE=${PID_DIR}/vpoller-proxy.pid

depend() {
use logger net
}

checkconfig() {
checkpath --directory -m 0755 -o zabbix:zabbix ${PID_DIR}
checkpath --directory -m 0755 -o zabbix:zabbix ${LOG_DIR}
checkpath --directory -m 0755 -o ${USER}:${GROUP} ${PID_DIR}
checkpath --directory -m 0755 -o ${USER}:${GROUP} ${LOG_DIR}
}

start() {
Expand All @@ -38,13 +29,14 @@ start() {
eend 1 "${CONF_FILE} does not exist"
return 1
fi
# if [ -f ${PID_FILE} ]; then
# rm ${PID_FILE}
# fi
if [ -f ${LOG_DIR}/vpoller-proxy.log ]; then
chown ${USER}:${GROUP} ${LOG_DIR}/vpoller-proxy.log
fi

# $DAEMON -d start >/dev/null 2>&1
start-stop-daemon --start --quiet \
--pidfile "${PID_FILE}" \
--user zabbix --group zabbix \
--user $USER --group $GROUP \
--exec ${DAEMON} -- \
-d start
eend $?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,18 @@

. /etc/init.d/functions.sh

extra_started_commands="fullstatus"
extra_commands="fullstatus"

description_fullstatus="Gives the full status of the server."

DESC="vpoller-worker daemon"
DAEMON=/usr/bin/vpoller-worker
MGMT_INTERFACE="tcp://localhost:10000"
CONF_DIR=/etc/vpoller
CONF_FILE=${CONF_DIR}/vpoller.conf
PID_DIR=/var/run/vpoller
LOG_DIR=/var/log/vpoller
PID_FILE=${PID_DIR}/vpoller-worker.pid

depend() {
use logger net
after vpoller-proxy
}

checkconfig() {
checkpath --directory -m 0755 -o zabbix:zabbix ${PID_DIR}
checkpath --directory -m 0755 -o zabbix:zabbix ${LOG_DIR}
checkpath --directory -m 0755 -o ${USER}:${GROUP} ${PID_DIR}
checkpath --directory -m 0755 -o ${USER}:${GROUP} ${LOG_DIR}
}

start() {
Expand All @@ -46,7 +37,7 @@ start() {
# $DAEMON -d start >/dev/null 2>&1
start-stop-daemon --start --quiet \
--pidfile "${PID_FILE}" \
--user zabbix --group zabbix \
--user ${USER} --group ${GROUP} \
--exec ${DAEMON} -- \
-d start
eend $?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ _property_name=`echo ${_args} | sed -ne 's|.* -p \([a-zA-Z\.]*\)|\1|p'`
### Detect if vcenter SDK is available
_url="https://${_vsphere}/sdk"
_curl_bin=`which curl`
_curl_options="-k"
_curl_options="--connect-timeout 3 -k"

if [ ! -f $_curl_bin ]
then
Expand Down
Loading

0 comments on commit 5f028ac

Please sign in to comment.