diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2017-08-01 10:19:21 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2017-08-01 10:19:21 +0100 |
commit | 8a45a5152f953c5573bd18a3bd8b0785f3dea513 (patch) | |
tree | abb9828e1a6c4cf727080a61e666873306444f7a | |
parent | 499b54c5b81bdd63f622e99a9dc0dbaf08bc8d01 (diff) |
Removed lots of cruft, and merged the example.conf with etc/mauveserver.conf
-rw-r--r-- | bytemark_policy.txt | 125 | ||||
-rw-r--r-- | etc/mauveserver.conf | 189 | ||||
-rw-r--r-- | example.conf | 197 | ||||
-rwxr-xr-x | utils/buffer_size.sh | 32 | ||||
-rw-r--r-- | utils/clear_wrong_reminder.sql | 4 | ||||
-rwxr-xr-x | utils/get_last_test_db.sh | 3 | ||||
-rwxr-xr-x | utils/get_last_test_log.sh | 3 | ||||
-rwxr-xr-x | utils/get_live_db.sh | 3 | ||||
-rwxr-xr-x | utils/init_jmauve.sh | 80 | ||||
-rwxr-xr-x | utils/init_mauve.sh | 83 | ||||
-rwxr-xr-x | utils/packet_processing.sh | 32 | ||||
-rwxr-xr-x | utils/run_android.sh | 2 | ||||
-rwxr-xr-x | utils/supportbot-mauve | 73 | ||||
-rwxr-xr-x | utils/test-smack.rb | 101 |
14 files changed, 142 insertions, 785 deletions
diff --git a/bytemark_policy.txt b/bytemark_policy.txt deleted file mode 100644 index 22378ae..0000000 --- a/bytemark_policy.txt +++ /dev/null @@ -1,125 +0,0 @@ -server { - ip "0.0.0.0" - port 32741 - log_file STDOUT - log_level 0 - database "sqlite3:///tmp/mauve_test.db" - transmission_id_expire_time 600 - - web_interface { - port 1288 - } -} - -notification_method("xmpp") { - jid "mauveserv@chat.bytemark.co.uk" - password "foo" -} - -notification_method("email") { - # add in SMTP server, username, password etc. - # default to sending through localhost - from "matthew@bytemark.co.uk" - server "bytemail.bytemark.co.uk" - subject_prefix "[Bytemark alerts] " - #deliver_to_file "/tmp/alerts.txt" -} - -notification_method("sms") { - provider "AQL" - - username "bytemark" - password "foo" - from "01904890890" - max_messages_per_alert 3 -} - -person("office") { - #all { xmpp "office@conference.chat.bytemark.co.uk" } - all { email "matthew@bytemark.co.uk" } -} - -person("mbloch") { - urgent { sms("x") } - normal { xmpp("mbloch@chat.bytemark.co.uk") || email("matthew@bytemark.co.uk") } - low { email("matthew@bytemark.co.uk") } -} - -person("ptaphouse") { - urgent { sms("x") } - normal { xmpp("ptaphouse@chat.bytemark.co.uk") || email("pete@bytemark.co.uk") } - low { email("pete@bytemark.co.uk") } -} - -person("chris") { -} - -alert_group { - includes { - source == "supportbot" || source == "managed-monitor" - } - - acknowledgement_time 90.minutes - - level URGENT - - notify("office") { - every 30.minutes - } - - notify("mbloch") { - every 60.minutes - hours_in_day(0..8, 17..23) - unacknowledged(120.minutes) - } -} - -alert_group { - includes { source == "network-crit" } - level URGENT - acknowledgement_time 90.minutes - - notify("office") { every 15.minutes } - notify("ptaphouse") { every 30.minutes } - notify("mbloch") { - every 30.minutes - unacknowledged(95.minutes) - } -} - -alert_group { - includes { source == "networkmonitor" } - acknowledgement_time 7.days - - notify("office") { every 120.minutes } -} - -alert_group { - includes { source == "disks" } - acknowledgement_time 1.day - - notify("chris") { every 4.hours } - notify("mbloch","ptaphouse") { - every 12.hours - unacknowledged 24.hours - } - -} - -alert_group { - includes { source == "pxefs" } - level URGENT - - notify("office") { every 1.hour } - notify("mbloch") { - every 3.hours - unacknowledged 24.hours - } -} - -alert_group("default") { - level LOW - - notify("office") { every 3.hours } -} - diff --git a/etc/mauveserver.conf b/etc/mauveserver.conf index bd975ab..e0b74d0 100644 --- a/etc/mauveserver.conf +++ b/etc/mauveserver.conf @@ -1,56 +1,163 @@ # Example mauveserver.conf file, based on Bytemark's configuration. -# Probably still needs a bit of improvement and explanation. -# -# The service which listens for alert messages +# +# This is the main configuration clause for the server instance. # server { - # - # persistent data store # - database "sqlite3:///var/lib/mauvealert/alerts.db" + # This is where our database lives. Example strings are as follows: + # + # postgres://username:password@host/database + # sqlite3:///var/lib/mauvealert/alerts.db + # + database "sqlite3::memory:" + + # + # This is our hostname. It gets used when URLs are generated, and in the heartbeat alert. + # + hostname `hostname`.chomp + # + # This is the UDP listener. + # listener { - ip "0.0.0.0" + # + # This is the IP and port for that the UDP packets come in on. The IP can + # be IPv4 or 6. If "::" is specified, then packets will be received over + # both IPv4 and 6. The default port is 32741. + # + ip "::" port 32741 + + # + # This is how long the UDP server will sleep between looking for packets. + # + poll_every 1 + } + + + # + # This is the processing thread, which recieves packets, and updates the + # database as needed. + # + processor { + # + # This is the length of time the processor will sleep between checking for + # new packets from the UDP listener. + # + poll_every 1 + + # + # In order to make sure the same transmission isn't received more then + # once, a cache of transmission IDs is kept. This expire time below + # determines the interval over which this cache is expired. + # + transmission_cache_expire_time 300 } - - # default is probably more than enough! - # transmission_id_expire_time 600 - # few options for web interface, just the TCP port number + # + # The web interface + # web_interface { - ip "127.0.0.1" + # + # The listening IP and port. Can be IPv4 or IPv6. Bear in mind that for + # ports < 1024, mauveserver will need to be run as root, or have special + # dispensation. + # + ip "::" port 1288 - document_root "/srv/mauvealert" + + # + # This is where the template files live. + # + # document_root "/srv/mauvealert" + + # + # This is used in the cookie, to prevent session-stealing. + # + session_secret "PLEASE CHANGE ME" + } + + + # + # This is where the mauve server sends its own heartbeat. Useful for + # watching the watcher. + # + heartbeat { + # + # If no destination is specified, then the contents of + # /etc/mauvealert/mauvesend.destination are used. + # + destination "localhost" + # + # This is how long to wait before the alert is raised + # + raise_after 600 + # + # These two fields have sensible defaults set, but more informative + # messages can be set here. + # + summary "Mauve alert server is down" + detail "The Mauve alert server has failed to send a heartbeat" } + } +# +# The logger uses log4r +# logger { + # + # This is the default formatting string. It is a PatternFormatter, which is + # described at + # http://log4r.rubyforge.org/rdoc/Log4r/rdoc/patternformatter.html + # default_format "%d [ %6.6l ] [ %12.12c ] %m" - outputter("file") { - filename "/var/log/mauvealert/mauvealert.log" - trunc false + # + # This is the default logging level. It can be one of + # + # Log4r::DEBUG + # Log4r::INFO + # Log4r::NOTICE + # Log4r::WARN + # Log4r::ERROR + # Log4r::FATAL + # + default_level Log4r::INFO + + # + # An outputter can be any one of those listed at + # http://log4r.rubyforge.org/rdoc/Log4r/rdoc/outputter.html. The name must + # correspond to the class name. The options in each outputter correspond to + # the "hash" arguments for that particular outputter class. + # + # Additionally each outputter can have a level, and format assoicated. + # + outputter("stdout") { level Log4r::INFO } -# outputter("stdout") { -# level Log4r::DEBUG -# } + outputter("file") { + filename "/tmp/mauveserver.log" + trunc true + level Log4r::DEBUG + } # outputter("email") { -# server "localhost" +# server "smtp.example.com" # subject "Mauve logger output" -# from "mauvealert@localhost" -# to "boring@localhost" -# domain "localhost" +# from "#{ENV['USER']}@#{Socket.gethostname}" +# to "awooga@example.com" # level Log4r::WARN # } } +# +# Email messaging. +# notification_method("email") { # # email address to send from @@ -62,25 +169,18 @@ notification_method("email") { # server "localhost" - # + # # add this to the subject of any emails we send # subject_prefix "[mauvealert]" } -# How to log into a jabber server -# -# notification_method("xmpp") { -# jid "mauvealert@chat.example.com/boo" -# password "x" -# } - # How to notify by SMS - we use aql.com, a provider for clockworksms.com # is also provided. For another provider, you'll need to write a module. # # notification_method("sms") { # provider "AQL" -# +# # username "x" # password "x" # from "01234567890" @@ -91,7 +191,7 @@ notification_method("email") { # # notification_method("sms") { # provider "Clockwork" -# +# # apikey "sssseeeeeeccccccccrrrrreeeeeettttsssssss" # from "01234567890" # @@ -102,7 +202,7 @@ notification_method("email") { # Simple default notification preference for root at this machine, at all # alert levels. You probably want more people, see below for a more complete # example. -# +# person("root") { all { email("root@localhost") } } @@ -113,18 +213,13 @@ person("root") { # # sms "07111222333" # email "johnny@example.com" -# xmpp "johnny@example.com.jabber.org" # # # Johnny wants waking up 24/7 if anything urgent happens # urgent { sms } # -# # XMPP, or Email him for anything that's not urgent -# normal { xmpp or email } -# -# # Anything else can just be a jabber message, which he might miss. -# # Email instead if he's unavailable/offline - but give it a try if -# # we don't know his status. -# low { xmpp("johnny@example.com.jabber.org", :if_presence => [:available, unknown]) || email } +# # Email him for anything that's not urgent +# normal { email } +# low { email } # # # SMS messages are expensive, if we're sending more than 5 per minute, # # tell the user we're going to stop until it slows down. @@ -145,22 +240,22 @@ person("root") { # suppress_notifications_after 3 => 1.hour # } -# Here is a group of alerts generated by the core routers. -# +# Here is a group of alerts generated by the core routers. +# # alert_group { # level URGENT # includes { source == "core-router" } # # # Johnny should get up and fix these errors very quickly, we will # # bother him every 15 minutes until he does. -# # +# # # notify("johnny") { every 15.minutes } # # # Archie only wants to know about these alerts if they have gone # # unacknowledged for a whole hour - Johnny must be slacking! Even # # then he only needs to know during the working day. # # -# notify("archie") { +# notify("archie") { # every 6.hours # during { unacknowledged(1.hour); hours_in_day(9..17) } # } @@ -168,7 +263,7 @@ person("root") { # # Default notification - tell root about all alerts every hour -# +# alert_group { level NORMAL notify("root") { every 1.hour } diff --git a/example.conf b/example.conf deleted file mode 100644 index dc40de7..0000000 --- a/example.conf +++ /dev/null @@ -1,197 +0,0 @@ -# -# This is the main configuration clause for the server instance. -# -server { - # - # This is where our database lives. SQLite is the default. - # - database "sqlite3::memory:" - - # - # This is our hostname. It gets used when URLs are generated, and in the heartbeat alert. - # - hostname "mauve.example.com" - - # - # This is the UDP listener. - # - listener { - # - # This is the IP and port for that the UDP packets come in on. The IP can - # be IPv4 or 6. If "::" is specified, then packets will be received over - # both IPv4 and 6. The default port is 32741. - # - ip "::" - port 32741 - - # - # This is how long the UDP server will sleep between looking for packets. - # - poll_every 1 - } - - - # - # This is the processing thread, which recieves packets, and updates the - # database as needed. - # - processor { - # - # This is the length of time the processor will sleep between checking for - # new packets from the UDP listener. - # - poll_every 1 - - # - # In order to make sure the same transmission isn't received more then - # once, a cache of transmission IDs is kept. This expire time below - # determines the interval over which this cache is expired. - # - transmission_cache_expire_time 300 - } - - # - # The web interface - # - web_interface { - # - # The listening IP and port. Can be IPv4 or IPv6. Bear in mind that for - # ports < 1024, mauveserver will need to be run as root, or have special - # dispensation. - # - ip "::" - port 1288 - - # - # This is where the template files live. - # - # document_root "/usr/share/mauvealert/" - - # - # This is used in the cookie, to prevent session-stealing. - # - session_secret "PLEASE CHANGE ME" - } - - - # - # This is where the mauve server sends its own heartbeat. Useful for - # watching the watcher. - # - heartbeat { - # - # If no destination is specified, then the contents of - # /etc/mauvealert/mauvesend.destination are used. - # - destination "localhost" - # - # This is how long to wait before the alert is raised - # - raise_after 600 - # - # These two fields have sensible defaults set, but more informative - # messages can be set here. - # - summary "Mauve alert server is down" - detail "The Mauve alert server has failed to send a heartbeat" - } - -} - -# -# The logger uses log4r -# -logger { - - # - # This is the default formatting string. It is a PatternFormatter, which is - # described at - # http://log4r.rubyforge.org/rdoc/Log4r/rdoc/patternformatter.html - # - default_format "%d [ %6.6l ] [ %12.12c ] %m" - - # - # This is the default logging level. It can be one of - # - # Log4r::DEBUG - # Log4r::INFO - # Log4r::NOTICE - # Log4r::WARN - # Log4r::ERROR - # Log4r::FATAL - # - default_level Log4r::INFO - - # - # An outputter can be any one of those listed at - # http://log4r.rubyforge.org/rdoc/Log4r/rdoc/outputter.html. The name must - # correspond to the class name. The options in each outputter correspond to - # the "hash" arguments for that particular outputter class. - # - # Additionally each outputter can have a level, and format assoicated. - # - outputter("stdout") { - level Log4r::WARN - } - - outputter("file") { - filename "/tmp/mauveserver.log" - trunc true - level Log4r::DEBUG - } - -# outputter("email") { -# server "smtp.example.com" -# subject "Mauve logger output" -# from "#{ENV['USER']}@#{Socket.gethostname}" -# to "awooga@example.com" -# level Log4r::WARN -# } - -} - -# -# XMPP instant messaging. This are the credentials to log into the XMPP -# account that mauve will use. -# -#notification_method ("xmpp") { -# jid "mauve@chat.example.com/mauve" -# password "mauvespassword" -#} - -# -# Email messaging. -# -notification_method ("email") { - server "localhost" - from "mauve@desk1.tur.bytemark.co.uk" - subject_prefix "mauve-test" -} - -person("office_chat") { -# xmpp "muc:mauve-test@conference.chat.bytemark.co.uk/MauveAlert" -# all { xmpp } -# suppress_notifications_after(310 => 1.minute) -} - -person ("pcherry") { - password '82da4c33e3a5ae9e51def466745e2c8965fa1476' - all { true } -} - -people_list ("arse") { - list [ "office_chat" ] -} - -# -# Default notification - tell root about all alerts every hour -# -alert_group("default") { - level URGENT - - notify("arse") { - every 2.minutes - } -} - - diff --git a/utils/buffer_size.sh b/utils/buffer_size.sh deleted file mode 100755 index 02984b2..0000000 --- a/utils/buffer_size.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -NO_ARGS=0 -OPTERROR=65 -if [ $# -eq "$NO_ARGS" ] # Script invoked with no command-line args? -then - echo "Usage: `basename $0` File.log" - exit $OPTERROR # Exit and explain usage, if no argument(s) given. -fi -logFile=$1 - -egrep 'Buffer has [0-9]* packets left' $logFile |\ - awk 'BEGIN {print " date sz"} {print s++ " " $1 "::" $2 " " $10}' > data - -R --vanilla --no-save --slave <<RSCRIPT -lst <- read.table("data") -attach(lst) -summary(sz) -png(filename="buffer.png", width=1024) -dates <- strptime(as.character(date), "%Y-%m-%d::%H:%M:%S") -plot(dates, sz, type='l', - main="Mauve server: Maximum buffer size per second", - xlab="Time", - ylab="Maximum number of packets waiting to be processed") -abline(h=1.05, col="red") -abline(h=mean(sz), col="blue") -RSCRIPT -img=`which qiv` -if [ $? != 0 ] -then echo "Cannot display image here" -else $img buffer.png -fi diff --git a/utils/clear_wrong_reminder.sql b/utils/clear_wrong_reminder.sql deleted file mode 100644 index fde0504..0000000 --- a/utils/clear_wrong_reminder.sql +++ /dev/null @@ -1,4 +0,0 @@ -select * from 'mauve_alerts' where update_type='cleared' and will_unacknowledge_at != 0; - -update 'mauve_alerts' set will_unacknowledge_at=NULL where update_type='cleared' and will_unacknowledge_at != 0; - diff --git a/utils/get_last_test_db.sh b/utils/get_last_test_db.sh deleted file mode 100755 index 71ce4f1..0000000 --- a/utils/get_last_test_db.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -test=`echo $1 | sed s/://` -sqlitebrowser `/bin/ls -dtr /tmp/mauve_test/* | tail -1`/$test\(ZTestCases\)/mauve_test.db diff --git a/utils/get_last_test_log.sh b/utils/get_last_test_log.sh deleted file mode 100755 index 26597d0..0000000 --- a/utils/get_last_test_log.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -test=`echo $1 | sed s/://` -less `/bin/ls -dtr /tmp/mauve_test/* | tail -1`/$test\(ZTestCases\)/log000001 diff --git a/utils/get_live_db.sh b/utils/get_live_db.sh deleted file mode 100755 index 35c5aea..0000000 --- a/utils/get_live_db.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -scp one-eyed-jack:/var/lib/mauveserver/alerts.db . && \ - sqlitebrowser alerts.db diff --git a/utils/init_jmauve.sh b/utils/init_jmauve.sh deleted file mode 100755 index 3011d62..0000000 --- a/utils/init_jmauve.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: mauveserver -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start the mauve alerting daemon at boot time -# Description: Start the mauve alerting daemon at boot time -### END INIT INFO - -PATH=/bin:/sbin:/usr/bin:/usr/local/bin -DAEMON=/usr/bin/jmauveserver -DAEMON_OPTS=/etc/mauvealert/mauveserver.conf -DESC="mauvealert server" -PIDFILE=/var/run/jmauveserver.pid -LOG=/var/log/mauve - -test -x $DAEMON || exit 0 - -. /lib/lsb/init-functions - -case "$1" in - start) - log_begin_msg "Starting $DESC:" "$NAME" - if [ ! -d $LOG ]; then mkdir $LOG; fi - chown mauveserver $LOG /var/lib/mauveserver - $DAEMON $DAEMON_OPTS & - echo $! > $PIDFILE - for i in `seq 0 1 11`;do sleep 1; echo -n '.'; done - kill -0 $(cat $PIDFILE) - if [ $? != 0 ] ; then echo -n "failed"; else echo -n "success"; fi - - # Email on start. - address="yann@bytemark.co.uk" - lastLog=`/bin/ls -tr $LOG/*.log | tail -1` - logLastLines=`tail -101 $lastLog` - echo $logLastLines | mail -s "Mauve was started at `date`" $address - - log_end_msg $? - ;; - stop) - log_begin_msg "Stopping $DESC:" "$NAME" - if [ -f $PIDFILE ] ; then - kill `cat $PIDFILE` - rm $PIDFILE - - # Email on stop. - address="yann@bytemark.co.uk" - lastLog=`/bin/ls -tr $LOG/*.log | tail -1` - logLastLines=`tail -101 $lastLog` - echo $logLastLines | mail -s "Mauve was stopped at `date`" $address - - else - echo Not running to stop - exit 1 - fi - log_end_msg $? - ;; - reload) - if [ -f $PIDFILE ] ; then - echo Sending restart signal to mauveserver - kill -HUP `cat $PIDFILE` - else - echo Not running to reload - fi - ;; - restart|reload|force-reload) - $0 stop - sleep 1 - $0 start - ;; - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/utils/init_mauve.sh b/utils/init_mauve.sh deleted file mode 100755 index 309562c..0000000 --- a/utils/init_mauve.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: mauveserver -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start the mauve alerting daemon at boot time -# Description: Start the mauve alerting daemon at boot time -### END INIT INFO - -PATH=/bin:/sbin:/usr/bin:/usr/local/bin -DAEMON=/usr/bin/mauveserver -DAEMON_OPTS=/etc/mauvealert/mauveserver.conf -DESC="mauvealert server" -PIDFILE=/var/run/mauveserver.pid -LOG=/var/log/mauve - -test -x $DAEMON || exit 0 - -. /lib/lsb/init-functions - -case "$1" in - start) - log_begin_msg "Starting $DESC:" "$NAME" - if [ ! -d $LOG ]; then mkdir $LOG; fi - chown mauveserver $LOG /var/lib/mauveserver - $DAEMON $DAEMON_OPTS & - echo $! > $PIDFILE - #start-stop-daemon --background --make-pidfile --pidfile $PIDFILE \ - # --start --quiet --chuid mauveserver \ - # --exec "$DAEMON" --oknodo -- $DAEMON_OPTS - sleep 3 - #kill -0 $(cat $PIDFILE) - #if [ $? != 0 ] ; then echo -n "failed"; else echo -n "success"; fi - - # Email on start. - address="yann@bytemark.co.uk" - lastLog=`/bin/ls -tr $LOG/*.log | tail -1` - logLastLines=`tail -101 $lastLog` - echo $logLastLines | mail -s "Mauve was started at `date`" $address - - log_end_msg $? - ;; - stop) - log_begin_msg "Stopping $DESC:" "$NAME" - if [ -f $PIDFILE ] ; then - kill `cat $PIDFILE` - rm $PIDFILE - - # Email on stop. - address="yann@bytemark.co.uk" - lastLog=`/bin/ls -tr $LOG/*.log | tail -1` - logLastLines=`tail -101 $lastLog` - echo $logLastLines | mail -s "Mauve was stopped at `date`" $address - - else - echo Not running to stop - exit 1 - fi - log_end_msg $? - ;; - reload) - if [ -f $PIDFILE ] ; then - echo Sending restart signal to mauveserver - kill -HUP `cat $PIDFILE` - else - echo Not running to reload - fi - ;; - restart|reload|force-reload) - $0 stop - sleep 1 - $0 start - ;; - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/utils/packet_processing.sh b/utils/packet_processing.sh deleted file mode 100755 index d78a916..0000000 --- a/utils/packet_processing.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -NO_ARGS=0 -OPTERROR=65 -if [ $# -eq "$NO_ARGS" ] # Script invoked with no command-line args? -then - echo "Usage: `basename $0` File.log" - exit $OPTERROR # Exit and explain usage, if no argument(s) given. -fi -logFile=$1 - -egrep 'Packet processed in [\.0-9]* seconds' $logFile |\ - awk 'BEGIN {print " date sz"} {print s++ " " $1 "::" $2 " " $11}' > data - -R --vanilla --no-save --slave <<RSCRIPT -lst <- read.table("data") -attach(lst) -summary(sz) -png(filename="packets.png", width=1024) -dates <- strptime(as.character(date), "%Y-%m-%d::%H:%M:%S") -plot(dates, sz, type='l', - main="Mauve server: maximum processing time of a packet per second.", - xlab="Time", - ylab="Maximum processing time of one packet") -abline(h=1.05, col="red") -abline(h=mean(sz), col="blue") -RSCRIPT -img=`which qiv` -if [ $? != 0 ] -then echo "Cannot display image here" -else $img packets.png -fi diff --git a/utils/run_android.sh b/utils/run_android.sh deleted file mode 100755 index e932257..0000000 --- a/utils/run_android.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -/usr/local/android-sdk-linux_x86/tools/android& diff --git a/utils/supportbot-mauve b/utils/supportbot-mauve deleted file mode 100755 index 614c5f5..0000000 --- a/utils/supportbot-mauve +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/ruby -require 'fileutils' -require 'yaml' -require 'timeout' -require 'rubygems' -require 'cgi' - -class RT - class Ticket < Struct.new(:id, :subject, :content) - end - - def initialize(cli, ticket_query) - @cli = cli - @ticket_query = ticket_query - end - - def query(args) - IO.popen("#{@cli} #{args}", "r") do |io| - io.read - end - end - - def tickets - query(@ticket_query).split("\n").map do |line| - if /^(\d+): (.*)$/.match(line) - t = Ticket.new($1.to_i, $2, "") - query("show ticket/#{t.id}/attachments").split("\n")[-5..-1].each do |line2| - next unless /\s(\d+):\s+\(text\/(plain|html)/.match(line2) - is_html = $2 == "html" - - attachment = query("show -f Content ticket/#{t.id}/attachments/#{$1}"). - split("Content: ")[1]. - split("\n"). - map { |line3| line3.gsub(/^\s+/,"") }. - join("\n") - next unless attachment.match(/Action=Take/) - if is_html - t.content += attachment + "<hr/>" - else - t.content += "<pre>"+attachment+"</pre><hr/>" - end - end - t - else - nil - end - end.compact - end -end - -class String; def escape; gsub(/[^A-Za-z0-9]/) { |x| "\\#{x}" }; end end - -config = File.open("supportbot.config") { |fh| - YAML::parse(fh.read).transform } - -system("mauvesend -o supportbot -i heartbeat -r +10m -c now -s \"heartbeat not received\" -d \"Headtbeat send from supportbot-mauve code. It maybe down.\"") - -rt = RT.new(config['rt']['bin'], config['rt']['ticket_query2']) - -if 0 < rt.tickets.size - args = %w( mauvesend alert.bytemark.co.uk -o supportbot ) - args += rt.tickets.map do |ticket| - ["-i", ticket.id.to_s, - "-u", ticket.id.to_s, - "-s", ticket.subject, - "-d", ticket.content - ] - end.flatten - exec(*args) -else - args = %w( mauvesend alert.bytemark.co.uk --id supportbot -o supportbot -p -c now ) - exec(*args) -end diff --git a/utils/test-smack.rb b/utils/test-smack.rb deleted file mode 100755 index 022f9d0..0000000 --- a/utils/test-smack.rb +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/jruby -# CLASSPATH="$CLASSPATH:/home/yann/projects/mauvealert/jars/smack.jar:/home/yann/projects/mauvealert/jars/smackx.jar -# ./test-smack - -require 'java' -require '../jars/smack.jar' -require '../jars/smackx.jar' -require 'rubygems' -require 'rainbow' -require 'pp' - -include_class "org.jivesoftware.smack.XMPPConnection" -include_class "org.jivesoftware.smackx.muc.MultiUserChat" - -user_jid='mauvealert' -password='WojIsEv8ScaufOm1' -msg = "What fresh hell is this? -- Dorothy Parker." -begin - - print "XMPP object instanciated.\n".color(:green) - xmpp = XMPPConnection.new("chat.bytemark.co.uk") - - - print "Connection done.\n".color(:green) - xmpp.connect - if true != xmpp.isConnected - print "Failed to connect".color(:red) - return -1 - end - - - print "Login.\n".color(:green) - xmpp.login(user_jid, password, "Testing_smack") - if true != xmpp.isAuthenticated() - print "Failed to authenticate\n".color(:red) - return -1 - end - if true == xmpp.isSecureConnection() - print "Connection is secure\n".color(:green) - else - print "Connection is NOT secure.\n".color(:yellow) - end - - - print "Get chat manager.\n".color(:green) - chat = xmpp.getChatManager.createChat( - "yann@chat.bytemark.co.uk", nil) - - print "Sending message to #{chat.getParticipant}.\n".color(:green) - chat.sendMessage(msg) - - - print "Joining, sending a message and leaving a room.\n".color(:green) - #muc = MultiUserChat.new(xmpp, "office@conference.chat.bytemark.co.uk") - muc = MultiUserChat.new(xmpp, "test@conference.chat.bytemark.co.uk") - muc.join("Mauve alert bot") - muc.sendMessage(msg) - sleep 1 - #muc.leave() - - - print "Adieu monde cruel!\n".color(:green) - xmpp.disconnect - - - print "all done.\n".color(:green) -rescue => ex - print "EPIC FAIL: Raised #{ex.class} because #{ex.message}\n\n".color(:red) - raise ex -end - -=begin -require 'java' -require './jars/smack.jar' -require './jars/smackx.jar' -include_class "org.jivesoftware.smack.XMPPConnection" -include_class "org.jivesoftware.smackx.muc.MultiUserChat" -user_jid='mauvealert' -password='WojIsEv8ScaufOm1' -msg = "What fresh hell is this? -- Dorothy Parker." -xmpp = XMPPConnection.new("chat.bytemark.co.uk") -xmpp.connect -xmpp.login(user_jid, password, "mauve_test") - -jid="yann@chat.bytemark.co.uk" -chat = xmpp.getChatManager.createChat(jid, nil) -chat.sendMessage(msg) - -xmpp.getRoster().reload() -xmpp.getRoster().getPresence(jid).isAvailable() -xmpp.getRoster().getPresence(jid).getStatus() - -muc = MultiUserChat.new(xmpp, 'office@conference.chat.bytemark.co.uk/mauvealert') -muc.join("Mauve alert bot") -muc.sendMessage(msg) - -muc2 = MultiUserChat.new(xmpp, "test@conference.chat.bytemark.co.uk") -muc2.join("Mauve alert bot") -muc2.sendMessage(msg) - -=end |