forked from OpenTSDB/opentsdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add files necessary to compile a Debian package
Add default logging and TSD configs for Debian installs Add "debian" compile option to build a debian package Modify tsdb.in with a config path variable Modify tsdb.in to add the config path and other directories to the classpath when distributed via package Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
- Loading branch information
Showing
10 changed files
with
379 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/etc/init.d/opentsdb | ||
/etc/opentsdb/opentsdb.conf | ||
/etc/opentsdb/logback.xml |
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,10 @@ | ||
Package: opentsdb | ||
Version: @version@ | ||
Architecture: all | ||
Maintainer: Chris Larsen <clarsen@euphoriaaudio.com> | ||
Depends: libc6, adduser | ||
Suggest: gnuplot, java7-runtime-headless | java6-runtime-headless | java7-runtime | java6-runtime | ||
Section: database | ||
Priority: optional | ||
Homepage: http://www.opentsdb.net/ | ||
Description: Time Series Daemon from OpenTSDB for storing and accessing time series data |
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,41 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
case "$1" in | ||
configure) | ||
[ -z "$TSD_USER" ] && TSD_USER="opentsdb" | ||
[ -z "$TSD_GROUP" ] && TSD_GROUP="opentsdb" | ||
if ! getent group "$TSD_GROUP" > /dev/null 2>&1 ; then | ||
addgroup --system "$TSD_GROUP" --quiet | ||
fi | ||
if ! id $TSD_USER > /dev/null 2>&1 ; then | ||
adduser --system --home /usr/share/opentsdb --no-create-home \ | ||
--ingroup "$TSD_GROUP" --disabled-password --shell /bin/false \ | ||
"$TSD_USER" | ||
fi | ||
|
||
# Set user permissions on /tmp/opentsdb and /var/log/opentsdb | ||
mkdir -p /tmp/opentsdb /var/log/opentsdb | ||
chown -R $TSD_USER:$TSD_GROUP /tmp/opentsdb /var/log/opentsdb | ||
chmod 755 /tmp/opentsdb /var/log/opentsdb | ||
|
||
# configuration files should not be modifiable by opentsdb user, as this can be a security issue | ||
chown -Rh root:root /etc/opentsdb/* | ||
chmod 755 /etc/opentsdb | ||
chmod 644 /etc/opentsdb/* | ||
;; | ||
esac | ||
|
||
|
||
if [ -e "/etc/init.d/opentsdb" ]; then | ||
chmod 755 /etc/init.d/opentsdb | ||
update-rc.d opentsdb defaults 95 10 >/dev/null | ||
|
||
# don't start automatically, the user will almost always need to tweak their config | ||
# if [ -e "`which invoke-rc.d 2>/dev/null`" ]; then | ||
# invoke-rc.d opentsdb start || true | ||
# else | ||
# /etc/init.d/opentsdb start || true | ||
# fi | ||
fi | ||
|
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,33 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
case "$1" in | ||
remove) | ||
# Remove logs | ||
rm -rf /var/log/opentsdb | ||
|
||
# remove **only** empty data dir | ||
rmdir -p --ignore-fail-on-non-empty /tmp/opentsdb | ||
;; | ||
|
||
purge) | ||
# Remove service | ||
update-rc.d opentsdb remove >/dev/null || true | ||
|
||
# Remove logs and data | ||
rm -rf /var/log/opentsdb /tmp/opentsdb | ||
|
||
# Remove user/group | ||
deluser opentsdb || true | ||
delgroup opentsdb || true | ||
;; | ||
|
||
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) | ||
# Nothing to do here | ||
;; | ||
|
||
*) | ||
echo "$0 called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
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,10 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ -x "/etc/init.d/opentsdb" ]; then | ||
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then | ||
invoke-rc.d opentsdb stop || true | ||
else | ||
/etc/init.d/opentsdb stop || true | ||
fi | ||
fi |
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,127 @@ | ||
#!/bin/sh -e | ||
# | ||
# Modified from original source: Elastic Search | ||
# https://github.com/elasticsearch/elasticsearch | ||
# Thank you to the Elastic Search authors | ||
# | ||
### BEGIN INIT INFO | ||
# Provides: opentsdb | ||
# Required-Start: $network $named | ||
# Required-Stop: $network $named | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: Starts OpenTSDB TSD | ||
# Description: Starts an OpenTSDB time series daemon | ||
### END INIT INFO | ||
|
||
PATH=/bin:/usr/bin:/sbin:/usr/sbin | ||
NAME=opentsdb | ||
TSD_USER=opentsdb | ||
TSD_GROUP=opentsdb | ||
|
||
# Maximum number of open files | ||
MAX_OPEN_FILES=65535 | ||
|
||
. /lib/lsb/init-functions | ||
|
||
# The first existing directory is used for JAVA_HOME | ||
# (if JAVA_HOME is not defined in $DEFAULT) | ||
JDK_DIRS="/usr/lib/jvm/java-7-oracle /usr/lib/jvm/java-7-openjdk \ | ||
/usr/lib/jvm/java-7-openjdk-amd64/ /usr/lib/jvm/java-7-openjdk-i386/ \ | ||
/usr/lib/jvm/java-6-sun /usr/lib/jvm/java-6-openjdk \ | ||
/usr/lib/jvm/java-6-openjdk-amd64 /usr/lib/jvm/java-6-openjdk-i386" | ||
|
||
# Look for the right JVM to use | ||
for jdir in $JDK_DIRS; do | ||
if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then | ||
JAVA_HOME="$jdir" | ||
fi | ||
done | ||
export JAVA_HOME | ||
|
||
# Define other required variables | ||
PID_FILE=/var/run/$NAME.pid | ||
|
||
DAEMON=/usr/share/opentsdb/bin/tsdb | ||
DAEMON_OPTS=tsd | ||
|
||
case "$1" in | ||
start) | ||
|
||
if [ -z "$JAVA_HOME" ]; then | ||
log_failure_msg "no JDK found - please set JAVA_HOME" | ||
exit 1 | ||
fi | ||
|
||
log_action_begin_msg "Starting TSD" | ||
if start-stop-daemon --test --start --pidfile "$PID_FILE" \ | ||
--user "$TSD_USER" --exec "$JAVA_HOME/bin/java" \ | ||
>/dev/null; then | ||
|
||
touch "$PID_FILE" && chown "$TSD_USER":"$TSD_GROUP" "$PID_FILE" | ||
|
||
if [ -n "$MAX_OPEN_FILES" ]; then | ||
ulimit -n $MAX_OPEN_FILES | ||
fi | ||
|
||
# start the daemon | ||
start-stop-daemon --start -b --user "$TSD_USER" -c "$TSD_USER" \ | ||
--make-pidfile --pidfile "$PID_FILE" \ | ||
--exec /bin/bash -- -c "$DAEMON $DAEMON_OPTS" | ||
|
||
sleep 1 | ||
if start-stop-daemon --test --start --pidfile "$PID_FILE" \ | ||
--user "$TSD_USER" --exec "$JAVA_HOME/bin/java" \ | ||
>/dev/null; then | ||
|
||
if [ -f "$PID_FILE" ]; then | ||
rm -f "$PID_FILE" | ||
fi | ||
|
||
log_failure_msg "Failed to start the TSD" | ||
else | ||
log_action_end_msg 0 | ||
fi | ||
|
||
else | ||
log_action_cont_msg "TSD is already running" | ||
|
||
log_action_end_msg 0 | ||
fi | ||
;; | ||
|
||
stop) | ||
log_action_begin_msg "Stopping TSD" | ||
set +e | ||
if [ -f "$PID_FILE" ]; then | ||
start-stop-daemon --stop --pidfile "$PID_FILE" \ | ||
--user "$TSD_USER" --retry=TERM/20/KILL/5 >/dev/null | ||
if [ $? -eq 1 ]; then | ||
log_action_cont_msg "TSD is not running but pid file exists, cleaning up" | ||
elif [ $? -eq 3 ]; then | ||
PID="`cat $PID_FILE`" | ||
log_failure_msg "Failed to stop TSD (pid $PID)" | ||
exit 1 | ||
fi | ||
rm -f "$PID_FILE" | ||
else | ||
log_action_cont_msg "TSD was not running" | ||
fi | ||
log_action_end_msg 0 | ||
set -e | ||
;; | ||
|
||
restart|force-reload) | ||
if [ -f "$PID_FILE" ]; then | ||
$0 stop | ||
sleep 1 | ||
fi | ||
$0 start | ||
;; | ||
*) | ||
echo "Usage: /etc/init.d/opentsdb {start|stop|restart}" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |
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,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<!--<jmxConfigurator/>--> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern> | ||
%d{ISO8601} %-5level [%thread] %logger{0}: %msg%n | ||
</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<appender name="CYCLIC" class="ch.qos.logback.core.read.CyclicBufferAppender"> | ||
<MaxSize>1024</MaxSize> | ||
</appender> | ||
|
||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>/var/log/opentsdb/opentsdb.log</file> | ||
<append>true</append> | ||
|
||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> | ||
<fileNamePattern>/var/log/opentsdb/opentsdb.log.%i</fileNamePattern> | ||
<minIndex>1</minIndex> | ||
<maxIndex>3</maxIndex> | ||
</rollingPolicy> | ||
|
||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> | ||
<maxFileSize>128MB</maxFileSize> | ||
</triggeringPolicy> | ||
|
||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} %-5level [%logger{0}.%M] - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<logger name="org.apache.zookeeper" level="INFO"/> | ||
<logger name="org.hbase.async" level="INFO"/> | ||
<logger name="com.stumbleupon.async" level="INFO"/> | ||
<root level="INFO"> | ||
<appender-ref ref="STDOUT"/> | ||
<appender-ref ref="CYCLIC"/> | ||
<appender-ref ref="FILE"/> | ||
</root> | ||
</configuration> |
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,63 @@ | ||
# --------- NETWORK ---------- | ||
# The TCP port TSD should use for communications | ||
# *** REQUIRED *** | ||
tsd.network.port = 4242 | ||
|
||
# The IPv4 network address to bind to, defaults to all addresses | ||
# tsd.network.bind = 0.0.0.0 | ||
|
||
# Enables Nagel's algorithm to reduce the number of packets sent over the | ||
# network, default is True | ||
#tsd.network.tcpnodelay = true | ||
|
||
# Determines whether or not to send keepalive packets to peers, default | ||
# is True | ||
#tsd.network.keepalive = true | ||
|
||
# Determines if the same socket should be used for new connections, default | ||
# is True | ||
#tsd.network.reuseaddress = true | ||
|
||
# Number of worker threads dedicated to Netty, defaults to # of CPUs * 2 | ||
#tsd.network.worker_threads = 8 | ||
|
||
# Whether or not to use NIO or tradditional blocking IO, defaults to True | ||
#tsd.network.async_io = true | ||
|
||
# ----------- HTTP ----------- | ||
# The location of static files for the HTTP GUI interface. | ||
# *** REQUIRED *** | ||
tsd.http.staticroot = /usr/share/opentsdb/static/ | ||
|
||
# Where TSD should write it's cache files to | ||
# *** REQUIRED *** | ||
tsd.http.cachedir = /tmp/opentsdb | ||
|
||
# --------- CORE ---------- | ||
# Whether or not to automatically create UIDs for new metric types, default | ||
# is False | ||
#tsd.core.auto_create_metrics = false | ||
|
||
# Full path to a directory containing plugins for OpenTSDB | ||
tsd.core.plugin_path = /usr/share/opentsdb/plugins | ||
|
||
# --------- STORAGE ---------- | ||
# Whether or not to enable data compaction in HBase, default is True | ||
#tsd.storage.enable_compaction = true | ||
|
||
# How often, in milliseconds, to flush the data point queue to storage, | ||
# default is 1,000 | ||
# tsd.storage.flush_interval = 1000 | ||
|
||
# Name of the HBase table where data points are stored, default is "tsdb" | ||
#tsd.storage.hbase.data_table = tsdb | ||
|
||
# Name of the HBase table where UID information is stored, default is "tsdb-uid" | ||
#tsd.storage.hbase.uid_table = tsdb-uid | ||
|
||
# Path under which the znode for the -ROOT- region is located, default is "/hbase" | ||
#tsd.storage.hbase.zk_basedir = /hbase | ||
|
||
# A space separated list of Zookeeper hosts to connect to, with or without | ||
# port specifiers, default is "localhost" | ||
#tsd.storage.hbase.zk_quorum = localhost |
Oops, something went wrong.