From 8f28398d07901caec35382d0e349b9f13f7f9dbe Mon Sep 17 00:00:00 2001
From: Craig Bryant <craig.bryant@hp.com>
Date: Mon, 20 Apr 2015 11:07:48 -0600
Subject: [PATCH] Only the jar and sample config in the deb

Remove control scripts from deb

Update sample config file to be more current

Change-Id: If2b11dd1cab807f58b4b23a0a1933fb179032964
---
 thresh/pom.xml                              | 10 ----
 thresh/src/assembly/tar.xml                 |  8 ---
 thresh/src/deb/control/postinst             | 16 ------
 thresh/src/deb/control/postrm               |  9 ----
 thresh/src/deb/etc/thresh-config.yml-sample | 59 +++++++++++++++------
 thresh/src/deb/init/monasca-thresh          | 50 -----------------
 6 files changed, 44 insertions(+), 108 deletions(-)
 delete mode 100755 thresh/src/deb/control/postinst
 delete mode 100644 thresh/src/deb/control/postrm
 delete mode 100755 thresh/src/deb/init/monasca-thresh

diff --git a/thresh/pom.xml b/thresh/pom.xml
index d697e7b..b9195df 100644
--- a/thresh/pom.xml
+++ b/thresh/pom.xml
@@ -332,16 +332,6 @@
                                     </src>
                                     <dst>/opt/monasca/monasca-thresh.jar</dst>
                                 </data>
-                                <data>
-                                    <type>file</type>
-                                    <src>${project.basedir}/src/deb/init/monasca-thresh</src>
-                                    <dst>/etc/init.d/monasca-thresh</dst>
-                                </data>
-                                <data>
-                                    <type>file</type>
-                                    <src>${project.basedir}/src/main/resources/logback.xml</src>
-                                    <dst>/etc/monasca/logback.xml</dst>
-                                </data>
                                 <data>
                                     <type>file</type>
                                     <src>
diff --git a/thresh/src/assembly/tar.xml b/thresh/src/assembly/tar.xml
index f91fb6e..035bf96 100644
--- a/thresh/src/assembly/tar.xml
+++ b/thresh/src/assembly/tar.xml
@@ -25,13 +25,5 @@
         <source>${project.basedir}/src/deb/etc/thresh-config.yml-sample</source>
         <outputDirectory>examples</outputDirectory>
     </file>
-    <file>
-        <source>${project.basedir}/src/main/resources/logback.xml</source>
-        <outputDirectory>examples</outputDirectory>
-    </file>
-    <file>
-        <source>${project.basedir}/src/deb/init/monasca-thresh</source>
-        <outputDirectory>examples</outputDirectory>
-    </file>
   </files>
 </assembly>
diff --git a/thresh/src/deb/control/postinst b/thresh/src/deb/control/postinst
deleted file mode 100755
index 589b64a..0000000
--- a/thresh/src/deb/control/postinst
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-case "$1" in
-  configure)
-    chmod +x /etc/init.d/monasca-thresh
-    if ! [ `getent passwd thresh` ]; then
-      adduser --system --group thresh
-    fi
-
-    #Restart does not pick up upstart job config changes stop/start is needed
-    service monasca-thresh stop
-    service monasca-thresh start
-  ;;
-esac
-
-exit 0
diff --git a/thresh/src/deb/control/postrm b/thresh/src/deb/control/postrm
deleted file mode 100644
index 41e421a..0000000
--- a/thresh/src/deb/control/postrm
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-case "$1" in
-  remove|purge)
-    userdel thresh
-  ;;
-esac
-
-exit 0
diff --git a/thresh/src/deb/etc/thresh-config.yml-sample b/thresh/src/deb/etc/thresh-config.yml-sample
index 369a982..c52dbdc 100755
--- a/thresh/src/deb/etc/thresh-config.yml-sample
+++ b/thresh/src/deb/etc/thresh-config.yml-sample
@@ -1,14 +1,21 @@
-metricSpoutThreads: 1
-metricSpoutTasks: 1
+metricSpoutThreads: 2
+metricSpoutTasks: 2
+
+statsdConfig:
+  host: localhost
+  port: 8125
+  prefix: monasca.storm.
+  dimensions: !!map
+    service : monitoring
+    component : storm
+
 
 metricSpoutConfig:
-
-  #Kafka settings.
   kafkaConsumerConfiguration:
   # See http://kafka.apache.org/documentation.html#api for semantics and defaults.
-    topic: test
+    topic: metrics
     numThreads: 1
