Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit d64521521bbd13d916737a6dde6174cfa7f5558f 1 parent c9f45d0
@jfschedler jfschedler authored
View
12 Makefile
@@ -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
28 debian/control
@@ -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.
View
4 debian/istatd-agent.install
@@ -0,0 +1,4 @@
+usr/bin/istatd-agent
+etc/init.d/istatd-agent
+etc/default/istatd-agent
+etc/istatd-agent.cfg
View
19 debian/istatd-agent.postinst
@@ -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
View
2  debian/postrm → debian/istatd-agent.postrm
@@ -3,5 +3,5 @@
set -e
if [ "$1" = purge ]; then
- update-rc.d istatd remove
+ update-rc.d istatd-agent remove
fi
View
19 debian/preinst → debian/istatd-agent.preinst
@@ -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
19 debian/istatd-agent.prerm
@@ -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
View
0  debian/istatd.dirs → debian/istatd-server.dirs
File renamed without changes
View
50 debian/istatd-server.install
@@ -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
+
View
19 debian/istatd-server.postinst
@@ -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
View
7 debian/istatd-server.postrm
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = purge ]; then
+ update-rc.d istatd-server remove
+fi
View
60 debian/istatd-server.preinst
@@ -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
19 debian/istatd-server.prerm
@@ -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
19 debian/postinst
@@ -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
View
18 istatd-init.sh → istatd-agent-init.sh
@@ -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
5 istatd-agent.default
@@ -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=""
View
43 istatd-agent.settings
@@ -0,0 +1,43 @@
+# istatd-agent configuration for a typical agent installation
+--stat-port 8001
+--store ""
+--num-files 1024
+--local-stats ""
+--rollup 0
+--min-space -1
+
+# replicate to a host name istatd-master
+--replica-of ""
+--replica-port 0
+--agent istatd-master:18001
+--agent-interval 10
+
+# http interface
+--http-port 0
+
+# daemon configuration
+--user istatd
+--debug ""
+--fake-time 0
+--thread-count 1
+--daemonize
+--pid-file /var/run/istatd-agent.pid
+--admin-port 0
+
+# log file configuration;
+# log levels
+# 0 == only bad errors
+# 1 == warnings
+# 2 == notice
+# 3 == debug
+# 4 == spam
+--log-file /var/log/istatd-agent.log
+--log-level 1
+
+# irrelevant agent configurations, but they are explictly stated
+# here to ensure all defaults are listed in this file
+--flush 300
+--retention 10s:10d,5m:1y9d,1h:6y12d
+--files-dir files
+--settings /tmp
+
View
111 istatd-server-init.sh
@@ -0,0 +1,111 @@
+#!/bin/bash
+
+### BEGIN INIT INFO
+# Provides: istatd
+# Required-Start:
+# Required-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start collecting statistics
+# Description: Istatd collects statistics for later graphing and analysis
+### END INIT INFO
+
+if [ `whoami` != 'root' ]; then
+ echo "You must be root!"
+ exit 1
+fi
+
+DESC="IMVU Statistics Server Daemon"
+NAME=istatd-server
+PIDFILE=/var/run/$NAME.pid
+HOSTNAME=`hostname -s`
+LOCALSTATS="^host.$HOSTNAME"
+DAEMON="/usr/bin/istatd-server"
+CONFIG=/etc/istatd-server.cfg
+LOGFILE=/var/log/istatd-server.log
+
+#source defaults file
+[ -f /etc/default/istatd-server ] && . /etc/default/istatd-server
+
+# first, cd to a "safe" place
+cd /var/tmp
+
+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
+}
+
+start_istatd() {
+ if [ "$ENABLE_ISTATD" -eq 1 ]; then
+ echo -n "Starting $DESC: "
+ "$DAEMON" \
+ --daemonize \
+ --pid-file "$PIDFILE" \
+ --config "$CONFIG" \
+ --log-file "$LOGFILE" \
+ $EXTRA_ARGS
+ echo -n "$NAME."
+ echo
+ else
+ echo "ISTATD Server is not enabled. Modify /etc/default/istatd-server to enable."
+ fi
+}
+
+stop_istatd() {
+ echo -n "Stopping $DESC: "
+ I=0
+ while [ $I -lt 10 ] && is_istatd_running ; do
+ let I=$I+1
+
+ 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
+ break
+ fi
+ sleep 1
+ done
+
+ if is_istatd_running ; then
+ echo "failed"
+ else
+ echo "stopped"
+ fi
+}
+
+status_istatd() {
+ if is_istatd_running ; then
+ echo $NAME is running
+ else
+ echo $NAME is stopped
+ fi
+}
+
+case "$1" in
+ start)
+ start_istatd
+ ;;
+ stop)
+ stop_istatd
+ ;;
+ status)
+ status_istatd
+ ;;
+ restart)
+ stop_istatd
+ start_istatd
+ ;;
+ *)
+ echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}" >&2
+ exit 1
+ ;;
+esac
View
5 istatd-server.default
@@ -0,0 +1,5 @@
+#!/bin/sh
+# 0: enable istatd server when the /etc/init.d/istatd-server script is invoked
+# default: 0
+ENABLE_ISTATD=0
+EXTRA_ARGS=""
View
39 istatd-server.settings
@@ -0,0 +1,39 @@
+# istatd-server configuration for a typical server installation
+--stat-port 18001
+--store /var/db/istatd/store
+--num-files 945000
+--flush 300
+--retention 10s:10d,5m:1y9d,1h:6y12d
+--local-stats ""
+--rollup 0
+--min-space -1
+
+# replicate
+--replica-of ""
+--replica-port 0
+--agent ""
+--agent-interval 10
+
+# http interface
+--files-dir /usr/share/istatd/files
+--http-port 8011
+
+# daemon configuration
+--user istatd
+--debug ""
+--fake-time 0
+--thread-count 8
+--daemonize
+--settings /var/db/istatd/settings
+--pid-file /var/run/istatd-server.pid
+--admin-port 8031
+
+# log file configuration;
+# log levels
+# 0 == only bad errors
+# 1 == warnings
+# 2 == notice
+# 3 == debug
+# 4 == spam
+--log-file /var/log/istatd-server.log
+--log-level 2
View
5 istatd.default
@@ -1,5 +0,0 @@
-#!/bin/sh
-# 0: enable istatd when the /etc/init.d/istatd script is invoked
-# default: 0
-ENABLE_ISTATD=0
-EXTRA_ARGS=""
View
13 istatd.settings
@@ -1,13 +0,0 @@
-# istatd for a typical installation
---store /var/db/istatd/store
---settings /var/db/istatd/settings
---pid-file /var/run/istatd.pid
---log-file /var/log/istatd.log
---log-level 2
---num-files 100000
---flush 300
---thread-count 8
---stat-port 8001
---http-port 8011
---admin-port 8031
---files-dir /usr/share/istatd/files
View
2  make.def
@@ -40,7 +40,7 @@ endef
define build_tool
bin/$(1): obj/tool/$(1).o $(LIB_DEPS)
$(CXX) -o $$@ $$< $(LXXFLAGS) $(SYS_LIBS)
-$(eval $(call add_install,bin/$(1),$(VAR_PREFIX)/lib/istatd/bin/$(1),775))
+$(eval $(call add_install,bin/$(1),$(USR_PREFIX)/bin/$(1),775))
endef
define build_dir
Please sign in to comment.
Something went wrong with that request. Please try again.