summaryrefslogtreecommitdiffstats
path: root/abs
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2011-12-07 19:45:02 (GMT)
committerJames Meyer <james.meyer@operamail.com>2011-12-07 19:45:02 (GMT)
commit582455878ef98dfadc0618309686c85b135f7a23 (patch)
treea87b677b96c168524576cf32870487758d0b43ba /abs
parent65b2738ba8a6b80a17c5a2953a29be935b15d18c (diff)
downloadlinhes_pkgbuild-582455878ef98dfadc0618309686c85b135f7a23.zip
linhes_pkgbuild-582455878ef98dfadc0618309686c85b135f7a23.tar.gz
linhes_pkgbuild-582455878ef98dfadc0618309686c85b135f7a23.tar.bz2
xymon: first build, includes both server and client builds.
xymon is a system used to monitor various things about each host. Possible to replace rrdtool and monitorx
Diffstat (limited to 'abs')
-rw-r--r--abs/core/xymon/PKGBUILD125
-rw-r--r--abs/core/xymon/alerts.cfg6
-rw-r--r--abs/core/xymon/analysis.cfg428
-rw-r--r--abs/core/xymon/be.pngbin0 -> 15618 bytes
-rw-r--r--abs/core/xymon/client-local.cfg.patch11
-rw-r--r--abs/core/xymon/clientlaunch.cfg.patch12
-rw-r--r--abs/core/xymon/graph.cfg.diff43
-rw-r--r--abs/core/xymon/hbfunc.py217
-rw-r--r--abs/core/xymon/hbnotes.py352
-rw-r--r--abs/core/xymon/hobbit-mem-myth.sh52
-rw-r--r--abs/core/xymon/hobbit-myth-orphan.sh54
-rw-r--r--abs/core/xymon/hobbit_myth_data.py99
-rw-r--r--abs/core/xymon/hobbit_notify.sh48
-rw-r--r--abs/core/xymon/hobbitadd.py95
-rw-r--r--abs/core/xymon/hobbitlaunch.cfg.diff40
-rw-r--r--abs/core/xymon/hobbitserver.cfg.diff45
-rw-r--r--abs/core/xymon/hobbitstorage.py121
-rw-r--r--abs/core/xymon/log_list.sh12
-rw-r--r--abs/core/xymon/logrotate.xymon11
-rw-r--r--abs/core/xymon/tasks.d.mv39
-rw-r--r--abs/core/xymon/tuner.pngbin0 -> 7685 bytes
-rw-r--r--abs/core/xymon/tv.pngbin0 -> 5968 bytes
-rw-r--r--abs/core/xymon/xymon-client.install22
-rw-r--r--abs/core/xymon/xymon.install68
-rw-r--r--abs/core/xymon/xymon_ghost_check2
-rw-r--r--abs/core/xymon/xymonserver.cfg.diff29
26 files changed, 1931 insertions, 0 deletions
diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD
new file mode 100644
index 0000000..560bbeb
--- /dev/null
+++ b/abs/core/xymon/PKGBUILD
@@ -0,0 +1,125 @@
+pkgbase=xymon
+pkgname=(xymonserver xymonclient)
+pkgver=4.3.5
+pkgrel=24
+pkgdesc="Hobbit is a system for monitoring servers and networks. "
+license="GPL"
+arch=('i686' 'x86_64')
+
+url="http://www.xymon.com/"
+
+source=(http://voxel.dl.sourceforge.net/project/xymon/Xymon/4.3.5/xymon-4.3.5.tar.gz hobbitadd.py xymon_ghost_check graph.cfg.diff xymonserver.cfg.diff tasks.d.mv clientlaunch.cfg.patch hobbitstorage.py hbnotes.py hobbit-myth-orphan.sh analysis.cfg hbfunc.py be.png tuner.png tv.png hobbit-mem-myth.sh hobbit_notify.sh alerts.cfg hobbit_myth_data.py logrotate.xymon log_list.sh client-local.cfg.patch)
+depends=(rrdtool fping pcre python graphviz)
+install=xymon.install
+
+build() {
+
+ cd $startdir/src/xymon-$pkgver
+ ENABLESSL=n \
+ ENABLELDAP=n \
+ ENABLELDAPSSL=n \
+ XYMONUSER=nobody \
+ XYMONTOPDIR=/data/srv/xymon \
+ XYMONVAR=/data/srv/xymon/var \
+ XYMONHOSTURL=/xymon \
+ CGIDIR=/data/srv/httpd/htdocs/xymon/hobbit-cgi \
+ XYMONCGIURL=/xymon/hobbit-cgi \
+ SECURECGIDIR=/data/srv/httpd/htdocs/xymon/hobbit-seccgi \
+ SECUREXYMONCGIURL=/xymon/hobbit-seccgi \
+ HTTPDGID=nobody \
+ XYMONLOGDIR=/var/log/hobbit \
+ XYMONHOSTNAME=localhost \
+ XYMONHOSTIP=127.0.0.1 \
+ MANROOT=/usr/share/man \
+ BARS=all \
+ USENEWHIST=y \
+ PIXELCOUNT=960 \
+ INSTALLBINDIR=/data/srv/xymon/server/bin \
+ INSTALLETCDIR=/data/srv/xymon/etc \
+ INSTALLWEBDIR=/data/srv/xymon/web \
+ INSTALLEXTDIR=/data/srv/xymon/server/ext \
+ INSTALLTMPDIR=/data/srv/xymon/tmp \
+ INSTALLWWWDIR=/data/srv/httpd/htdocs/xymon/ \
+ ./configure
+
+ make PKGBUILD=1|| return 1
+}
+
+package_xymonserver(){
+ cd $startdir/src/xymon-$pkgver
+ make PKGBUILD=1 INSTALLROOT=$startdir/pkg/xymonserver install
+ cd $startdir/src
+ install -D -m755 $startdir/src/hobbitadd.py $startdir/pkg/xymonserver/data/srv/xymon/server/bin/hobbitadd.py
+ install -D -m755 $startdir/src/hobbitstorage.py $startdir/pkg/xymonserver/data/srv/xymon/server/ext/hobbitstorage.py
+ install -D -m755 $startdir/src/hobbit-myth-orphan.sh $startdir/pkg/xymonserver/data/srv/xymon/server/ext/hobbit-myth-orphan.sh
+ install -D -m755 $startdir/src/hbfunc.py $startdir/pkg/xymonserver/data/srv/xymon/server/ext/hbfunc.py
+ install -D -m755 $startdir/src/hbnotes.py $startdir/pkg/xymonserver/data/srv/xymon/server/ext/hbnotes.py
+ install -D -m755 $startdir/src/hobbit_myth_data.py $startdir/pkg/xymonserver/data/srv/xymon/server/ext/hobbit_myth_data.py
+ install -D -m755 $startdir/src/hobbit-mem-myth.sh $startdir/pkg/xymonserver/data/srv/xymon/server/ext/hobbit-mem-myth.sh
+ install -D -m755 $startdir/src/log_list.sh $startdir/pkg/xymonserver/data/srv/xymon/client/bin/log_list.sh
+
+# install -D -m755 xymon_ghost_check $startdir/pkg/xymonserver/etc/cron.tenminutes/xymon_ghost_check
+ install -m755 analysis.cfg $startdir/pkg/xymonserver/data/srv/xymon/etc/analysis.cfg
+ cat alerts.cfg >> $startdir/pkg/xymonserver/data/srv/xymon/etc/alerts.cfg
+
+ install -m755 hobbit_notify.sh $startdir/pkg/xymonserver/data/srv/xymon/server/bin/hobbit_notify.sh
+ install -m755 $startdir/src/tv.png $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/gifs/tv.png
+ install -m755 $startdir/src/tuner.png $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/gifs/tuner.png
+ install -m755 $startdir/src/be.png $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/gifs/be.png
+
+ install -D -m755 $startdir/src/logrotate.xymon $startdir/pkg/xymonserver/etc/logrotate.d/xymon
+
+ #apply patches to conf file
+# mkdir -p $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.d/
+# mkdir -p $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.d/
+ cat $startdir/src/tasks.d.mv >> $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.cfg
+ cd $startdir/pkg/xymonserver/data/srv/xymon/etc
+ patch -p0 < $startdir/src/graph.cfg.diff || return 1
+ patch -p0 < $startdir/src/xymonserver.cfg.diff || return 1
+ patch -p4 < $startdir/src/client-local.cfg.patch || return 1
+
+
+
+ }
+
+
+package_xymonclient(){
+ #create client package as well
+ depends=()
+ install=xymon-client.install
+
+ install -D -m755 $startdir/src/log_list.sh $startdir/pkg/xymon/client/data/srv/xymon/client/bin/log_list.sh
+ install -D -m755 $startdir/src/logrotate.xymon $startdir/pkg/xymonclient/etc/logrotate.d/xymon
+ install -D -m755 $startdir/src/hobbit-mem-myth.sh $startdir/pkg/xymonclient/data/srv/xymon/client/ext/hobbit-mem-myth.sh
+ cp -rp /$startdir/pkg/xymonserver/data/srv/xymon/client/ $startdir/pkg/xymonclient/data/srv/xymon/
+
+ cd -
+ cd $startdir/pkg/xymonclient/data/srv/xymon/client/etc
+ patch -p0 < $startdir/src/clientlaunch.cfg.patch
+ cd -
+
+
+ }
+
+md5sums=('31923ec126fe1c264fceb459d2175161'
+ '28399d002ace27f01c6cfee3edd407ee'
+ '0f79d9715a827fa845a114b74b2c190c'
+ 'a45dd4cdb84817bcf3e51b25cc713799'
+ '034658a1084510ecbbb0dc166c0401eb'
+ 'cc845b5aedc33dda8e3103b915fe4967'
+ '650b523d879f32c1bad3b4a9e10e7c93'
+ '093648dabb0d1da0fdcc37b327737f43'
+ '62b73cf181fdc227c95aade509b65c0a'
+ '6eb6ecdf33454f35b6c2409b863c816f'
+ 'f6921f0413215ae174e81306be80d37f'
+ 'c08b0f116674b1eb8cd5902c1f497644'
+ 'd210c43fb9ee9ad6cd7648e0c2e0efea'
+ '0c808fa12672289f86b0651545381308'
+ '0469d775db9fdd18ea95dd41937ada82'
+ '0757294eec13771f8e63da23cf066796'
+ '622f400fd098cbc43c203e3210a6694e'
+ 'd06c4327cc69aeead3fa05f39660f33e'
+ '129353c8ad92e89c691382a98dd5ce77'
+ 'e6a3ed8b8f6abe357bd1736ff1e63001'
+ '98e9242ae346f729b14cb195786571f2'
+ '40fa09bdb1ae60f3fe767f1c6a979b65')
diff --git a/abs/core/xymon/alerts.cfg b/abs/core/xymon/alerts.cfg
new file mode 100644
index 0000000..84c3ead
--- /dev/null
+++ b/abs/core/xymon/alerts.cfg
@@ -0,0 +1,6 @@
+
+HOST=* SERVICE=disk
+ SCRIPT /data/srv/xymon/server/bin/hobbit_notify.sh 1234567890 FORMAT=SMS REPEAT=10h COLOR=yellow
+ SCRIPT /data/srv/xymon/server/bin/hobbit_notify.sh 1234567890 FORMAT=SMS REPEAT=1h COLOR=red
+
+
diff --git a/abs/core/xymon/analysis.cfg b/abs/core/xymon/analysis.cfg
new file mode 100644
index 0000000..0de317b
--- /dev/null
+++ b/abs/core/xymon/analysis.cfg
@@ -0,0 +1,428 @@
+# analysis.cfg - configuration file for clients reporting to Xymon
+#
+# This file is used by the xymond_client module, when it builds the
+# cpu, disk, files, memory, msgs and procs status messages from the
+# information reported by clients running on the monitored systems.
+#
+# This file must be installed on the Xymon server - client installations
+# do not need this file.
+#
+# The file defines a series of rules:
+# UP : Changes the "cpu" status when the system has rebooted recently,
+# or when it has been running for too long.
+# LOAD : Changes the "cpu" status according to the system load.
+# CLOCK : Changes the "cpu" status if the client system clock is
+# not synchronized with the clock of the Xymon server.
+# DISK : Changes the "disk" status, depending on the amount of space
+# used of filesystems.
+# MEMPHYS: Changes the "memory" status, based on the percentage of real
+# memory used.
+# MEMACT : Changes the "memory" status, based on the percentage of "actual"
+# memory used. Note: Not all systems report an "actual" value.
+# MEMSWAP: Changes the "memory" status, based on the percentage of swap
+# space used.
+# PROC : Changes the "procs" status according to which processes were found
+# in the "ps" listing from the client.
+# LOG : Changes the "msgs" status according to entries in text-based logfiles.
+# Note: The "client-local.cfg" file controls which logfiles the client will report.
+# FILE : Changes the "files" status according to meta-data for files.
+# Note: The "client-local.cfg" file controls which files the client will report.
+# DIR : Changes the "files" status according to the size of a directory.
+# Note: The "client-local.cfg" file controls which directories the client will report.
+# PORT : Changes the "ports" status according to which tcp ports were found
+# in the "netstat" listing from the client.
+# DEFAULT: Set the default values that apply if no other rules match.
+#
+# All rules can be qualified so they apply only to certain hosts, or on certain
+# times of the day (see below).
+#
+# Each type of rule takes a number of parameters:
+# UP bootlimit toolonglimit
+# The cpu status goes yellow if the system has been up for less than
+# "bootlimit" time, or longer than "toolonglimit". The time is in
+# minutes, or you can add h/d/w for hours/days/weeks - eg. "2h" for
+# two hours, or "4w" for 4 weeks.
+# Defaults: bootlimit=1h, toolonglimit=-1 (infinite).
+#
+# LOAD warnlevel paniclevel
+# If the system load exceeds "warnlevel" or "paniclevel", the "cpu"
+# status will go yellow or red, respectively. These are decimal
+# numbers.
+# Defaults: warnlevel=5.0, paniclevel=10.0
+#
+# CLOCK maximum-offset
+# If the system clock of the client differs from that of the Xymon
+# server by more than "maximum-offset" seconds, then the CPU status
+# column will go yellow. Note that the accuracy of this test is limited,
+# since it is affected by the time it takes a client status report to
+# go from the client to the Xymon server and be processed. You should
+# therefore allow for a few seconds (5-10) of slack when you define
+# your max. offset.
+# It is not wise to use this test, unless your servers are synchronized
+# to a common clock, e.g. through NTP.
+#
+# DISK filesystem warnlevel paniclevel
+# DISK filesystem IGNORE
+# If the utilization of "filesystem" is reported to exceed "warnlevel"
+# or "paniclevel", the "disk" status will go yellow or red, respectively.
+# "warnlevel" and "paniclevel" are either the percentage used, or the
+# space available as reported by the local "df" command on the host.
+# For the latter type of check, the "warnlevel" must be followed by the
+# letter "U", e.g. "1024U".
+# The special keyword "IGNORE" causes this filesystem to be ignored
+# completely, i.e. it will not appear in the "disk" status column and
+# it will not be tracked in a graph. This is useful for e.g. removable
+# devices, backup-disks and similar hardware.
+# "filesystem" is the mount-point where the filesystem is mounted, e.g.
+# "/usr" or "/home". A filesystem-name that begins with "%" is interpreted
+# as a Perl-compatible regular expression; e.g. "%^/oracle.*/" will match
+# any filesystem whose mountpoint begins with "/oracle".
+# Defaults: warnlevel=90%, paniclevel=95%
+#
+# MEMPHYS warnlevel paniclevel
+# MEMACT warnlevel paniclevel
+# MEMSWAP warnlevel paniclevel
+# If the memory utilization exceeds the "warnlevel" or "paniclevel", the
+# "memory" status will change to yellow or red, respectively.
+# Note: The words "PHYS", "ACT" and "SWAP" are also recognized.
+# Defaults: MEMPHYS warnlevel=100 paniclevel=101 (i.e. it will never go red)
+# MEMSWAP warnlevel=50 paniclevel=80
+# MEMACT warnlevel=90 paniclevel=97
+#
+# PROC processname minimumcount maximumcount color [TRACK=id] [TEXT=displaytext]
+# The "ps" listing sent by the client will be scanned for how many
+# processes containing "processname" are running, and this is then
+# matched against the min/max settings defined here. If the running
+# count is outside the thresholds, the color of the "procs" status
+# changes to "color".
+# To check for a process that must NOT be running: Set minimum and
+# maximum to 0.
+#
+# "processname" can be a simple string, in which case this string must
+# show up in the "ps" listing as a command. The scanner will find
+# a ps-listing of e.g. "/usr/sbin/cron" if you only specify "processname"
+# as "cron".
+# "processname" can also be a Perl-compatiable regular expression, e.g.
+# "%java.*inst[0123]" can be used to find entries in the ps-listing for
+# "java -Xmx512m inst2" and "java -Xmx256 inst3". In that case,
+# "processname" must begin with "%" followed by the reg.expression.
+# If "processname" contains whitespace (blanks or TAB), you must enclose
+# the full string in double quotes - including the "%" if you use regular
+# expression matching. E.g.
+# PROC "%xymond_channel --channel=data.*xymond_rrd" 1 1 yellow
+# or
+# PROC "java -DCLASSPATH=/opt/java/lib" 2 5
+#
+# You can have multiple "PROC" entries for the same host, all of the
+# checks are merged into the "procs" status and the most severe
+# check defines the color of the status.
+#
+# The TRACK=id option causes the number of processes found to be recorded
+# in an RRD file, with "id" as part of the filename. This graph will then
+# appear on the "procs" page as well as on the "trends" page. Note that
+# "id" must be unique among the processes tracked for each host.
+#
+# The TEXT=displaytext option affects how the process appears on the
+# "procs" status page. By default, the process is listed with the
+# "processname" as identification, but if this is a regular expression
+# it may be a bit difficult to understand. You can then use e.g.
+# "TEXT=Apache" to make these processes appear with the name "Apache"
+# instead.
+#
+# Defaults: mincount=1, maxcount=-1 (unlimited), color="red".
+# Note: No processes are checked by default.
+#
+# Example: Check that "cron" is running:
+# PROC cron
+# Example: Check that at least 5 "httpd" processes are running, but
+# not more than 20:
+# PROC httpd 5 20
+#
+# LOG filename match-pattern [COLOR=color] [IGNORE=ignore-pattern] [TEXT=displaytext]
+# In the "client-local.cfg" file, you can list any number of files
+# that the client will collect log data from. These are sent to the
+# Xymon server together with the other client data, and you can then
+# choose how to analyze the log data with LOG entries.
+#
+# ************ IMPORTANT ***************
+# To monitor a logfile, you *MUST* configure both client-local.cfg
+# and analysis.cfg. If you configure only the client-local.cfg
+# file, the client will collect the log data and you can view it in
+# the "client data" display, but it will not affect the color of the
+# "msgs" status. On the other hand, if you configure only the
+# analysis.cfg file, then there will be no log data to inspect,
+# and you will not see any updates of the "msgs" status either.
+#
+# "filename" is a filename or pattern. The set of files reported by
+# the client is matched against "filename", and if they match then
+# this LOG entry is processed against the data from a file.
+#
+# "match-pattern": The log data is matched against this pattern. If
+# there is a match, this log file causes a status change to "color".
+#
+# "ignore-pattern": The log data that matched "match-pattern" is also
+# matched against "ignore-pattern". If the data matches the "ignore-pattern",
+# this line of data does not affect the status color. In other words,
+# the "ignore-pattern" can be used to refine the strings which cause
+# a match.
+# Note: The "ignore-pattern" is optional.
+#
+# "color": The color which this match will trigger.
+# Note: "color" is optional, if omitted then "red" will be used.
+#
+# Example: Go yellow if the text "WARNING" shows up in any logfile.
+# LOG %.* WARNING COLOR=yellow
+#
+# Example: Go red if the text "I/O error" or "read error" appears.
+# LOG %/var/(adm|log)/messages %(I/O|read).error COLOR=red
+#
+# FILE filename [color] [things to check] [TRACK]
+# NB: The files you wish to monitor must be listed in a "file:..."
+# entry in the client-local.cfg file, in order for the client to
+# report any data about them.
+#
+# "filename" is a filename or pattern. The set of files reported by
+# the client is matched against "filename", and if they match then
+# this FILE entry is processed against the data from that file.
+#
+# [things to check] can be one or more of the following:
+# - "NOEXIST" triggers a warning if the file exists. By default,
+# a warning is triggered for files that have a FILE entry, but
+# which do not exist.
+# - "TYPE=type" where "type" is one of "file", "dir", "char", "block",
+# "fifo", or "socket". Triggers warning if the file is not of the
+# specified type.
+# - "OWNERID=owner" and "GROUPID=group" triggers a warning if the owner
+# or group does not match what is listed here. "owner" and "group" is
+# specified either with the numeric uid/gid, or the user/group name.
+# - "MODE=mode" triggers a warning if the file permissions are not
+# as listed. "mode" is written in the standard octal notation, e.g.
+# "644" for the rw-r--r-- permissions.
+# - "SIZE<max.size" and "SIZE>min.size" triggers a warning it the file
+# size is greater than "max.size" or less than "min.size", respectively.
+# You can append "K" (KB), "M" (MB), "G" (GB) or "T" (TB) to the size.
+# If there is no such modifier, KB is assumed.
+# E.g. to warn if a file grows larger than 1MB (1024 KB): "SIZE<1M".
+# - "SIZE=size" triggers a warning it the file size is not what is listed.
+# - "MTIME>min.mtime" and "MTIME<max.mtime" checks how long ago the file
+# was last modified (in seconds). E.g. to check if a file was updated
+# within the past 10 minutes (600 seconds): "MTIME<600". Or to check
+# that a file has NOT been updated in the past 24 hours: "MTIME>86400".
+# - "MTIME=timestamp" checks if a file was last modified at "timestamp".
+# "timestamp" is a unix epoch time (seconds since midnight Jan 1 1970 UTC).
+# - "CTIME>min.ctime", "CTIME<max.ctime", "CTIME=timestamp" acts as the
+# mtime checks, but for the ctime timestamp (when the files' directory
+# entry was last changed, eg. by chown, chgrp or chmod).
+# - "MD5=md5sum", "SHA1=sha1sum", "RMD160=rmd160sum" trigger a warning
+# if the file checksum using the MD5, SHA1 or RMD160 message digest
+# algorithms do not match the one configured here. Note: The "file"
+# entry in the client-local.cfg file must specify which algorithm to use.
+#
+# "TRACK" causes the size of this file to be tracked in an RRD file, and
+# shown on the graph on the "files" display.
+#
+# Example: Check that the /var/log/messages file is not empty and was updated
+# within the past 10 minutes, and go yellow if either fails:
+# FILE /var/log/messages SIZE>0 MTIME<600 yellow
+#
+# Example: Check the timestamp, size and SHA-1 hash of the /bin/sh program:
+# FILE /bin/sh MTIME=1128514608 SIZE=645140 SHA1=5bd81afecf0eb93849a2fd9df54e8bcbe3fefd72
+#
+# DIR directory [color] [SIZE<maxsize] [SIZE>minsize] [TRACK]
+# NB: The directories you wish to monitor must be listed in a "dir:..."
+# entry in the client-local.cfg file, in order for the client to
+# report any data about them.
+#
+# "directory" is a filename or pattern. The set of directories reported by
+# the client is matched against "directory", and if they match then
+# this DIR entry is processed against the data for that directory.
+#
+# "SIZE<maxsize" and "SIZE>minsize" defines the size limits that the
+# directory must stay within. If it goes outside these limits, a warning
+# will trigger. Note the Xymon uses the raw number reported by the
+# local "du" command on the client. This is commonly KB, but it may be
+# disk blocks which are often 512 bytes.
+#
+# "TRACK" causes the size of this directory to be tracked in an RRD file,
+# and shown on the graph on the "files" display.
+#
+# PORT [LOCAL=addr] [EXLOCAL=addr] [REMOTE=addr] [EXREMOTE=addr] [STATE=state] [EXSTATE=state] [MIN=mincount] [MAX=maxcount] [COLOR=color] [TRACK=id] [TEXT=displaytext]
+# The "netstat" listing sent by the client will be scanned for how many
+# sockets match the criteria listed.
+# "addr" is a (partial) address specification in the format used on
+# the output from netstat. This is typically "10.0.0.1:80" for the IP
+# 10.0.0.1, port 80. Or "*:80" for any local address, port 80.
+# NB: The Xymon clients normally report only the numeric data for
+# IP-adresses and port-numbers, so you must specify the port
+# number (e.g. "80") instead of the service name ("www").
+# "state" causes only the sockets in the specified state to be included;
+# it is usually LISTEN or ESTABLISHED.
+# The socket count is then matched against the min/max settings defined
+# here. If the count is outside the thresholds, the color of the "ports"
+# status changes to "color".
+# To check for a socket that must NOT exist: Set minimum and
+# maximum to 0.
+#
+# "addr" and "state" can be a simple strings, in which case these string must
+# show up in the "netstat" at the appropriate column.
+# "addr" and "state" can also be a Perl-compatiable regular expression, e.g.
+# "LOCAL=%(:80|:443)" can be used to find entries in the netstat local port for
+# both http (port 80) and https (port 443). In that case, portname or state must
+# begin with "%" followed by the reg.expression.
+#
+# The TRACK=id option causes the number of sockets found to be recorded
+# in an RRD file, with "id" as part of the filename. This graph will then
+# appear on the "ports" page as well as on the "trends" page. Note that
+# "id" must be unique among the ports tracked for each host.
+#
+# The TEXT=displaytext option affects how the port appears on the
+# "ports" status page. By default, the port is listed with the
+# local/remote/state rules as identification, but this may be somewhat
+# difficult to understand. You can then use e.g. "TEXT=Secure Shell" to make
+# these ports appear with the name "Secure Shell" instead.
+#
+# Defaults: state="LISTEN", mincount=1, maxcount=-1 (unlimited), color="red".
+# Note: No ports are checked by default.
+#
+# Example: Check that there is someone listening on the https port:
+# PORT "LOCAL=%([.:]443)$" state=LISTEN TEXT=https
+#
+# Example: Check that at least 5 "ssh" connections are established, but
+# not more than 10; warn but do not error; graph the connection count:
+# PORT "LOCAL=%([.:]22)$" state=ESTABLISHED min=5 max=20 color=yellow TRACK=ssh "TEXT=SSH logins"
+#
+# Example: Check that ONLY ports 22, 80 and 443 are open for incoming connections:
+# PORT STATE=LISTEN LOCAL=%0.0.0.0[.:].* EXLOCAL=%[.:](22|80|443)$ MAX=0 "TEXT=Bad listeners"
+#
+#
+# To apply rules to specific hosts, you can use the "HOST=", "EXHOST=", "PAGE="
+# "EXPAGE=", "CLASS=" or "EXCLASS=" qualifiers. (These act just as in the
+# alerts.cfg file).
+#
+# Hostnames are either a comma-separated list of hostnames (from the hosts.cfg file),
+# "*" to indicate "all hosts", or a Perl-compatible regular expression.
+# E.g. "HOST=dns.foo.com,www.foo.com" identifies two specific hosts;
+# "HOST=%www.*.foo.com EXHOST=www-test.foo.com" matches all hosts with a name
+# beginning with "www", except the "www-test" host.
+# "PAGE" and "EXPAGE" match the hostnames against the page on where they are
+# located in the hosts.cfg file, via the hosts' page/subpage/subparent
+# directives. This can be convenient to pick out all hosts on a specific page.
+#
+# Rules can be dependant on time-of-day, using the standard Xymon syntax
+# (the hosts.cfg(5) about the NKTIME parameter). E.g. "TIME=W:0800:2200"
+# applied to a rule will make this rule active only on week-days between
+# 8AM and 10PM.
+#
+# You can also associate a GROUP id with a rule. The group-id is passed to
+# the alert module, which can then use it to control who gets an alert when
+# a failure occurs. E.g. the following associates the "httpd" process check
+# with the "web" group, and the "sshd" check with the "admins" group:
+# PROC httpd 5 GROUP=web
+# PROC sshd 1 GROUP=admins
+# In the alerts.cfg file, you could then have rules like
+# GROUP=web
+# MAIL webmaster@foo.com
+# GROUP=admins
+# MAIL root@foo.com
+#
+# Qualifiers must be placed after each rule, e.g.
+# LOAD 8.0 12.0 HOST=db.foo.com TIME=*:0800:1600
+#
+# If you have multiple rules that you want to apply the same qualifiers to,
+# you can write the qualifiers *only* on one line, followed by the rules. E.g.
+# HOST=%db.*.foo.com TIME=W:0800:1600
+# LOAD 8.0 12.0
+# DISK /db 98 100
+# PROC mysqld 1
+# will apply the three rules to all of the "db" hosts on week-days between 8AM
+# and 4PM. This can be combined with per-rule qualifiers, in which case the
+# per-rule qualifier overrides the general qualifier; e.g.
+# HOST=%.*.foo.com
+# LOAD 7.0 12.0 HOST=bax.foo.com
+# LOAD 3.0 8.0
+# will result in the load-limits being 7.0/12.0 for the "bax.foo.com" host,
+# and 3.0/8.0 for all other foo.com hosts.
+#
+# The special DEFAULT section can modify the built-in defaults - this must
+# be placed at the end of the file.
+
+
+HOST=_MASTERBACKEND_
+ PROC sshd 1
+ PROC lighttpd
+ PROC hobbitd
+ PROC crond
+ PROC mysql
+ PROC mythbackend
+ DISK * 95 99
+ PORT "LOCAL=%([.:]80)$" state=LISTEN TEXT=http
+ PORT "LOCAL=%([.:]1337)$" state=LISTEN TEXT=cgi
+ PORT "LOCAL=%([.:]22)$" state=LISTEN TEXT=ssh
+
+HOST=_MASTERFRONTEND_
+ PROC mythfrontend
+ PROC sshd 1
+ PROC lighttpd
+ PROC hobbitd
+ PROC crond
+ PROC mysql
+ PROC mythbackend
+ DISK * 95 99
+ PORT "LOCAL=%([.:]80)$" state=LISTEN TEXT=http
+ PORT "LOCAL=%([.:]1337)$" state=LISTEN TEXT=cgi
+ PORT "LOCAL=%([.:]22)$" state=LISTEN TEXT=ssh
+ PORT "LOCAL=%([.:]5000)$" state=LISTEN TEXT=ghosd
+ PORT "LOCAL=%([.:]5001)$" state=LISTEN TEXT=ghosd
+
+
+HOST=_FRONTEND_
+ PROC sshd 1
+ PROC crond
+ PROC mythfrontend
+ PORT "LOCAL=%([.:]22)$" state=LISTEN TEXT=ssh
+ PORT "LOCAL=%([.:]5000)$" state=LISTEN TEXT=ghosd
+ PORT "LOCAL=%([.:]5001)$" state=LISTEN TEXT=ghosd
+
+HOST=_SLAVEBACKEND_
+ PROC sshd 1
+ PROC crond
+ PROC mythbackend
+ DISK * 95 99
+ PORT "LOCAL=%([.:]22)$" state=LISTEN TEXT=ssh
+
+HOST=_SLAVEFRONTEND_
+ PROC sshd 1
+ PROC lighttpd
+ PROC hobbitd
+ PROC crond
+ PROC mythbackend
+ PROC mythfrontend
+ DISK * 95 99
+ PORT "LOCAL=%([.:]22)$" state=LISTEN TEXT=ssh
+ PORT "LOCAL=%([.:]5000)$" state=LISTEN TEXT=ghosd
+ PORT "LOCAL=%([.:]5001)$" state=LISTEN TEXT=ghosd
+
+HOST=_STANDALONE_
+ PROC sshd 1
+ PROC lighttpd
+ PROC hobbitd
+ PROC crond
+ PROC mysql
+ PROC mythbackend
+ DISK * 95 99
+ PORT "LOCAL=%([.:]22)$" state=LISTEN TEXT=ssh
+ PORT "LOCAL=%([.:]5000)$" state=LISTEN TEXT=ghosd
+ PORT "LOCAL=%([.:]5001)$" state=LISTEN TEXT=ghosd
+ PORT "LOCAL=%([.:]80)$" state=LISTEN TEXT=http
+ PORT "LOCAL=%([.:]1337)$" state=LISTEN TEXT=cgi
+ PORT "LOCAL=%([.:]22)$" state=LISTEN TEXT=ssh
+
+DEFAULT
+ # These are the built-in defaults.
+ UP 1h
+ LOAD 5.0 10.0
+ DISK * 99 100
+ MEMPHYS 100 101
+ MEMSWAP 50 80
+ MEMACT 90 97
+
diff --git a/abs/core/xymon/be.png b/abs/core/xymon/be.png
new file mode 100644
index 0000000..2267cab
--- /dev/null
+++ b/abs/core/xymon/be.png
Binary files differ
diff --git a/abs/core/xymon/client-local.cfg.patch b/abs/core/xymon/client-local.cfg.patch
new file mode 100644
index 0000000..17ffd56
--- /dev/null
+++ b/abs/core/xymon/client-local.cfg.patch
@@ -0,0 +1,11 @@
+--- data/srv/xymon/etc/client-local.cfg.orig 2011-12-07 18:46:45.391534998 +0000
++++ data/srv/xymon/etc/client-local.cfg 2011-12-07 18:47:29.488200337 +0000
+@@ -79,7 +79,7 @@
+ log:/var/log/messages:10240
+
+ [linux]
+-log:/var/log/messages:10240
++log:`/data/srv/xymon/client/bin/log_list.sh`:10240
+ ignore MARK
+
+ [linux22]
diff --git a/abs/core/xymon/clientlaunch.cfg.patch b/abs/core/xymon/clientlaunch.cfg.patch
new file mode 100644
index 0000000..bb0e1c6
--- /dev/null
+++ b/abs/core/xymon/clientlaunch.cfg.patch
@@ -0,0 +1,12 @@
+--- clientlaunch.cfg.orig 2011-11-25 19:07:19.000000000 -0600
++++ clientlaunch.cfg 2011-11-25 19:09:55.000000000 -0600
+@@ -25,4 +25,9 @@
+ CMD $XYMONCLIENTHOME/bin/xymonclient.sh
+ LOGFILE $XYMONCLIENTLOGS/xymonclient.log
+ INTERVAL 5m
++[memmyth]
++ ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
++ CMD /data/srv/xymon/client/ext/hobbit-mem-myth.sh
++ LOGFILE $XYMONCLIENTLOGS/mythmem.log
++ INTERVAL 5m
+
diff --git a/abs/core/xymon/graph.cfg.diff b/abs/core/xymon/graph.cfg.diff
new file mode 100644
index 0000000..c92479a
--- /dev/null
+++ b/abs/core/xymon/graph.cfg.diff
@@ -0,0 +1,43 @@
+--- graphs.cfg.orig 2011-11-22 07:56:12.240933957 -0800
++++ graphs.cfg 2011-11-22 07:57:26.902933853 -0800
+@@ -2094,4 +2094,40 @@
+ GPRINT:qlen@RRDIDX@:AVERAGE: %6.1lf (avg)\n
+
+ ########### end of ifmib graphs ###########
++[storage]
++ TITLE Storage Groups
++ YAXIS recordings
++ DEF:storage1=storage.rrd:rectvtotal:AVERAGE
++ LINE2:storage1#00CCCC:current recorded
++
++ DEF:rectime=storage.rrd:rectvtime:AVERAGE
++ LINE2:rectime#000000:current recorded time
++
++ DEF:livetime=storage.rrd:livetvtime:AVERAGE
++ LINE2:livetime#00CC11:current live time
++
++
++[memmbe]
++ TITLE Memory usage for MythBackend
++ YAXIS mythbackend
++ DEF:vmsize=memmbe.rrd:VmSize:AVERAGE
++ LINE2:vmsize#00CCCC:vmsize
++
++ DEF:vmpeak=memmbe.rrd:VmPeak:AVERAGE
++ LINE2:vmpeak#000000:vmpeak
++
++ DEF:vmrss=memmbe.rrd:VmRSS:AVERAGE
++ LINE2:vmrss#00CC11:vmrss
++
++[memmfe]
++ TITLE Memory usage for MythFrontend
++ YAXIS mythfrontend
++ DEF:vmsize=memmfe.rrd:VmSize:AVERAGE
++ LINE2:vmsize#00CCCC:vmsize
++
++ DEF:vmpeak=memmfe.rrd:VmPeak:AVERAGE
++ LINE2:vmpeak#000000:vmpeak
++
++ DEF:vmrss=memmfe.rrd:VmRSS:AVERAGE
++ LINE2:vmrss#00CC11:vmrss
+
diff --git a/abs/core/xymon/hbfunc.py b/abs/core/xymon/hbfunc.py
new file mode 100644
index 0000000..edd2461
--- /dev/null
+++ b/abs/core/xymon/hbfunc.py
@@ -0,0 +1,217 @@
+#!/usr/bin/python
+#checks that the MBE can connect to the minions
+
+# ===============================================
+import sys
+import os
+import string
+import time
+import func.overlord.client as fc
+BBLINE = ''
+BBCOLOR="green"
+DATE = time.strftime("%a %b %d %H:%M:%S %Z %Y", time.localtime(time.time()))
+BB="/data/srv/xymon/server/bin/xymon"
+BBDISP="127.0.01"
+
+
+#if os.environ['BB']:
+# #print os.environ['BB']
+# BB=os.environ['BB']
+
+#if os.environ['BBDISP']:
+# #print os.environ['BBDISP']
+# BBDISP=os.environ['BBDISP']
+
+#if os.environ['MACHINE']:
+# #print os.environ['MACHINE']
+# MACHINE=os.environ['MACHINE']
+
+
+def readbb():
+ global hostlist
+ global mythtype
+
+ try:
+ infile = open('/data/srv/xymon/etc/hosts.cfg', 'r')
+ except(IOError), e:
+ #print "couldn't open xymon hosts file"
+ sys.exit(1)
+ else:
+ bbhostlist = infile.readlines()
+ infile.close()
+ for line in bbhostlist:
+ cline=line.strip()
+ #if not cline.startswith("#") and cline != '' and cline.find("bbd") == -1 and cline.find("func") != -1 :
+ if not cline.startswith("#") and cline != '' and cline.find("func") != -1 :
+ host=cline.split("#")
+ host=host[0].split()
+ hostlist.append(host[1].strip())
+ #print hostlist
+ infile.close()
+ try:
+ infile = open('/etc/mythtv-releasetype')
+ mythtype= infile.readline()
+ infile.close()
+ except(IOError), e:
+ #print "couldn't open mythfile "
+ mythtype=''
+
+def find_local_myth_version():
+ global mythtype
+ local_pkg_name="not_found"
+ pkgname="mythtv"
+ pkgname+=mythtype
+ cmd="/usr/bin/pacman -Q %s " %pkgname
+ result = os.popen2(cmd)[1].readlines()
+ for list in result:
+ l=list.strip()
+ if l.startswith('mythtv') :
+ local_pkg_name=l.strip()
+ break
+ return local_pkg_name
+
+
+def mythversion_check(currentclient,local_myth_version):
+ global mythtype
+ pkgname="mythtv"
+ pkgname+=mythtype
+ remote_pkg_name="remote_pkg_not_found"
+ client = (fc.Client( currentclient ))
+ results=client.pacman.pkgversion(pkgname)
+ #print currentclient
+ #print local_myth_version
+ #print results[currentclient][1]
+ try:
+ for pkg in results[currentclient][1] :
+ p=pkg.strip()
+ if p.startswith('mythtv'):
+ remote_pkg_name=p
+ break
+ if (remote_pkg_name != local_myth_version):
+ BBLINE="Myth version MBE: %s does not match %s %s \n " %(local_myth_version,currentclient,remote_pkg_name)
+ LINE = "status " + currentclient + ".version yellow" + " " + DATE + " " + BBLINE
+
+ if (remote_pkg_name == local_myth_version):
+ BBLINE="%s: success (green) Myth version match %s \n " %(currentclient,remote_pkg_name)
+ LINE = "status " + currentclient + ".version green" + " " + DATE + " " + BBLINE
+ except:
+ BBLINE="Something went wrong! \n "
+ LINE = "status " + currentclient + ".version red" + " " + DATE + " " + BBLINE
+
+ cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+ os.system(cmd)
+ return
+
+def send_myth_clear(currentclient):
+ BBLINE="could not connect to host to check version\n "
+ LINE = "status " + currentclient + ".version clear" + " " + DATE + " " + BBLINE
+ cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+ os.system(cmd)
+ return
+#-------------------------
+
+global hostlist
+global mythtype
+mythtype=""
+hostlist = []
+readbb()
+local_myth_version=find_local_myth_version()
+
+for currentclient in hostlist:
+ #print currentclient
+ cmd='/data/srv/xymon/server/bin/xymon 127.0.0.1 "query '
+ cmd+=currentclient
+ cmd+='.conn"'
+ bbresults=os.popen(cmd,'r' ).readline().strip().split()
+
+ try:
+ bbstate=bbresults[0]
+ except:
+ bbstate="clear"
+
+ #print bbstate
+ if bbstate == 'green':
+ try:
+ client = (fc.Client( currentclient ))
+ except Exception as e:
+ #couldn't find minion in certmaster
+ #print "couldn't find minion in certmaster:%s" %currentclient
+ BBLINE="%s: %s (red) \n " %(currentclient,e)
+ LINE = "status " + currentclient + ".func red" + " " + DATE + " " + BBLINE
+ cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+ cmd2= "echo " + currentclient + " >> /data/srv/httpd/htdocs/failed_func_hosts"
+ os.system(cmd2)
+ os.system(cmd)
+ BBCOLOR="red"
+ send_myth_clear(currentclient)
+ continue
+
+
+ results=client.test.add("1","2")
+ try:
+ #print currentclient
+ #print results[currentclient]
+ #print type(results[currentclient])
+ #print "----------"
+ if type(results[currentclient]) == str:
+ if results[currentclient] == '12':
+ BBLINE="%s: success (green) \n " %currentclient
+ LINE = "status " + currentclient + ".func green" + " " + DATE + " " + BBLINE
+ cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+ os.system(cmd)
+ #REMOVE HOST FROM FAILED_FUNC
+ #cmd='sed -i "/' + currentclient + '/d" /data/srv/httpd/htdocs/failed_func_hosts'
+ f = open("/data/srv/httpd/htdocs/failed_func_hosts")
+ failed_lines=f.readlines()
+ f.close
+ f = open("/data/srv/httpd/htdocs/failed_func_hosts",'w')
+ for line in failed_lines:
+ if line.strip() == currentclient:
+ continue
+ f.write(line)
+ f.close()
+
+
+ #os.system(cmd)
+ mythversion_check(currentclient,local_myth_version)
+ else:
+ BBLINE="%s: connected but wtf (yellow) \n " %currentclient
+ LINE = "status " + currentclient + ".func yellow" + " " + DATE + " " + BBLINE
+ cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+ os.system(cmd)
+ if BBCOLOR != "red":
+ BBCOLOR="yellow"
+ else:
+ BBLINE="%s: %s (red) \n " %(currentclient,results[currentclient])
+ LINE = "status " + currentclient + ".func red" + " " + DATE + " " + BBLINE
+ cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+ cmd2= "echo " + currentclient + " >> /data/srv/httpd/htdocs/failed_func_hosts"
+ cmd3="sudo /usr/bin/certmaster-ca -c " + currentclient
+ os.system(cmd2)
+ os.system(cmd3)
+ os.system(cmd)
+ BBCOLOR="red"
+ except:
+ BBLINE="%s had an error : %s (red) \n " % (currentclient,str(results))
+ LINE = "status " + currentclient + ".func red" + " " + DATE + " " + BBLINE
+ cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+ cmd2= "echo " + currentclient + " >> /data/srv/httpd/htdocs/failed_func_hosts"
+ os.system(cmd)
+ os.system(cmd2)
+ cmd3="sudo /usr/bin/certmaster-ca -c " + currentclient
+ os.system(cmd3)
+ BBCOLOR="red"
+ else:
+ BBLINE+= "Not testing %s \n " % currentclient
+ LINE = "status " + currentclient + ".func clear" + " " + DATE + " " + BBLINE
+ cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+ os.system(cmd)
+ BBCOLOR="clear"
+ send_myth_clear(currentclient)
+
+#LINE = "status " + MACHINE + ".func green" + " " + DATE + " " + BBLINE
+#cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+#os.system(cmd)
+
+#print BBLINE
+#print BBCOLOR
diff --git a/abs/core/xymon/hbnotes.py b/abs/core/xymon/hbnotes.py
new file mode 100644
index 0000000..e08992c
--- /dev/null
+++ b/abs/core/xymon/hbnotes.py
@@ -0,0 +1,352 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# import MySQL module
+
+import MySQLdb
+import sys
+import getopt
+import socket
+import os
+global ignorehostlist
+try:
+ import ignoreclient
+ ignorehostlist=ignoreclient.ignorehosts
+except:
+ print "could not find the ignore list"
+ ignorehostlist="'ignoreme'"
+
+
+
+
+
+def createdropdown():
+ dir = "/data/database_backup"
+ dropdown=" "
+ #dropdown='''
+ #<input name="param2" type="radio" value="Restore" />Restore database </>
+ #<select name="param1">
+ #'''
+ #if os.path.exists(dir):
+ #files = os.listdir(dir)
+ #for file in os.listdir(dir):
+ #if (file.endswith(".tgz")):
+ #dropdown+='<option value="' + file + '">' + file + '</option> '
+ dropdown+='</select> <br><input name="param2" type="radio" value="Backup" checked="checked" />Backup database<br /> '
+ dropdown+='<input name="param2" type="radio" value="Optimize" />Optimize database<br /> '
+ dropdown+='<input name="param2" type="radio" value="ShutdownAll" />Shutdown All Systems (expect MBE)<br /> '
+ #dropdown+='''<input name="param2" type="radio" value="UpdateAll" />Update All Systems </> <select name="param5">
+ #<option value="Myth_only">Myth only</option>
+ #<option value="All"> Full System</option>
+ #</select>
+ #</br>
+ #</br>
+ #</br>'''
+
+ dropdown+=''' </br></br>'''
+ return dropdown
+
+def main(argv):
+ db = MySQLdb.connect(host="localhost", user="mythtv", passwd="mythtv", db="mythconverg")
+
+ # create a cursor
+ cursor = db.cursor()
+#------------------------------write client-config------------------------------------------------
+ SQL="SELECT DISTINCT(hostname) from settings where hostname not in(%s)"
+ cursor.execute(SQL %ignorehostlist)
+ result = cursor.fetchall()
+ frontonly="_FRONTEND_"
+ masterbackend="_MASTERBACKEND_"
+ masterbacked_w_fe="_MASTERFE_"
+ slave_w_fe="_SLAVEFE_"
+ slave="_SLAVEBACKEND_"
+ stand_alone="_STANDALONE_"
+ dotMBE=""
+ dotfrontend=list()
+ dotslave=list()
+ dotslavefe=list()
+ tunerdict = {}
+ currenthostype=''
+ for row in result:
+ # print row[0]
+ #Find the system type
+ cursor.execute("select value,data from settings where hostname=%s and value in ('HostSystemType','HostRunFrontend');",(row))
+ hostvalues=cursor.fetchall()
+ if len(hostvalues) == 2:
+ if hostvalues[1][1] == 'Frontend_only':
+ frontonly+=","+row[0]
+ dotfrontend.append(row[0])
+
+ elif hostvalues[1][1] == 'Standalone':
+ stand_alone+=","+row[0]
+ dotMBE="MBE" + " [ label=\"" + row[0] + " \\n Standalone \" shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/be.png\" fontcolor=\"white\" color=blue4 style=filled ] "
+ dotfrontend.append(row[0])
+ cursor.execute("select cardtype,defaultinput from capturecard where hostname=%s;",(row))
+ tuners=cursor.fetchall()
+ tstring=""
+
+ if len(tuners) == 0:
+ tunerdict["MBE"]="no tuners \\n"
+ else:
+ for t in tuners:
+ tstring+=t[0]
+ tstring+=t[1]
+ tstring+='\\n'
+ tunerdict["MBE"]=tstring
+
+ elif hostvalues[1][1] == 'Master_backend':
+ print "found MBE"
+ print hostvalues
+ if hostvalues[0][1]=='0':
+ masterbackend+=","+row[0]
+ #dotMBE=row[0] + "\\n Master Backend"
+ #This is wrong, but it's enough to get it working
+ dotMBE=''
+ else:
+ masterbacked_w_fe+=","+row[0]
+ dotMBE="MBE" + " [ label=\"" + row[0] + " \\n Master Backend with frontend \" shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/be.png\" fontcolor=\"white\" color=blue4 style=filled ] "
+ cursor.execute("select cardtype,defaultinput from capturecard where hostname=%s;",(row))
+ tuners=cursor.fetchall()
+ tstring=""
+ if len(tuners) == 0:
+ tunerdict["MBE"]="no tuners \\n"
+ else:
+ for t in tuners:
+ tstring+=t[0]
+ tstring+=t[1]
+ tstring+='\\n'
+ tunerdict["MBE"]=tstring
+ dotfrontend.append(row[0])
+
+ elif hostvalues[1][1] == 'Slave_backend':
+ if hostvalues[0][1]=='0':
+ slave+=","+row[0]
+ dotslave.append(row[0])
+ cursor.execute("select cardtype,defaultinput from capturecard where hostname=%s;",(row))
+ tuners=cursor.fetchall()
+ tstring=""
+ for t in tuners:
+ tstring+=t[0]
+ tstring+=t[1]
+ tstring+='\\n'
+ tunerdict["STUNER"+row[0]]=tstring
+ #dotfrontend.append(row[0])
+ else:
+ cursor.execute("select cardtype,defaultinput from capturecard where hostname=%s;",(row))
+ tuners=cursor.fetchall()
+ tstring=""
+ for t in tuners:
+ tstring+=t[0]
+ tstring+=t[1]
+ tstring+='\\n'
+ tunerdict["STUNER"+row[0]]=tstring
+ print tstring
+
+ slave_w_fe+=","+row[0]
+ dotslave.append(row[0])
+ dotfrontend.append(row[0])
+
+#----------------------------------Create graphviz dot files
+ dotfilename="/data/srv/xymon/server/etc/mythdot"
+
+ dotfile=open(dotfilename,'w')
+ dotfile.write("digraph G { " + "\n" )
+ dotfile.write("graph [bgcolor=transparent]" + "\n" )
+
+
+#define the nodes
+ dotfile.write( dotMBE + " \n" )
+
+ dotfile.write("tunermbe"+ " [ label= \"" + tunerdict["MBE"] + "\" , shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/tuner.png\" fontcolor=\"white\" color=red ] \n" )
+
+ for fe in dotfrontend:
+ dotfile.write("FEND"+fe + "[ label=\"frontend \\n " + fe + "\" ,shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/tv.png\" , fontcolor=\"white\" , imagescale=\"true\" color=\"gold2\" ] \n" )
+
+ for fe in dotslave:
+ cslave="STUNER"+fe
+ if tunerdict[cslave] != "" :
+ dotfile.write(cslave+ " [ label= \"" + tunerdict[cslave] + "\" , shape=box ] \n" )
+ dotfile.write("SLAVE"+fe + "[ label=\"slave backend \\n " + fe + "\" shapefile=\"/data/srv/httpd/htdocs/xymon/gifs/be.png\" fontcolor=\"white\" color=green ] \n" )
+
+
+#connect up the nodes!
+ dotfile.write("tunermbe -> MBE [color=\"red\"] \n " )
+
+ for fe in dotfrontend:
+ dotfile.write("MBE -> FEND" + fe + "[color=\"gold2\"] \n " )
+
+ for fe in dotslave:
+ cslave="STUNER"+fe
+ dotfile.write("SLAVE" + fe + "-> MBE [color=\"green\"] \n " )
+ if tunerdict[cslave] != "" :
+ dotfile.write(cslave + "-> SLAVE"+fe + "\n" )
+
+
+
+ dotfile.write("} " + "\n" )
+ dotfile.close()
+
+
+ cmd="/usr/bin/unflatten -l6 -c3 -f " + dotfilename + " |/usr/bin/dot -Tpng -o/data/srv/httpd/htdocs/xymon/gifs/network.png "
+ # cmd="/usr/bin/circo -Tpng -o/data/srv/httpd/htdocs/xymon/gifs/network.png " + dotfilename
+
+ results=os.popen(cmd,'r')
+
+ #--------------------------------------------------
+ #hobbitfile="/data/srv/xymon/server/etc/hobbit-clients.cfg"
+ hobbitfile="/data/srv/xymon/server/etc/tasks.cfg"
+ hobbitf=open(hobbitfile,'r')
+ hobbitconfig=hobbitf.readlines()
+ hobbitf.close()
+ hobbitf=open(hobbitfile,'w')
+ print "FE",frontonly
+ print "MBE",masterbackend
+ print "MBEwFW",masterbacked_w_fe
+ print "SLAVEwFW",slave_w_fe
+ print "SLAVE",slave
+ print "STD",stand_alone
+
+ for line in hobbitconfig:
+ if line.startswith("HOST"):
+ cline=line.split("=")
+ if cline[1].startswith("_FRONTEND_"):
+ pline="HOST="
+ pline+=frontonly.strip()
+ hobbitf.write(pline + "\n")
+ elif cline[1].startswith("_MASTERBACKEND_"):
+ pline="HOST="
+ pline+=masterbackend.strip()
+ #print pline
+ hobbitf.write(pline+ "\n")
+ elif cline[1].startswith("_MASTERFRONTEND_"):
+ pline="HOST="
+ pline+=masterbacked_w_fe.strip()
+ #print pline
+ hobbitf.write(pline+ "\n")
+ elif cline[1].startswith("_SLAVEBACKEND_"):
+ pline="HOST="
+ pline+=slave.strip()
+ #print pline
+ hobbitf.write(pline+ "\n")
+ elif cline[1].startswith("_SLAVEFE_"):
+ pline="HOST="
+ pline+=slave_w_fe.strip()
+ #print pline
+ hobbitf.write(pline+ "\n")
+ else:
+ #print line
+ hobbitf.write(line)
+ else:
+ #print line
+ hobbitf.write(line)
+
+#-----------------------------------------------------------END CLIENT CONFIG
+
+ # execute SQL statement
+ cursor.execute("SELECT DISTINCT(hostname) from settings")
+ result = cursor.fetchall()
+
+ for row in result:
+ cursor.execute("select value,data from settings where hostname=%s and value in ('HostSystemType','HostHwuuid');",(row))
+ hostvalues=cursor.fetchall()
+ found_uuid="false"
+ filename="/data/srv/xymon/server/www/notes/"
+ filename+=str(row[0])
+ filename+=(".html")
+
+ file = open(filename,'w')
+ string='''
+ <html>
+ <head>
+ <style type="text/css">@import "/frame.css";</style>
+ </head>
+ '''
+ file.write(string)
+
+
+ for i in range( 0 , len(hostvalues)):
+ value=hostvalues[i][0]
+ data=hostvalues[i][1]
+ currenthostype=''
+ currenthostname=''
+ if value == "HostHwuuid" :
+ if data != "blank" :
+ found_uuid="true"
+ uuid=data
+ if value == "HostSystemType" :
+
+ currenthostname= str(row[0]).strip()
+ currenthostype=str(data).strip()
+ header="<h1>" + currenthostname + " (" + currenthostype + ") </h1>"
+ file.write(header + '\n')
+
+
+ if found_uuid == "true" :
+ string=str("http://smolt.mythvantage.com/client/show?uuid=")
+ string+=str(uuid)
+ file.write("<A href=\"" )
+ file.write(string)
+ file.write("\" >" + str(uuid) + "</A>")
+ else:
+ file.write( "uuid not found, please submit a hardware profile" )
+
+
+
+ buttonform_top='''
+ <div class="content" style="solid #aaa; width:500px; height:350px; overflow:auto; color:#FFF;text-align:left;">
+ <form action="/process.py" method="get">
+ '''
+
+
+ buttonform_bottom='''
+ <input name="param2" type="radio" value="Update" />Update System </>
+ <select name="param3">
+ <option value="Myth_only">Myth only</option>
+ <option value="All"> Full System</option>
+ </select>
+ </br>
+ <input name="param2" type="radio" value="Kill" />Restart interface: </>
+ <select name="param6">
+ <option value="killX">Full UI</option>
+ <option value="killmyth">MythFrontend</option>
+ </select>
+ </br>
+ <input name="param2" type="radio" value="Shutdown" />Shutdown System<br />
+ <input name="param2" type="radio" value="Reboot" />Reboot System<br />
+ <input name="param2" type="radio" value="WOL" />Wake on Lan<br />
+ <input name="hiddenparam" type="hidden" value="
+ '''
+ oldurlform='''
+ "/>
+ <input name="param4" type="hidden" value="
+ '''
+
+
+ closetag='''
+ "/>
+ </br>
+ <input id="submitbutton" type="submit" />
+ </form>
+ </div>
+ '''
+
+ if currenthostype == "Master_backend":
+ mbeoptions=createdropdown()
+ else:
+ mbeoptions=''
+ returnurl="/xymon/notes/"
+ returnurl+=str(row[0])
+ returnurl+=(".html")
+ file.write('</br> </br> ')
+ file.write(buttonform_top)
+ file.write(mbeoptions)
+ file.write(buttonform_bottom)
+ file.write(str(row[0]))
+ file.write(oldurlform)
+ file.write(returnurl)
+ file.write(closetag)
+
+ string=(' </html>')
+ file.write(string)
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/abs/core/xymon/hobbit-mem-myth.sh b/abs/core/xymon/hobbit-mem-myth.sh
new file mode 100644
index 0000000..663e2e3
--- /dev/null
+++ b/abs/core/xymon/hobbit-mem-myth.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+MBEPID=`ps -fU mythtv |grep mythbackend |grep -v runsv|grep -v grep|grep -v logger|awk '{print $2 }'`
+MFEPID=`ps -ef|grep mythfrontend |grep -v runsv|grep -v grep|grep -v logger|grep -v mythfrontend-start|awk '{print $2 }'`
+
+
+
+COLOR=green # By default, everything is OK
+
+ # Do whatever you need to test for something
+if [ ! x$MBEPID = x ]
+then
+VmSize=`cat /proc/$MBEPID/status|grep -i vmsize|awk '{print $2 }'`
+VmPeak=`cat /proc/$MBEPID/status|grep -i vmpeak|awk '{print $2 }'`
+VmRSS=`cat /proc/$MBEPID/status|grep -i vmrss |awk '{print $2 }'`
+MSGMBE="
+ VmSize:$VmSize
+ VmPeak:$VmPeak
+ VmRSS:$VmRSS
+ "
+# echo $MSGMBE
+ # Tell Hobbit about it
+ $BB $BBDISP "data $MACHINE.memmbe $COLOR `date`
+
+ ${MSGMBE}
+
+ "
+fi
+
+
+
+if [ ! x$MFEPID = x ]
+then
+VmSize=`cat /proc/$MFEPID/status|grep -i vmsize|awk '{print $2 }'`
+VmPeak=`cat /proc/$MFEPID/status|grep -i vmpeak|awk '{print $2 }'`
+VmRSS=`cat /proc/$MFEPID/status|grep -i vmrss |awk '{print $2 }'`
+MSGMBE="
+ VmSize:$VmSize
+ VmPeak:$VmPeak
+ VmRSS:$VmRSS
+ "
+# echo $MSGMBE
+ # Tell Hobbit about it
+ $BB $BBDISP "data $MACHINE.memmfe $COLOR `date`
+
+ ${MSGMBE}
+
+ "
+fi
+
+
+
+
diff --git a/abs/core/xymon/hobbit-myth-orphan.sh b/abs/core/xymon/hobbit-myth-orphan.sh
new file mode 100644
index 0000000..f9f7d54
--- /dev/null
+++ b/abs/core/xymon/hobbit-myth-orphan.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+TMPFILE=/tmp/oprhan.result
+/usr/local/bin/myth.find_orphans.pl > $TMPFILE
+
+
+ COLUMN=orphan # Name of the column
+ COLOR=green # By default, everything is OK
+
+ # Do whatever you need to test for something
+ # As an example, go red if /tmp/badstuff exists.
+
+thumbs=`grep -A 4 "Summary:" $TMPFILE |tail -n 1 | cut -d" " -f3 `
+if [ ! x$thumbs = x0 ]
+then
+ MSG="$thumbs orphaned thumbnails with no corresponding recording"
+ COLOR='yellow'
+fi
+
+missing=`grep -A 2 "Summary:" $TMPFILE |tail -n 1 | cut -d, -f2 | cut -d" " -f2 `
+if [ ! x$missing = x0 ]
+then
+ COLOR='red'
+MSG="${MSG}
+ `grep -A 2 "Summary:" $TMPFILE |tail -n 1 ` "
+fi
+
+unkown=`grep -A 5 "Summary:" $TMPFILE |tail -n 1 | cut -d" " -f3 `
+if [ ! x$unkown = x0 ]
+then
+ COLOR='red'
+MSG="${MSG}
+`grep -A 5 "Summary:" $TMPFILE |tail -n 1 `"
+fi
+
+
+MSG="${MSG}
+
+
+ `cat $TMPFILE`
+ "
+
+ # Tell Hobbit about it
+ $BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`
+/usr/local/bin/myth.find_orphans.pl
+
+ ${MSG}
+
+ "
+
+ exit 0
+
+
+
+
diff --git a/abs/core/xymon/hobbit_myth_data.py b/abs/core/xymon/hobbit_myth_data.py
new file mode 100644
index 0000000..840c293
--- /dev/null
+++ b/abs/core/xymon/hobbit_myth_data.py
@@ -0,0 +1,99 @@
+#!/usr/bin/python
+# checks for the number of days of guide data left
+# make sure myth_mtc ran ok
+
+
+import urllib2
+import string
+import time
+import sys,os
+BBLINE = ''
+BBCOLOR="green"
+DATE = time.strftime("%a %b %d %H:%M:%S %Z %Y", time.localtime(time.time()))
+if os.environ['BB']:
+ #print os.environ['BB']
+ BB=os.environ['BB']
+if os.environ['BBDISP']:
+ #print os.environ['BBDISP']
+ BBDISP=os.environ['BBDISP']
+if os.environ['MACHINE']:
+ #print os.environ['MACHINE']
+ MACHINE=os.environ['MACHINE']
+
+
+
+
+def check_mtc():
+ try:
+ infile = open('/var/log/mythtv/myth_mtc.log', 'r')
+ except(IOError), e:
+ print "couldn't open myth_mtc.log file"
+ return False
+ else:
+ mtc = infile.readlines()
+ for i in mtc:
+ line=i
+ infile.close()
+ if line.strip() == "Finished":
+ return True
+ else:
+ return False
+
+def find_data_left():
+ try:
+ f = urllib2.urlopen("http://localhost:6544")
+ except:
+ print 'error: could not find Masterbackend'
+ days_left=-100
+ return days_left
+# except urllib2.HTTPError, e:
+# if e.code != 200:
+# print 'error: could not find Masterbackend'
+# days_left=-100
+ else:
+ MBE_data = f.readlines()
+ f.close()
+
+ for line in MBE_data:
+ if line.find("guide data") != -1:
+ if line.find("no guide data") != -1:
+ days_left = 0
+ else:
+ line=line.split("(")
+ line=line[1].split(")")
+ days_left=line[0].split()[0]
+ return days_left
+
+
+mtc=check_mtc()
+num_days=find_data_left()
+
+if mtc:
+ BBCOLOR="green"
+ msg="\n Maintenace script ran ok \n "
+else:
+ BBCOLOR ="yellow"
+ msg="\n Maintenance script didn't run \n"
+
+if num_days == 1 :
+ BBCOLOR="yellow"
+ msg+="Only 1 day of guide data left"
+elif num_days == 0 :
+ BBCOLOR="yellow"
+ msg+="No guide data available"
+elif num_days == -100 :
+ BBCOLOR="red"
+ msg+="Could not connect to master backend"
+else:
+ data_check = True
+ BBCOLOR="green"
+ msg+="%s days of guide data" %(num_days)
+
+BBLINE=msg
+LINE = "status " + MACHINE + ".myth_mtc" + " " + BBCOLOR + " " + DATE + " " + BBLINE
+cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+os.system(cmd)
+
+sys.exit(0)
+
+
diff --git a/abs/core/xymon/hobbit_notify.sh b/abs/core/xymon/hobbit_notify.sh
new file mode 100644
index 0000000..7569e2a
--- /dev/null
+++ b/abs/core/xymon/hobbit_notify.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# BBCOLORLEVEL - The color of the alert: "red", "yellow" or "purple"
+# BBALPHAMSG - The full text of the status log triggering the alert
+# ACKCODE - The "cookie" that can be used to acknowledge the alert
+# RCPT - The recipient, from the SCRIPT entry
+# BBHOSTNAME - The name of the host that the alert is about
+# MACHIP - The IP-address of the host that has a problem
+# BBSVCNAME - The name of the service that the alert is about
+# BBSVCNUM - The numeric code for the service. From SVCCODES definition.
+# BBHOSTSVC - HOSTNAME.SERVICE that the alert is about.
+# BBHOSTSVCCOMMAS - As BBHOSTSVC, but dots in the hostname replaced with commas
+# BBNUMERIC - A 22-digit number made by BBSVCNUM, MACHIP and ACKCODE.
+# RECOVERED - Is "1" if the service has recovered.
+# DOWNSECS - Number of seconds the service has been down.
+# DOWNSECSMSG - When recovered, holds the text "Event duration : N" where
+echo $BBCOLORLEVEL > /tmp/hobbitout
+echo $BBALPHAMSG >>/tmp/hobbitout
+echo $RCPT >>/tmp/hobbitout
+echo $BBHOSTNAME >>/tmp/hobbitout
+echo $BBSVCNAME >>/tmp/hobbitout
+echo $BBHOSTSVC >>/tmp/hobbitout
+
+#BBCOLORLEVEL=red
+#BBCOLORLEVEL=yellow
+#BBALPHAMSG="vmtest:disk red [751147]"
+#BBHOSTNAME="vmtest"
+#BBSVCNAME="disk"
+#BBHOSTSVC="vmtest.disk"
+
+if [ x$BBSVCNAME = xdisk ]
+then
+ case $BBCOLORLEVEL in
+ red )
+ /usr/bin/notify.py ALT "$BBHOSTNAME disk is full"
+ ;;
+ yellow )
+
+ /usr/bin/notify.py PHN "$BBHOSTNAME disk almost full "
+ ;;
+ esac
+fi
+
+
+
+
+
+
diff --git a/abs/core/xymon/hobbitadd.py b/abs/core/xymon/hobbitadd.py
new file mode 100644
index 0000000..cb2fbed
--- /dev/null
+++ b/abs/core/xymon/hobbitadd.py
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+#polls the hobbit server for ghost clients. If it finds ghosts it will make a new bb-hosts file
+#with the new clients.
+#Will not add duplicate clients
+#return code of 0 means a new file was written, anything else is an error or no inserts occured
+import urllib2
+import string
+import sys
+
+
+def readbb():
+ global bblist
+ try:
+ infile = open('/data/srv/xymon/etc/hosts.cfg', 'r')
+ except(IOError), e:
+ print "couldn't open bb-hosts file"
+ sys.exit(1)
+ else:
+ bblist = infile.readlines()
+
+ infile.close()
+
+
+def findghosts():
+ global infile
+ global bblist
+ global ghostitems
+ global numberitems
+ try:
+ f = urllib2.urlopen("http://localhost/xymon/hobbit-cgi/ghostlist.sh?SORT=name&MAXAGE=300&TEXT")
+ except urllib2.HTTPError, e:
+ if e.code != 200:
+ print 'error find ghost list'
+ sys.exit(1)
+ else:
+ ghostitems_full = f.readlines()
+ f.close()
+ ghostitems=[]
+ for i in ghostitems_full:
+ if not i.startswith('127.0.0'):
+ ghostitems.append(i)
+ else:
+ continue
+ numberitems = len(ghostitems)
+
+
+def makenewbb():
+ global bblist
+ global ghostitems
+ global numberitems
+ global numinserts
+ numinserts=0
+ outlist = []
+ for item in bblist:
+ if item not in outlist:
+ outlist.append(item)
+
+ for item in ghostitems:
+ line = item.rstrip()
+ nline = "%s #func" % (line)
+ nline = nline + '\n'
+ if nline not in outlist:
+ outlist.append(nline)
+ print "adding: " + nline
+ numinserts = numinserts + 1
+ if numinserts > 0:
+ outfile = open("/data/srv/xymon/etc/hosts.cfg","w")
+ #outfile = open("/tmp/new-bb","w")
+ for i in outlist:
+ outfile.write(i + '\n' )
+ outfile.close
+
+
+global infile
+global bblist
+global ghostitems
+global numberitems
+global numinserts
+numinserts=0
+readbb()
+findghosts()
+
+
+if numberitems > 0:
+ makenewbb()
+#else:
+# print "No hosts to add"
+
+
+if numinserts < 1:
+ sys.exit(1)
+else:
+ sys.exit(0)
+
+
diff --git a/abs/core/xymon/hobbitlaunch.cfg.diff b/abs/core/xymon/hobbitlaunch.cfg.diff
new file mode 100644
index 0000000..6239125
--- /dev/null
+++ b/abs/core/xymon/hobbitlaunch.cfg.diff
@@ -0,0 +1,40 @@
+--- hobbitlaunch.cfg.orig 2008-02-10 22:30:16.000000000 +0000
++++ hobbitlaunch.cfg 2008-08-09 07:05:14.000000000 +0000
+@@ -204,3 +204,37 @@
+ LOGFILE $BBSERVERLOGS/hobbitclient.log
+ INTERVAL 5m
+
++[storage]
++
++ ENVFILE /data/srv/hobbit/server/etc/hobbitserver.cfg
++ CMD /data/srv/hobbit/server/ext/hobbitstorage.py
++ LOGFILE $BBSERVERLOGS/bb-storage.log
++ INTERVAL 5m
++[notes]
++ ENVFILE /data/srv/hobbit/server/etc/hobbitserver.cfg
++ CMD /data/srv/hobbit/server/ext/hbnotes.py
++ LOGFILE $BBSERVERLOGS/bb-notes.log
++ INTERVAL 5m
++[orphan]
++ ENVFILE /data/srv/hobbit/server/etc/hobbitserver.cfg
++ CMD /data/srv/hobbit/server/ext/hobbit-myth-orphan.sh
++ LOGFILE $BBSERVERLOGS/orphan.log
++ INTERVAL 5m
++
++[func]
++ ENVFILE /data/srv/hobbit/server/etc/hobbitserver.cfg
++ CMD sudo /data/srv/hobbit/server/ext/hbfunc.py
++ LOGFILE $BBSERVERLOGS/hbfunc.log
++ INTERVAL 5m
++
++[memmyth]
++ ENVFILE /data/srv/hobbit/server/etc/hobbitserver.cfg
++ CMD /data/srv/hobbit/server/ext/hobbit-mem-myth.sh
++ LOGFILE $BBSERVERLOGS/mythmem.log
++ INTERVAL 5m
++
++[mtc]
++ ENVFILE /data/srv/hobbit/server/etc/hobbitserver.cfg
++ CMD /data/srv/hobbit/server/ext/hobbit_myth_data.py
++ LOGFILE $BBSERVERLOGS/mtc
++ INTERVAL 5m
diff --git a/abs/core/xymon/hobbitserver.cfg.diff b/abs/core/xymon/hobbitserver.cfg.diff
new file mode 100644
index 0000000..7c829fe
--- /dev/null
+++ b/abs/core/xymon/hobbitserver.cfg.diff
@@ -0,0 +1,45 @@
+--- hobbitserver.cfg.orig 2008-01-08 15:25:34.000000000 +0000
++++ hobbitserver.cfg 2008-01-08 16:22:56.000000000 +0000
+@@ -105,7 +105,7 @@
+ CONNTEST="TRUE" # Should we 'ping' hosts ?
+ IPTEST_2_CLEAR_ON_FAILED_CONN="TRUE" # If TRUE, then failing network tests go CLEAR if conn-test fails.
+ NONETPAGE="" # Network tests that go YELLOW upon failure
+-FPING="/usr/sbin/fping" # Path and options for the ping program.
++FPING="hobbitping" # Path and options for the ping program.
+ NTPDATE="ntpdate" # Path to the 'ntpdate' program
+ TRACEROUTE="traceroute" # How to do traceroute on failing ping tests. Requires "trace" in bb-hosts.
+ BBROUTERTEXT="router" # What to call a failing intermediate network device.
+@@ -120,7 +120,9 @@
+ # Size of the generated graph images
+ RRDHEIGHT="120"
+ RRDWIDTH="576" # The RRD's contain 576 data points, so this is a good value
+-
++NCV_storage="*:GAUGE"
++NCV_memmbe="*:GAUGE"
++NCV_memmfe="*:GAUGE"
+ # TEST2RRD defines the status- and data-messages you want to collect RRD data
+ # about. You will normally not need to modify this, unless you have added a
+ # script to pick up RRD data from custom tests (the hobbitd_larrd --extra-script
+@@ -132,11 +134,11 @@
+ #
+ # This is also used by the bb-hostsvc.cgi script to determine if the detailed
+ # status view of a test should include a graph.
+-TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines"
++TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,storage=ncv,memmbe=ncv,memmfe=ncv"
+
+ # This defines which RRD files to include on the "trends" column webpage,
+ # and the order in which they appear.
+-GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock,lines"
++GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock,lines,storage,memmbe,memmfe"
+
+ # These two settings can be used to restrict what filesystems are being
+ # tracked (i.e. have their utilisation graphed) by Hobbit.
+@@ -158,7 +160,7 @@
+ HTMLCONTENTTYPE="text/html" # You can add charset options here.
+
+ # Fonts and texts
+-HOBBITLOGO="Hobbit" # HTML inserted on all header pages at top-left corner.
++HOBBITLOGO="" # HTML inserted on all header pages at top-left corner.
+ MKBBLOCAL="<B><I>Pages Hosted Locally</I></B>"
+ MKBBREMOTE="<B><I>Remote Status Display</I></B>"
+ MKBBSUBLOCAL="<B><I>Subpages Hosted Locally</I></B>"
diff --git a/abs/core/xymon/hobbitstorage.py b/abs/core/xymon/hobbitstorage.py
new file mode 100644
index 0000000..e79f8d1
--- /dev/null
+++ b/abs/core/xymon/hobbitstorage.py
@@ -0,0 +1,121 @@
+#!/usr/bin/python
+# import MySQL module
+
+import MySQLdb
+import sys
+import getopt
+import socket
+import os
+import time
+import string
+
+def LIVETV():
+ grandtotal=0
+ global rectv_total
+ global rectv_time
+ global livetv_total
+ global livetv_time
+ # create a cursor
+ cursor = db.cursor()
+ # execute SQL statement
+
+ cursor.execute("SELECT unix_timestamp(starttime),unix_timestamp(endtime),title FROM recorded where recgroup=(%s) ORDER by starttime;" , ("livetv"))
+ result = cursor.fetchall()
+
+ for row in result:
+ # print row[0], row[1] ,row [2]
+ start=row[0]
+ end=row[1]
+ if ( end > start ):
+ total = (end - start) /60
+ grandtotal+=total
+ hours = grandtotal / 60.0
+ days = hours / 24.0
+
+ livetv_total=len(result)
+ livetv_time=hours
+
+
+
+def RECORDTV():
+ grandtotal=0
+ global rectv_total
+ global rectv_time
+ global livetv_total
+ global livetv_time
+ # create a cursor
+ cursor = db.cursor()
+ # execute SQL statement
+
+ cursor.execute("SELECT unix_timestamp(starttime),unix_timestamp(endtime),title FROM recorded where not recgroup=(%s) ORDER by starttime;" , ("livetv"))
+ result = cursor.fetchall()
+
+ for row in result:
+ # print row[0], row[1] ,row [2]
+ start=row[0]
+ end=row[1]
+ if ( end > start ):
+ total = (end - start) /60
+ grandtotal+=total
+ hours = grandtotal / 60.0
+ days = hours / 24.0
+
+ rectv_total=len(result)
+ rectv_time=hours
+
+
+
+def printvars():
+ print rectv_time
+ print rectv_total
+ print livetv_time
+ print livetv_total
+
+def sendTObb():
+ DATE = time.strftime("%a %b %d %H:%M:%S %Z %Y", time.localtime(time.time()))
+ if os.environ['BB']:
+ #print os.environ['BB']
+ BB=os.environ['BB']
+ if os.environ['BBDISP']:
+ #print os.environ['BBDISP']
+ BBDISP=os.environ['BBDISP']
+ if os.environ['MACHINE']:
+ # print os.environ['MACHINE']
+ MACHINE=os.environ['MACHINE']
+
+ # MACHINE = socket.gethostname()
+ # MACHINE = string.replace(MACHINE, '.', ',')
+ INFOLINE= "\n rectv_total:" + str(rectv_total)
+ INFOLINE= INFOLINE + "\n rectv_time:" + str(rectv_time)
+ INFOLINE= INFOLINE + "\n livetv_total:" + str(livetv_total)
+ INFOLINE= INFOLINE + "\n livetv_time:" + str(livetv_time)
+ INFOLINE= INFOLINE + "\n "
+
+
+
+ LINE = "status " + MACHINE + ".storage green" + " " + DATE + " " + INFOLINE
+
+ cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'
+ os.system(cmd)
+ #print LINE
+
+def main(argv):
+ global db
+ global rectv_total
+ global rectv_time
+ global livetv_total
+ global livetv_time
+
+ rectv_total=0
+ rectv_time=0
+ livetv_total=0
+ livetv_time=0
+
+ db = MySQLdb.connect(host="localhost", user="mythtv", passwd="mythtv", db="mythconverg")
+
+ LIVETV()
+ RECORDTV()
+ #printvars()
+ sendTObb()
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/abs/core/xymon/log_list.sh b/abs/core/xymon/log_list.sh
new file mode 100644
index 0000000..b8ce066
--- /dev/null
+++ b/abs/core/xymon/log_list.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+#This file is used provide a list of log files for xymon client to send back.
+# This is needed because of the dynamic nature of the log file names
+DATE=`date +%Y-%m-%d`
+HOST=`hostname`
+logdir="/var/log/$DATE/"
+for i in messages.log
+do
+
+ echo $logdir${HOST}_$i
+
+done
diff --git a/abs/core/xymon/logrotate.xymon b/abs/core/xymon/logrotate.xymon
new file mode 100644
index 0000000..a86a0ba
--- /dev/null
+++ b/abs/core/xymon/logrotate.xymon
@@ -0,0 +1,11 @@
+/var/log/hobbit/* {
+ missingok
+ daily
+ rotate 2
+ compress
+ postrotate
+ sv restart xymon-server
+ sv restart xymon-client
+ endscript
+
+}
diff --git a/abs/core/xymon/tasks.d.mv b/abs/core/xymon/tasks.d.mv
new file mode 100644
index 0000000..696cb4e
--- /dev/null
+++ b/abs/core/xymon/tasks.d.mv
@@ -0,0 +1,39 @@
+[storage]
+
+ ENVFILE /data/srv/xymon/server/etc/xymonserver.cfg
+ CMD /data/srv/xymon/server/ext/hobbitstorage.py
+ LOGFILE $BBSERVERLOGS/bb-storage.log
+ INTERVAL 5m
+[notes]
+ ENVFILE /data/srv/xymon/server/etc/xymonserver.cfg
+ CMD /data/srv/xymon/server/ext/hbnotes.py
+ LOGFILE $BBSERVERLOGS/bb-notes.log
+ INTERVAL 5m
+[orphan]
+ ENVFILE /data/srv/xymon/server/etc/xymonserver.cfg
+ CMD /data/srv/xymon/server/ext/hobbit-myth-orphan.sh
+ LOGFILE $BBSERVERLOGS/orphan.log
+ INTERVAL 5m
+
+[func]
+ ENVFILE /data/srv/xymon/server/etc/xymonserver.cfg
+ CMD /data/srv/xymon/server/ext/hbfunc.py
+ LOGFILE $BBSERVERLOGS/hbfunc.log
+ INTERVAL 5m
+
+[memmyth]
+ ENVFILE /data/srv/xymon/server/etc/xymonserver.cfg
+ CMD /data/srv/xymon/server/ext/hobbit-mem-myth.sh
+ LOGFILE $BBSERVERLOGS/mythmem.log
+ INTERVAL 5m
+
+[mtc]
+ ENVFILE /data/srv/xymon/server/etc/xymonserver.cfg
+ CMD /data/srv/xymon/server/ext/hobbit_myth_data.py
+ LOGFILE $BBSERVERLOGS/mtc
+ INTERVAL 5m
+[ghost]
+ ENVFILE /data/srv/xymon/server/etc/xymonserver.cfg
+ CMD /data/srv/xymon/server/bin/hobbitadd.py
+ LOGFILE $BBSERVERLOGS/hobbitadd.log
+ INTERVAL 5m
diff --git a/abs/core/xymon/tuner.png b/abs/core/xymon/tuner.png
new file mode 100644
index 0000000..e4ca198
--- /dev/null
+++ b/abs/core/xymon/tuner.png
Binary files differ
diff --git a/abs/core/xymon/tv.png b/abs/core/xymon/tv.png
new file mode 100644
index 0000000..9c4490c
--- /dev/null
+++ b/abs/core/xymon/tv.png
Binary files differ
diff --git a/abs/core/xymon/xymon-client.install b/abs/core/xymon/xymon-client.install
new file mode 100644
index 0000000..301fc1f
--- /dev/null
+++ b/abs/core/xymon/xymon-client.install
@@ -0,0 +1,22 @@
+post_install() {
+ . /etc/systemconfig
+ sed -i -e "s/127.0.0.1/$dbhost/" /data/srv/xymon/client/etc/xymonclient.cfg
+ chown -R nobody /data/srv/xymon
+
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ /bin/true
+}
+
+pre_remove() {
+ /bin/true
+}
+op=$1
+shift
+$op $*
+# vim: ft=sh ts=2
diff --git a/abs/core/xymon/xymon.install b/abs/core/xymon/xymon.install
new file mode 100644
index 0000000..08fbd8c
--- /dev/null
+++ b/abs/core/xymon/xymon.install
@@ -0,0 +1,68 @@
+post_install() {
+ . /etc/systemconfig
+ if [ ! -f /data/srv/xymon/server/ext/ignoreclient.py ]
+ then
+ echo "#this is a list of hosts to ignore" > /data/srv/xymon/server/ext/ignoreclient.py
+ echo ignorehosts=\"\'ignoreme1\',\'ignoreme2\'\" >> /data/srv/xymon/server/ext/ignoreclient.py
+ fi
+
+ if [ ! -f /data/srv/httpd/htdocs/failed_func_hosts ]
+ then
+ touch /data/srv/httpd/htdocs/failed_func_hosts
+ fi
+ chown nobody:nobody /data/srv/httpd/htdocs/failed_func_hosts
+ chmod 777 /data/srv/httpd/htdocs/failed_func_hosts
+
+
+ sed -i -e "s/localhost/$hostname/" /data/srv/xymon/server/etc/hosts.cfg
+ sed -i -e "s/\#/\# func/" /data/srv/xymon/server/etc/hosts.cfg
+ sed -i -e "s/localhost/$hostname/" /data/srv/xymon/server/etc/xymonserver.cfg
+ chown -R nobody /data/srv/xymon
+ chown -R nobody /data/srv/httpd/htdocs/xymon
+ chown -R nobody /var/log/hobbit
+ chown root /data/srv/xymon/server/bin/xymonping
+ chmod +s /data/srv/xymon/server/bin/xymonping
+ echo "Adding sudo permissions for nobody {certmaster-ca}"
+ echo "Adding sudo permissions for http {backup_job}"
+ LINE="nobody ALL = NOPASSWD:/usr/bin/certmaster-ca"
+ LINE1="http ALL = NOPASSWD:/usr/MythVantage/bin/backup_job"
+
+ for i in "$LINE" "$LINE1"
+ do
+ cp /etc/sudoers /etc/sudoers.bak
+ grep -q "$i" /etc/sudoers
+ if [ $? != 0 ]
+ then
+ echo "$i" >> /etc/sudoers
+ visudo -cf /etc/sudoers
+ if [ ! $? = 0 ]
+ then
+ cp /etc/sudoers.bak /etc/sudoers
+ echo $i
+ echo "Error adding files"
+ exit 1
+ fi
+ fi
+ done
+
+
+
+
+
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ rm -f /data/srv/httpd/htdocs/xymon/index.html
+}
+
+pre_remove() {
+ /bin/true
+}
+op=$1
+shift
+$op $*
+# vim: ft=sh ts=2
diff --git a/abs/core/xymon/xymon_ghost_check b/abs/core/xymon/xymon_ghost_check
new file mode 100644
index 0000000..e51efb6
--- /dev/null
+++ b/abs/core/xymon/xymon_ghost_check
@@ -0,0 +1,2 @@
+#!/bin/bash
+/usr/bin/sudo -u nobody /data/srv/xymon/server/bin/hobbitadd.py
diff --git a/abs/core/xymon/xymonserver.cfg.diff b/abs/core/xymon/xymonserver.cfg.diff
new file mode 100644
index 0000000..a8a469d
--- /dev/null
+++ b/abs/core/xymon/xymonserver.cfg.diff
@@ -0,0 +1,29 @@
+--- xymonserver.cfg.orig 2011-11-22 07:58:19.405933864 -0800
++++ xymonserver.cfg 2011-11-22 08:01:32.452933536 -0800
+@@ -125,6 +125,10 @@
+ RRDHEIGHT="120"
+ RRDWIDTH="576" # The RRD's contain 576 data points, so this is a good value
+
++NCV_storage="*:GAUGE"
++NCV_memmbe="*:GAUGE"
++NCV_memmfe="*:GAUGE"
++
+ # TEST2RRD defines the status- and data-messages you want to collect RRD data
+ # about. You will normally not need to modify this, unless you have added a
+ # script to pick up RRD data from custom tests (the xymond_rrd --extra-script
+@@ -136,11 +140,13 @@
+ #
+ # This is also used by the svcstatus.cgi script to determine if the detailed
+ # status view of a test should include a graph.
+-TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,if_load=devmon,temp=devmon,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond"
++#TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,if_load=devmon,temp=devmon,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond"
++TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,if_load=devmon,temp=devmon,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond,storage=ncv,memmbe=ncv,memmfe=ncv"
+
+ # This defines which RRD files to include on the "trends" column webpage,
+ # and the order in which they appear.
+-GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,devmon::1,if_load::1,temp,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond"
++#GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,devmon::1,if_load::1,temp,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond"
++GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,devmon::1,if_load::1,temp,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,xymongen,xymonnet,xymonproxy,xymond,storage,memmbe,memmfe"
+
+ # These two settings can be used to restrict what filesystems are being
+ # tracked (i.e. have their utilisation graphed) by Xymon.