-    groupId: 1
+    groupId: thresh-metric
     zookeeperConnect: localhost:2181
     consumerId: 1
     socketTimeoutMs: 30000
@@ -25,18 +32,17 @@ metricSpoutConfig:
     autoOffsetReset: largest
     consumerTimeoutMs:  -1
     clientId : 1
-    zookeeperSessionTimeoutMs : 6000
-    zookeeperConnectionTimeoutMs : 6000
+    zookeeperSessionTimeoutMs : 60000
+    zookeeperConnectionTimeoutMs : 60000
     zookeeperSyncTimeMs: 2000
 
 
 eventSpoutConfig:
-  #Kafka settings.
   kafkaConsumerConfiguration:
   # See http://kafka.apache.org/documentation.html#api for semantics and defaults.
-    topic: test
+    topic: events
     numThreads: 1
-    groupId: 1
+    groupId: thresh-event
     zookeeperConnect: localhost:2181
     consumerId: 1
     socketTimeoutMs: 30000
@@ -53,17 +59,40 @@ eventSpoutConfig:
     autoOffsetReset: largest
     consumerTimeoutMs:  -1
     clientId : 1
-    zookeeperSessionTimeoutMs : 6000
-    zookeeperConnectionTimeoutMs : 6000
+    zookeeperSessionTimeoutMs : 60000
+    zookeeperConnectionTimeoutMs : 60000
     zookeeperSyncTimeMs: 2000
 
 
+kafkaProducerConfig:
+  # See http://kafka.apache.org/documentation.html#api for semantics and defaults.
+  topic: alarm-state-transitions
+  metadataBrokerList: localhost:9092
+  serializerClass: kafka.serializer.StringEncoder
+  partitionerClass:
+  requestRequiredAcks: 1
+  requestTimeoutMs: 10000
+  producerType: sync
+  keySerializerClass:
+  compressionCodec: none
+  compressedTopics:
+  messageSendMaxRetries: 3
+  retryBackoffMs: 100
+  topicMetadataRefreshIntervalMs: 600000
+  queueBufferingMaxMs: 5000
+  queueBufferingMaxMessages: 10000
+  queueEnqueueTimeoutMs: -1
+  batchNumMessages: 200
+  sendBufferBytes: 102400
+  clientId : Threshold_Engine
+
+
 sporadicMetricNamespaces:
   - foo
 
 database:
-  driverClass: com.vertica.jdbc.Driver
-  url: jdbc:vertica://mini-mon:5433/monasca
+  driverClass: com.mysql.jdbc.Driver
+  url: jdbc:mysql://localhost/mon?useSSL=true
   user: thresh
   password: password
   properties:
diff --git a/thresh/src/deb/init/monasca-thresh b/thresh/src/deb/init/monasca-thresh
deleted file mode 100755
index 9742f9f..0000000
--- a/thresh/src/deb/init/monasca-thresh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides:          monasca-thresh
-# Required-Start:    $nimbus
-# Required-Stop:
-# Default-Start:     2 3 4 5
-# Default-Stop:
-# Short-Description: Monitoring threshold engine running under storm
-# Description:
-### END INIT INFO
-
-case "$1" in
-    start)
-      $0 status
-      if [ $? -ne 0 ]; then
-        sudo -Hu thresh /opt/storm/current/bin/storm jar /opt/monasca/monasca-thresh.jar monasca.thresh.ThresholdingEngine /etc/monasca/thresh-config.yml thresh-cluster
-        exit $?
-      else
-        echo "monasca-thresh is already running"
-        exit 0
-      fi
-    ;;
-    stop)
-      # On system shutdown storm is being shutdown also and this will hang so skip shutting down thresh in that case
-      if [ -e '/sbin/runlevel' ]; then  # upstart/sysV case
-        if [ $(runlevel | cut -d\  -f 2) == 0 ]; then
-          exit 0
-        fi
-      else  # systemd case
-        systemctl list-units --type=target |grep shutdown.target
-        if [ $? -eq 0 ]; then
-          exit 0
-        fi
-      fi
-      sudo -Hu thresh /opt/storm/current/bin/storm kill thresh-cluster
-      # The above command returns but actually takes awhile loop watching status
-      while true; do
-        sudo -Hu thresh /opt/storm/current/bin/storm list |grep thresh-cluster
-        if [ $? -ne 0 ]; then break; fi
-        sleep 1
-      done
-    ;;
-    status)
-        sudo -Hu thresh /opt/storm/current/bin/storm list |grep thresh-cluster
-    ;;
-    restart)
-      $0 stop
-      $0 start
-    ;;
-esac