Permalink
Browse files

package istatd as two debian packages: istatd-server and istatd-agent

  • Loading branch information...
1 parent c9f45d0 commit d64521521bbd13d916737a6dde6174cfa7f5558f @jschedler-imvu jschedler-imvu committed Nov 7, 2013
View
@@ -75,7 +75,8 @@ obj/libistatdaemon.a: $(DAEMON_OBJS)
bin/istatd: $(DAEMON_MAIN_OBJ) $(LIB_DEPS)
$(CXX) -g $(DAEMON_MAIN_OBJ) -o $@ $(LXXFLAGS) $(SYS_LIBS)
-$(eval $(call add_install,bin/istatd,$(USR_PREFIX)/bin/istatd,775))
+$(eval $(call add_install,bin/istatd,$(USR_PREFIX)/bin/istatd-server,775))
+$(eval $(call add_install,bin/istatd,$(USR_PREFIX)/bin/istatd-agent,775))
bin/splitd: $(SPLITTER_MAIN_OBJ) $(LIB_DEPS)
$(CXX) -g $(SPLITTER_MAIN_OBJ) -o $@ $(LXXFLAGS) $(SYS_LIBS)
$(eval $(call add_install,bin/splitd,$(USR_PREFIX)/bin/splitd,775))
@@ -99,10 +100,13 @@ ftests: $(DIR_DEPS) $(BINS) tests $(FTEST_FILES)
-include $(DEPS)
-$(eval $(call add_install,istatd.default,$(ETC_PREFIX)/default/istatd,755))
-$(eval $(call add_install,istatd-init.sh,$(ETC_PREFIX)/init.d/istatd,755))
+$(eval $(call add_install,istatd-server.default,$(ETC_PREFIX)/default/istatd-server,755))
+$(eval $(call add_install,istatd-server-init.sh,$(ETC_PREFIX)/init.d/istatd-server,755))
+$(eval $(call add_install,istatd-agent.default,$(ETC_PREFIX)/default/istatd-agent,755))
+$(eval $(call add_install,istatd-agent-init.sh,$(ETC_PREFIX)/init.d/istatd-agent,755))
$(foreach set,$(SETTINGS_SRCS),$(eval $(call add_precious_install,$(set),$(VAR_PREFIX)/db/istatd/$(set),664)))
-$(eval $(call add_precious_install,istatd.settings,$(ETC_PREFIX)/istatd.cfg,644))
+$(eval $(call add_precious_install,istatd-server.settings,$(ETC_PREFIX)/istatd-server.cfg,644))
+$(eval $(call add_precious_install,istatd-agent.settings,$(ETC_PREFIX)/istatd-agent.cfg,644))
$(foreach file,$(FILES_SRCS),$(eval $(call add_install,$(file),$(USR_PREFIX)/share/istatd/files/$(notdir $(file)),664)))
# add install must go before make directories
View
@@ -1,12 +1,34 @@
Source: istatd
Section: universe
Priority: extra
-Maintainer: Imran Hameed <ihameed@imvu.com>
+Maintainer: Jon Schedler <jschedler@imvu.com>
Build-Depends: debhelper (>= 7), libstatgrab-dev, cdbs, libboost-all-dev, build-essential, libmysqlcppconn-dev, curl
Standards-Version: 3.8.3
Homepage: https://github.com/imvu/istatd
-Package: istatd
+Package: istatd-server
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: imvu statistics gathering/forwarding/aggregating/storage daemon
+Conflicts: istatd
+Replaces: istatd (<=0.64-1)
+Description: IMVU Statistics gathering/forwarding/aggregating/storage Server
+ The istatd-server package is installed on the host that servers as the
+ datastore for data gathered by istatd agents and forwarded to the istatd
+ server.
+
+ The istatd-server also includes an http html ui and json interface to view
+ collected system data.
+
+ It is recommended that the istatd-agent package also be instead on the
+ istatd server host so that system data about the istatd server host can
+ be stored in istatd datastore.
+
+Package: istatd-agent
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Conflicts: istatd
+Replaces: istatd (<=0.64-1)
+Description: IMVU Statistics gathering/forwarding/aggregating/storage Agent
+ The istatd-agent package is installed on any "managed" host where an
+ administrator desired to gather, aggregate and forward data to the istatd
+ server.
@@ -0,0 +1,4 @@
+usr/bin/istatd-agent
+etc/init.d/istatd-agent
+etc/default/istatd-agent
+etc/istatd-agent.cfg
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -e
+
+if [ "$1" != "configure" ]; then
+ exit 0
+fi
+
+if [ -x "/etc/init.d/istatd-agent" ]; then
+ update-rc.d istatd-agent defaults
+ if [ -x /usr/sbin/invoke-rc.d ]; then
+ invoke-rc.d istatd-agent start ||true
+ else
+ /etc/init.d/istatd-agent start ||true
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0
@@ -3,5 +3,5 @@
set -e
if [ "$1" = purge ]; then
- update-rc.d istatd remove
+ update-rc.d istatd-agent remove
fi
@@ -3,6 +3,9 @@
# default data dir
DATADIR=/var/db/istatd
+# Prior to istatd-agent_0.65-1, istatd agent and server
+# was in one debian pacakge. This bit below, ensures
+# that the old istatd is stopped.
if [ -x "/etc/init.d/istatd" ]; then
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d istatd stop || true
@@ -11,6 +14,16 @@ if [ -x "/etc/init.d/istatd" ]; then
fi
fi
+# For istatd-agent_0.65-1 and later, stop the agent
+# in the event this is an upgrade.
+if [ -x "/etc/init.d/istatd-agent" ]; then
+ if [ -x /usr/sbin/invoke-rc.d ]; then
+ invoke-rc.d istatd-agent stop || true
+ else
+ /etc/init.d/istatd-agent stop || true
+ fi
+fi
+
# Let's ensure we have an istatd user to use to run stuff
# /etc/passwd: istatd:x:100:101:Istatd Server:/var/db/istatd:/bin/false
# /etc/group: istatd:x:101:
@@ -38,9 +51,9 @@ if [ ! -d $DATADIR ] ; then
/bin/chmod 775 $DATADIR
fi
-if [ ! -f /var/log/istatd.log ] ; then
- /bin/touch /var/log/istatd.log
- chown istatd.istatd /var/log/istatd.log
+if [ ! -f /var/log/istatd-agent.log ] ; then
+ /bin/touch /var/log/istatd-agent.log
+ chown istatd.istatd /var/log/istatd-agent.log
fi
View
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -e
+
+if [ "$1" != "remove" -a "$1" != "purge" ]; then
+ exit 0
+fi
+
+if [ -x "/etc/init.d/istatd-agent" ]; then
+ update-rc.d istatd-agent defaults
+ if [ -x /usr/sbin/invoke-rc.d ]; then
+ invoke-rc.d istatd-agent stop || true
+ else
+ /etc/init.d/istatd-agent stop || true
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0
File renamed without changes.
@@ -0,0 +1,50 @@
+usr/bin/istatd-server
+usr/bin/splitd
+usr/share/istatd/files/agents.html
+usr/share/istatd/files/autorefresh-active.png
+usr/share/istatd/files/autorefresh.png
+usr/share/istatd/files/closebox-hilite.png
+usr/share/istatd/files/closebox-press.png
+usr/share/istatd/files/closebox.png
+usr/share/istatd/files/dashboard-icon.png
+usr/share/istatd/files/dropdown-arrow.png
+usr/share/istatd/files/dygraph-combined.js
+usr/share/istatd/files/favicon.ico
+usr/share/istatd/files/filled-check.png
+usr/share/istatd/files/form.html
+usr/share/istatd/files/graph-close.png
+usr/share/istatd/files/graph-remove-counter.png
+usr/share/istatd/files/graph-zoomout.png
+usr/share/istatd/files/graph.js
+usr/share/istatd/files/index.html
+usr/share/istatd/files/jquery.min.js
+usr/share/istatd/files/refresh.png
+usr/share/istatd/files/resize-grabby.png
+usr/share/istatd/files/search-icon.png
+usr/share/istatd/files/sha256.js
+usr/share/istatd/files/slider-knob.png
+usr/share/istatd/files/slider-marker.png
+usr/share/istatd/files/styles.css
+usr/share/istatd/files/tree-leaf.png
+usr/share/istatd/files/tree-minus.png
+usr/share/istatd/files/tree-plus.png
+usr/share/istatd/files/unfilled-check.png
+etc/init.d/istatd-server
+etc/default/istatd-server
+etc/istatd-server.cfg
+var/db/istatd/settings/cit.set
+var/db/istatd/settings/users.set
+usr/bin/istatd_filedump
+usr/bin/istatd_filegen
+usr/bin/istatd_fileinfo
+usr/bin/istatd_flush
+usr/bin/istatd_import
+usr/bin/istatd_lint
+usr/bin/istatd_loadtest
+usr/bin/istatd_netcat
+usr/bin/istatd_nums2file
+usr/bin/istatd_purge
+usr/bin/istatd_sleep
+usr/bin/istatd_stat
+usr/bin/random_numbers
+
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -e
+
+if [ "$1" != "configure" ]; then
+ exit 0
+fi
+
+if [ -x "/etc/init.d/istatd-server" ]; then
+ update-rc.d istatd-server defaults
+ if [ -x /usr/sbin/invoke-rc.d ]; then
+ invoke-rc.d istatd-server start ||true
+ else
+ /etc/init.d/istatd-server start ||true
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = purge ]; then
+ update-rc.d istatd-server remove
+fi
@@ -0,0 +1,60 @@
+#!/bin/sh -e
+
+# default data dir
+DATADIR=/var/db/istatd
+
+# Prior to istatd-server_0.65-1, istatd agent and server
+# was in one debian pacakge. This bit below, ensures
+# that the old istatd is stopped.
+if [ -x "/etc/init.d/istatd" ]; then
+ if [ -x /usr/sbin/invoke-rc.d ]; then
+ invoke-rc.d istatd stop || true
+ else
+ /etc/init.d/istatd stop || true
+ fi
+fi
+
+# For istatd-server_0.65-1 and later, stop the agent
+# in the event this is an upgrade.
+if [ -x "/etc/init.d/istatd-server" ]; then
+ if [ -x /usr/sbin/invoke-rc.d ]; then
+ invoke-rc.d istatd-server stop || true
+ else
+ /etc/init.d/istatd-server stop || true
+ fi
+fi
+
+# Let's ensure we have an istatd user to use to run stuff
+# /etc/passwd: istatd:x:100:101:Istatd Server:/var/db/istatd:/bin/false
+# /etc/group: istatd:x:101:
+
+# create istatd group if necessary
+if ! getent group istatd >/dev/null; then
+ addgroup --system istatd >/dev/null
+fi
+
+# create istatd user if necessary
+if ! getent passwd istatd >/dev/null; then
+ adduser \
+ --system \
+ --disabled-login \
+ --ingroup istatd \
+ --home $DATADIR \
+ --gecos "Istatd Server" \
+ --shell /bin/false \
+ istatd >/dev/null
+fi
+
+if [ ! -d $DATADIR ] ; then
+ /bin/mkdir -p $DATADIR
+ /bin/chown istatd.istatd $DATADIR
+ /bin/chmod 775 $DATADIR
+fi
+
+if [ ! -f /var/log/istatd-server.log ] ; then
+ /bin/touch /var/log/istatd-server.log
+ chown istatd.istatd /var/log/istatd-server.log
+fi
+
+
+#DEBHELPER#
View
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -e
+
+if [ "$1" != "remove" -a "$1" != "purge" ]; then
+ exit 0
+fi
+
+if [ -x "/etc/init.d/istatd-server" ]; then
+ update-rc.d istatd-server defaults
+ if [ -x /usr/sbin/invoke-rc.d ]; then
+ invoke-rc.d istatd-server stop || true
+ else
+ /etc/init.d/istatd-server stop || true
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0
View
@@ -1,19 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ "$1" != "configure" ]; then
- exit 0
-fi
-
-if [ -x "/etc/init.d/istatd" ]; then
- update-rc.d istatd defaults
- if [ -x /usr/sbin/invoke-rc.d ]; then
- invoke-rc.d istatd start ||true
- else
- /etc/init.d/istatd start ||true
- fi
-fi
-
-#DEBHELPER#
-
-exit 0
@@ -15,17 +15,17 @@ if [ `whoami` != 'root' ]; then
exit 1
fi
-DESC="IMVU Statistics Daemon"
-NAME=istatd
+DESC="IMVU Statistics Agent Daemon"
+NAME=istatd-agent
PIDFILE=/var/run/$NAME.pid
HOSTNAME=`hostname -s`
LOCALSTATS="^host.$HOSTNAME"
-DAEMON="/usr/bin/istatd"
-CONFIG=/etc/istatd.cfg
-LOGFILE=/var/log/istatd.log
+DAEMON="/usr/bin/istatd-agent"
+CONFIG=/etc/istatd-agent.cfg
+LOGFILE=/var/log/istatd-agent.log
#source defaults file
-[ -f /etc/default/istatd ] && . /etc/default/istatd
+[ -f /etc/default/istatd-agent ] && . /etc/default/istatd-agent
# first, cd to a "safe" place
cd /var/tmp
@@ -34,6 +34,8 @@ is_istatd_running() {
#in shell land, 0 is true!
if [ -s $PIDFILE ] && ps `cat $PIDFILE` | grep -q $DAEMON > /dev/null ; then
return 0
+ elif ps -FC $NAME | grep -q $DAEMON > /dev/null ; then
+ return 0
else
return 1
fi
@@ -51,7 +53,7 @@ start_istatd() {
echo -n "$NAME."
echo
else
- echo "ISTATD is not enabled. Modify /etc/default/istatd to enable."
+ echo "ISTATD Agent is not enabled. Modify /etc/default/istatd-agent to enable."
fi
}
@@ -63,6 +65,8 @@ stop_istatd() {
if [ -s $PIDFILE ] && ps `cat $PIDFILE` | grep -q $DAEMON > /dev/null ; then
kill -TERM `cat $PIDFILE`
+ elif ps -FC $NAME | grep -q $DAEMON > /dev/null ; then
+ kill -TERM `ps -FC $NAME | grep $DAEMON | awk '{print $2}'`
fi
if ! is_istatd_running ; then
View
@@ -0,0 +1,5 @@
+#!/bin/sh
+# 0: enable istatd agent when the /etc/init.d/istatd-agent script is invoked
+# default: 0
+ENABLE_ISTATD=0
+EXTRA_ARGS=""
Oops, something went wrong.

0 comments on commit d645215

Please sign in to comment.