<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ball Dawg! &#187; Server Monitoring</title>
	<atom:link href="http://www.balldawg.net/index.php/category/server-monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.balldawg.net</link>
	<description>Just some ninja monkeys, nothing to see here.  Move along.</description>
	<lastBuildDate>Fri, 13 Jan 2012 02:02:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using HAProxy and Keepalived for HA Puppet</title>
		<link>http://www.balldawg.net/index.php/2010/12/haproxy-keepalived-puppet/</link>
		<comments>http://www.balldawg.net/index.php/2010/12/haproxy-keepalived-puppet/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 19:30:43 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Server Monitoring]]></category>
		<category><![CDATA[HAProxy]]></category>
		<category><![CDATA[keepalived]]></category>
		<category><![CDATA[Puppet]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=359</guid>
		<description><![CDATA[I&#8217;ve had a &#8220;backup&#8221; puppet server for some time now, but the fail-over was completely manual. Meaning if the main puppet server failed, I&#8217;d actually need to change DNS to point to the other server. This if fine for environments where a bit of downtime does not hurt, but in a production environment it&#8217;s less [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a &#8220;backup&#8221; puppet server for some time now, but the fail-over was completely manual.  Meaning if the main puppet server failed, I&#8217;d actually need to change DNS to point to the other server.  This if fine for environments where a bit of downtime does not hurt, but in a production environment it&#8217;s less than ideal.   When I had a bit of spare time recently I decided to implement an automatic fail over for our environment.  To do this I decided to use HAProxy for the load balancing and keepalived to manage a virtual IP.<br />
<img alt="" src="http://www.balldawg.net/files/diagram_vip.png" title="Network Layout" class="aligncenter" width="628" height="203" /><br />
<span id="more-359"></span><br />
This setup assumes that when you setup your puppet master you didn&#8217;t use the actual machine name as the puppet server name in your puppet.conf.  For example, in my case I used puppet.domain.com, as apposed to the actual DNS name of the machine it lives on.  puppet.domain.com is just a CNAME to the machines DNS name, but since web based SSL is based off the DNS name you are connecting too I can float different machines behind puppet.domain.com and the client is none the wiser.  To do it you&#8217;ll need to sign puppet.machine.com with puppetca and mirror your CA to your backup machine.  </p>
<p>To make this setup work, first you&#8217;ll need a virtual IP to point puppet.machine.com at and setup keepalived to manage it.  The keepalived setup was fairly straight forward, both machines were on the same network so I just picked an IP and configured keepalived on each machine.  In my case the configurations were as follows:</p>
<pre class="brush: php">
vrrp_instance VI_1 {
        interface bond0
        state MASTER
        virtual_router_id 51
        priority 101
        authentication {
            auth_type PASS
            auth_pass PASSWORD
        }
        virtual_ipaddress {
                192.168.33.61/26 dev bond0
        }
        notify_master /sw/keepalived/scripts/notify_master.sh
        notify_backup /sw/keepalived/scripts/notify_backup.sh
        notify_fault /sw/keepalived/scripts/notify_backup.sh
}
</pre>
<p>Basically for bonded interface 0, add the virtual interface of 192.168.33.61/26, and this machine has a priority of 101, or master.  The three entries at the bottom are what to run if the machine should fail over or fail back.  The other machine has a similar setup, except it has the priority of 100, or backup.</p>
<p>After starting up keepalived on both machines, they negotiate and the machine with the higher priority ends up with the IP enabled on bond0 as a secondary address.</p>
<p>Next I needed something to manage fail-over of the puppet &#8220;service&#8221; should the interface/IP stay up and just the puppet service fail.  For this I decided to use HAProxy.  It&#8217;s configuration is, again, fairly straight forward.  You need to setup a front end to listen on the default puppet master port, and a back end that has both your puppet master machines in it.  The configuration is as follows:</p>
<pre class="brush: php">
global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     10000
    user        haproxy
    group       haproxy
    daemon
    stats socket /var/lib/haproxy/stats

defaults
    log                     global
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 8000

frontend        puppet 192.168.33.61:8140
    mode tcp
    default_backend     puppet0

backend puppet0
    mode        tcp
    option      ssl-hello-chk
    balance     roundrobin
    server      server1 192.168.33.17:8140 check
    server      server2 192.168.33.27:8140 check backup
</pre>
<p>This configuration and the installation of haproxy is mirrored on the second server.  </p>
<p>Now if you recall I had some scripts that were to run should keepalived feel the need to fail to/from the backup server.  Because haproxy binds to the address on start up, you can&#8217;t have it running on your backup server.  To work around the script is run upon keepalived starting that IP on the system, the script starts haproxy.</p>
<p>With the complicated part done, it was just a matter of mirroring my puppet manifests and files between the two machines, and making sure they stay up to date.  Ideally you&#8217;d have them on some sort of NAS which is just mounted on both machines which would make them being out of date impossible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2010/12/haproxy-keepalived-puppet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Puppet Dashboard with Multiple Puppet Masters</title>
		<link>http://www.balldawg.net/index.php/2010/05/puppet-dashboard-with-multiple-puppet-masters/</link>
		<comments>http://www.balldawg.net/index.php/2010/05/puppet-dashboard-with-multiple-puppet-masters/#comments</comments>
		<pubDate>Wed, 26 May 2010 14:38:02 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Server Monitoring]]></category>
		<category><![CDATA[Puppet]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=310</guid>
		<description><![CDATA[Mike Zupan&#8217;s blog has a nice how to on installing puppet&#8217;s dashboard on CentOS 5, following it I was able to get the dashboard up and running with ease.  Since I have two puppet master&#8217;s that I&#8217;d like to report to the dashboard I found you can easily accomplish this without a full dashboard install [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://zcentric.com/2010/03/11/install-puppet-dashboard-on-redhatcentos-5/">Mike Zupan&#8217;s blog</a> has a nice how to on installing puppet&#8217;s dashboard on CentOS 5, following it I was able to get the dashboard up and running with ease.   Since I have two puppet master&#8217;s that I&#8217;d like to report to the dashboard I found you can easily accomplish this without a full dashboard install on each master.</p>
<p>You just need to:</p>
<ol>
<li>Copy over &#8216;puppet_dashboard.rb&#8217; with a modified HOST line to the other host.</li>
<li>Modify /etc/sysconfig/puppetmaster.</li>
<li>Turn on reporting on the clients.</li>
<li>Restart puppetmaster.</li>
</ol>
<p>Since the puppet_dashboard.rb is just making an HTTP post to the dashboard server, it can be coming from anywhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2010/05/puppet-dashboard-with-multiple-puppet-masters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Breaking out of a HTTP proxy enviroment</title>
		<link>http://www.balldawg.net/index.php/2010/02/breaking-out-of-a-http-proxy-enviroment/</link>
		<comments>http://www.balldawg.net/index.php/2010/02/breaking-out-of-a-http-proxy-enviroment/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 18:24:47 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Server Monitoring]]></category>
		<category><![CDATA[corkscrew]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=302</guid>
		<description><![CDATA[Being in a large corporate environment has positives and negatives, one of those negatives is that many companies use HTTP proxies to control and track internet usage from your work machines.  While in most cases this is very important from the HR and workplace productivity side, it can become a headache if you actually need [...]]]></description>
			<content:encoded><![CDATA[<p>Being in a large corporate environment has positives and negatives, one of those negatives is that many companies use HTTP proxies to control and track internet usage from your work machines.  While in most cases this is very important from the HR and workplace productivity side, it can become a headache if you actually need something outside your companies firewalls that is blocked.  In my case I wanted to backup some configurations and code to my home machine.  To do this I&#8217;d generally just rsync over ssh or scp the files over to an off site machine.   Sadly with a full firewall up and all traffic required to go through HTTP proxies, I had to find a different solution.  In my case, I decided to use &#8216;corkscrew&#8217;.<br />
<span id="more-302"></span><br />
Corkscrew tunnels SSH connections through HTTP proxies, you can find it at <a title="agroman.net/corkscrew/" href="http://www.agroman.net/corkscrew/">agroman.net/corkscrew/</a>.  It was quite easy to setup, and with some tweaks to your ssh config you can seamlessly use it.</p>
<p>My next trick is useful for getting around having your HTTP usage tracked and filtered, this is just taking advantage of the &#8220;-D&#8221; option within the &#8216;ssh&#8217; program.  When you invoke the -D option, followed with a port number you not only connect to the remote machine via SSH, but you also create a SOCKS proxy server on the port specified.  Setting up your browser&#8217;s proxy settings to point at that port on your local machine will securely forward any requests over to the remote machine, where they will then go out to their final destination.</p>
<p>When you combine corkscrew with ssh -D, you end up with a single, secure connection through the HTTP proxy to your remote machine with a SOCKS proxy through it.  This effectively gives you an easy unfiltered hole through to the outside.</p>
<p>You can also use this trick for getting rsync through a http firewall that might otherwise block it.  To accomplish this you just have setup your RSYNC_CONNECT_PROG environment variable to &#8220;/path/to/corkscrew &lt;proxy&gt; &lt;proxy_port&gt; %H 873 &lt;auth_file&gt;&#8221;.</p>
<p>Disclaimer: Check with your IT policies before attempting any of the above to make sure its allowed!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2010/02/breaking-out-of-a-http-proxy-enviroment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Simple Puppet Recipe for Tripwire</title>
		<link>http://www.balldawg.net/index.php/2009/08/puppetizing-tripwire/</link>
		<comments>http://www.balldawg.net/index.php/2009/08/puppetizing-tripwire/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 13:43:40 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Server Monitoring]]></category>
		<category><![CDATA[Tripwire]]></category>
		<category><![CDATA[Puppet]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=262</guid>
		<description><![CDATA[Since I failed to find a good description of how to do this on the web, I thought I&#8217;d share my recipe for using puppet to manage tripwire. This method will take care of running the initialization on the first puppetd run on a new machine, and update the policy file if its changed. It [...]]]></description>
			<content:encoded><![CDATA[<p>Since I failed to find a good description of how to do this on the web, I thought I&#8217;d share my recipe for using puppet to manage tripwire.   This method will take care of running the initialization on the first puppetd run on a new machine, and update the policy file if its changed.  It also has puppet managing your site.key, twcfg.txt, twpol.txt, and the daily cron to run the checks.  Its an extremely simple setup, but gets the job done.</p>
<p>I&#8217;ll start with the tripwire.pp file for puppet, in this file you&#8217;ll define your tripwire class and associated files and packages:<br />
<span id="more-262"></span></p>
<pre class="brush: perl">
class tripwire {
        file { &quot;/etc/tripwire/Makefile&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
                source =&gt; &quot;puppet:///etc/tripwire/Makefile&quot;,
                require =&gt; Package[tripwire],
        }
        file { &quot;/etc/tripwire/site.key&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
                source =&gt; &quot;puppet:///etc/tripwire/site.key&quot;,
                require =&gt; Package[tripwire],
        }
        file { &quot;/etc/tripwire/twcfg.txt&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
                source =&gt; &quot;puppet:///etc/tripwire/twcfg.txt&quot;,
                require =&gt; Package[tripwire],
        }
        file { &quot;/etc/tripwire/twpol.txt&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
                source =&gt; &quot;puppet:///etc/tripwire/twpol.txt&quot;,
                require =&gt; Package[tripwire],
        }

        file { &quot;/etc/cron.daily/tripwire-check&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 755,
                source =&gt; &quot;puppet:///etc/cron.daily/tripwire-check&quot;,
                require =&gt; Package[tripwire],
        }

        file { &quot;/var/lib/tripwire/tripwire.twd&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
        }

        package {
                &quot;tripwire&quot;:
                        ensure =&gt; &quot;installed&quot;,
        }

        exec {
                &quot;make -C /etc/tripwire&quot;:
                        cwd =&gt; &quot;/etc/tripwire&quot;,
                        path =&gt; [&quot;/bin&quot;, &quot;/usr/bin&quot; ],
                        creates =&gt; &quot;/var/lib/tripwire/tripwire.twd&quot;,
                        timeout =&gt; 10000
        }

        exec {
                &quot;tripwire --update-policy -Z low --local-passphrase &#039;&#039; --site-passphrase &#039;&#039; --quiet /etc/tripwire/twpol.txt&quot;:
                        cwd =&gt; &quot;/etc/tripwire&quot;,
                        path =&gt; [&quot;/sbin&quot;, &quot;/usr/sbin&quot; ],
                        timeout =&gt; 10000,
                        refreshonly =&gt; &quot;true&quot;,
                        subscribe =&gt; File[&quot;/etc/tripwire/twpol.txt&quot;],

        }
}
</pre>
<p>You&#8217;ll notice there is a Makefile defined, this will make remote management much simpler, it contains some simple house keeping items.  I do not use all these within my puppet implementation, however:</p>
<pre class="brush: perl">
all: tw.cfg tw.pol /var/lib/tripwire/tripwire.twd

clean:
        /bin/rm -f /etc/tripwire/local.key /etc/tripwire/tw.cfg /etc/tripwire/tw.pol /var/lib/tripwire/tripwire.twd

init: clean /var/lib/tripwire/tripwire.twd

local.key:
        /usr/sbin/twadmin --generate-keys --local-keyfile local.key --local-passphrase &#039;&#039;

tw.cfg: site.key twcfg.txt
        /usr/sbin/twadmin --create-cfgfile --site-keyfile site.key --site-passphrase &#039;&#039; twcfg.txt

tw.pol: tw.cfg twpol.txt
        if [ -f tw.pol -a -f /var/lib/tripwire/tripwire.twd ]; \
        then /usr/sbin/tripwire --update-policy --local-passphrase &#039;&#039; --quiet --secure-mode low --site-passphrase &#039;&#039; twpol.txt; \
        else /usr/sbin/twadmin --create-polfile --site-passphrase &#039;&#039; twpol.txt; \
        fi

/var/lib/tripwire/tripwire.twd: local.key site.key
        /usr/sbin/tripwire --init --local-passphrase &#039;&#039;
</pre>
<p>My twcfg.txt is very simple:</p>
<pre class="brush: perl">
# required
DBFILE                 = /var/lib/tripwire/tripwire.twd
LOCALKEYFILE           = /etc/tripwire/local.key
POLFILE                = /etc/tripwire/tw.pol
REPORTFILE             = /var/lib/tripwire/report/$(DATE).twr
SITEKEYFILE            = /etc/tripwire/site.key

# e-mail notification
EMAILREPORTLEVEL       = 3
GLOBALEMAIL            = email@domain.tld
MAILMETHOD             = SENDMAIL
MAILNOVIOLATIONS       = false
MAILPROGRAM            = /usr/sbin/sendmail -oi -t

# other
EDITOR                 = /usr/bin/vim
LATEPROMPTING          = false
LOOSEDIRECTORYCHECKING = false
REPORTLEVEL            = 4
SYSLOGREPORTING        = true
TEMPDIRECTORY          = /var/tmp
</pre>
<p>Other than including the tripwire class within your site.pp file, thats about it.</p>
<p><em>Credit: The makefile was created by Steve Coile.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2009/08/puppetizing-tripwire/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pinging Xymon clients on an unreachable network</title>
		<link>http://www.balldawg.net/index.php/2009/07/pinging-xymon-clients-on-an-unreachable-network/</link>
		<comments>http://www.balldawg.net/index.php/2009/07/pinging-xymon-clients-on-an-unreachable-network/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 22:21:34 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Hobbit / Xymon]]></category>
		<category><![CDATA[Server Monitoring]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=252</guid>
		<description><![CDATA[I recently ran into an issue where my I had Xymon clients on a network which was unpingable from the Xymon server.  The clients could could send data to the server, but they were hidden behind network address translation and only on a local network.  I had one box (the gateway for the unreachable clients), [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ran into an issue where my I had Xymon clients on a network which was unpingable from the Xymon server.  The clients could could send data to the server, but they were hidden behind network address translation and only on a local network.  I had one box (the gateway for the unreachable clients), that saw both networks.  I  played with the idea of running bbproxy on it, but didn&#8217;t really want an entire Xymon server and it really was not necessary since the other clients could get their data out.  Looking at hobbitlaunch.cfg I noticed it was really just a larger clientlaunch.cfg, which gave me the idea of just copying over bbnet and using on a client install &#8211; which worked perfectly.<span id="more-252"></span></p>
<p>To do this you&#8217;ll need to copy over the following binarys from the server installation into your client&#8217;s bin directory:</p>
<ul>
<li>bbtest-net</li>
<li>hobbitping</li>
</ul>
<p>You&#8217;ll also need a copy of your bb-hosts and bb-services file, you&#8217;ll need to place these in your client&#8217;s etc folder.  In your bb-hosts file you&#8217;ll only need the hosts that are within the private network you intend to ping, you really don&#8217;t need any grouping information within it either since when the data is sent in to your xymon server it will be assigned to the correct hosts there.</p>
<p>At this point you need to add a section for bbnet within your clientlaunch.cfg, yours may be different since your file locations my vary, so edit to fit your situation:</p>
<pre class="brush: bash">
[bbnet]
ENVFILE /usr/lib/hobbit/client/etc/clientlaunch.cfg
CMD /usr/lib/hobbit/client/bin/bbtest-net --report --ping --checkresponse
LOGFILE $BBSERVERLOGS/bb-network.log
INTERVAL 5m
</pre>
<p>Since bbtest-net needs to know what to do you&#8217;ll need to copy its configuration section from hobbitserver.cfg to hobbitclient.cfg:</p>
<pre class="brush: bash">
# For bbtest-net
CONNTEST=&quot;TRUE&quot;
IPTEST_2_CLEAR_ON_FAILED_CONN=&quot;TRUE&quot;
NONETPAGE=&quot;&quot;
FPING=&quot;/usr/sbin/fping&quot;
NTPDATE=&quot;ntpdate&quot;
TRACEROUTE=&quot;traceroute&quot;
BBROUTERTEXT=&quot;router&quot;
NETFAILTEXT=&quot;not OK&quot;
</pre>
<p>And there you have it &#8211; restart your client and it should be able to ping the clients within the private network and send to your Xymon server.  You&#8217;ll notice a column for bbtest show up for the client you setup to ping as well.   This should work for all network tests, however I&#8217;ve just tested ping.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2009/07/pinging-xymon-clients-on-an-unreachable-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring Sun Grid Engine with Xymon</title>
		<link>http://www.balldawg.net/index.php/2009/07/monitoring-sun-grid-engine-with-xymon/</link>
		<comments>http://www.balldawg.net/index.php/2009/07/monitoring-sun-grid-engine-with-xymon/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 17:13:01 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Hobbit / Xymon]]></category>
		<category><![CDATA[Server Monitoring]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=239</guid>
		<description><![CDATA[After a recent job switch I&#8217;ve had the opportunity to setup Xymon from scratch and start developing even more scripts for new pieces of software and work flows. One of my first tasks was to setup a new &#8220;cluster&#8221; using all the software I felt most comfortable with as a show case in order to [...]]]></description>
			<content:encoded><![CDATA[<p>After a recent job switch I&#8217;ve had the opportunity to setup Xymon from scratch and start developing even more scripts for new pieces of software and work flows.  One of my first tasks was to setup a new &#8220;cluster&#8221; using all the software I felt most comfortable with as a show case in order to determine if my preferred tools worked as well or better than the currently used ones &#8211; or not.  After a week or so of setting up a full Cobbler installation, Xymon and my own Glovebox, I presented it to my new employers with positive responses.  After all that work I wanted to make sure that the people using the system were as happy as possible with the monitoring needs &#8211; one thing was mentioned more than others, which was the ability to easily see the status of Sun&#8217;s Grid Engine running on the cluster.  I immediately set to work and came up with a quick solution for them using Xymon and a script that parsed the output of &#8216;qstat -f&#8217;  As with my Xen monitoring script, it runs in one place and sends in data for all the associated machines.  Meaning for each execution node you&#8217;ll have a column with just its information, and a combined column for the qmaster.  <span id="more-239"></span>The output is as follows:</p>
<blockquote><p>Total Slots: 2<br />
Total Used Slots: 2</p>
<p>Queue: MainQueue<br />
Slots: 2<br />
Reserved Slots: 0<br />
Used Slots: 2</p></blockquote>
<p>The master is the same, but contains information for the entire cluster.  When all slots are taken, the test icon/color turns to &#8216;green&#8217;, when some are available the test icon/color changes to &#8216;clear&#8217;  I&#8217;ve also created an easy to understand graph which consists of a green area that is the total number of slots, which a red area over it showing the used slots.  As slots free up the green shows itself noting there are slots available.</p>
<p>The Script is available for download <a href="http://balldawg.net/files/bb-sge.pl.gz">here</a>.</p>
<p>The Graph definitions are:</p>
<pre class="brush: perl">
[sge]
TITLE SGE Used Slots
YAXIS # Used Slots
DEF:SlotsUsed=sge.rrd:TotalUsedSlots:AVERAGE
DEF:SlotsTotal=sge.rrd:TotalSlots:AVERAGE
AREA:SlotsTotal#00CC00:Total Slots
AREA:SlotsUsed#FF0000:Used Slots
COMMENT:\n
GPRINT:SlotsUsed:LAST:Used Slots  : %5.1lf (cur)
GPRINT:SlotsUsed:MAX: : %5.1lf (max)
GPRINT:SlotsUsed:MIN: : %5.1lf (min)
GPRINT:SlotsUsed:AVERAGE: : %5.1lf (avg)\n
GPRINT:SlotsTotal:LAST:Total Slots   : %5.1lf (cur)
GPRINT:SlotsTotal:MAX: : %5.1lf (max)
GPRINT:SlotsTotal:MIN: : %5.1lf (min)
GPRINT:SlotsTotal:AVERAGE: : %5.1lf (avg)\n
</pre>
<p><strong>Update: </strong>I&#8217;ve modified my script to NOT change colors.  Seems xymon really ignores whatever you sent in since it really thinks you have no data when you turn to &#8216;clear&#8217; &#8211; it was breaking my graphs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2009/07/monitoring-sun-grid-engine-with-xymon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Your Own Hobbit / Xymon Tests</title>
		<link>http://www.balldawg.net/index.php/2009/05/creating-your-own-hobbit-xymon-tests/</link>
		<comments>http://www.balldawg.net/index.php/2009/05/creating-your-own-hobbit-xymon-tests/#comments</comments>
		<pubDate>Sat, 09 May 2009 14:54:00 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Hobbit / Xymon]]></category>
		<category><![CDATA[Server Monitoring]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[xymon]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=96</guid>
		<description><![CDATA[Over the years I&#8217;ve had to write plenty of Hobbit / Xymon scripts to monitor various different things within my employers systems.   Since most all of our applications are custom there are not always built in tests that will work for us.   For example, we use Xen for our development virtual machines and being able to [...]]]></description>
			<content:encoded><![CDATA[<p>Over the years I&#8217;ve had to write plenty of Hobbit / Xymon scripts to monitor various different things within my employers systems.   Since most all of our applications are custom there are not always built in tests that will work for us.   For example, we use Xen for our development virtual machines and being able to track what was going on with those virtual machines is important and being able to identify a VM within Xymon at a moments glance is important to us, so we created a test that does just that.   We have created in house scripts for MySQL Status, MySQL Running Queries, our in house distributed services, Lighttpd (as discussed earlier on this blog), Apache, Memcached, etc.   This doesnt include the hundreds of different snmp tests we&#8217;ve added to Devmon for monitoring our network equiptment.</p>
<p><span id="more-96"></span></p>
<p>Since I&#8217;ve had to write quite a few of these I thought I&#8217;d share a simple recipe for getting started with these scripts.   Most all our scripts are written in Perl, its just what I&#8217;m used too and what most people in our company is fluent in.   Our older scripts (from when we actually ran Big Brother) are almost all shell scripts and I have written at least one in Python since that particular service&#8217;s library was in python.   For this example I&#8217;m going to use Perl default template:</p>
<pre class="brush: perl">
#!/usr/bin/perl -w
#############################################################################
# $Id: $
#############################################################################
use strict;

## BB and related test constants
#############################################################################

use constant GREEN =&gt; &#039;green&#039;;
use constant YELLOW =&gt; &#039;yellow&#039;;
use constant RED =&gt; &#039;red&#039;;

## BB Global variables
#############################################################################

my $prev_run_log = &quot;$ENV{BBTMP}/$ENV{MACHINE}.lighttpd.data&quot;;
my $bbtest = &#039;testname&#039;;
my $color = GREEN;
my $status = $bbtest . &quot; OK&quot;;

## Main Program
#############################################################################
{

my $DATA = &quot;&quot;;

## TEST STUFF HERE

## Send to Hobbit
#############################################################################
my $report_date = `/bin/date`;
chomp($report_date);

system(&quot;$ENV{BB} $ENV{BBDISP} &#039;status $ENV{MACHINE}.$bbtest $color $report_date - $status\n\n$DATA&#039;\n&quot;);

}
</pre>
<p>This script by itself will send a test called &#8216;testname&#8217;, which is green and has the status of &#8216;OK&#8217;.  Since we have not defined anything to test it won&#8217;t contain any data with it.  To run this script you need to be within Xymon&#8217;s &#8220;shell&#8221;, which is basically sh, with some enviroment variables set.  To get there, go to &#8217;bin&#8217; directory within your hobbit client installation, in my case this is: &#8220;/home/hobbit/client/bin&#8221;, you&#8217;ll need to run &#8216;bbcmd&#8217;, this will drop you to a prompt which looks something like this:</p>
<pre class="brush: perl">
[rar@apollo bin]$ ./bbcmd
2009-05-09 10:10:35 Using default environment file /home/hobbit/client/etc/hobbitclient.cfg
sh-3.2$
</pre>
<p>Lets change the test name to something else and gather some data from the system we are running on.   To change the test name to say &#8216;modules&#8217;, just change the $bbtest to &#8216;modules&#8217;.   How about testing what kernel modules are loaded &#8211; or basically just parse the output of &#8216;lsmod&#8217;.   To do this we&#8217;d need to capture the output of the command, this is easy enough in perl, something like this would work just fine:</p>
<pre class="brush: perl">
my $lsmod = `/sbin/lsmod`;
</pre>
<p>With the output of &#8217;lsmod&#8217; captured we can do whatever we want with it.  Lets say we just want the modules, and no other info about them in an array:</p>
<pre class="brush: perl">
my $lsmod = `/sbin/lsmod`;
my @modules = split(/\n/, $lsmod);
my @module_names;

foreach my $module (@modules){
my ($name, $junk) = split(/\s.+/, $module);
push @module_names, $name;
}
</pre>
<p>Now that we have our array created that we can easily loop through for tests, lets run a test on them to see if we have loaded any modules for &#8216;ext&#8217; file systems:</p>
<pre class="brush: perl">
foreach my $module (@module_names) {
if ($module =~ &quot;ext&quot;){
$color = RED;
$status = $bbtest . &quot; NOT OK&quot;
}
}
</pre>
<p>OK,  since we&#8217;d like a list of modules that are loaded on our hobbit test page, we can add all those modules to the &#8216;$DATA&#8217; variable, and finish off this example test.  Within that last look we added, you&#8217;d just push that modules name into &#8216;$DATA&#8217;:</p>
<pre class="brush: perl">
[...]
$status = $bbtest . &quot; NOT OK&quot;
}

$DATA .= $module . &quot;\n&quot;;
}
</pre>
<p>So what kindof output does this give us?  If you want to just see what would be run in the system() call at the bottom of the script, just change &#8216;system&#8217; to &#8216;print&#8217;, the output should be something like the following:</p>
<pre class="brush: perl">
/home/hobbit/client/bin/bb hobbitserver.xipnet.net &#039;status apollo.modules red Sat May  9 10:35:18 EDT 2009 - modules NOT OK

Module
iptable_filter
ip_tables
rfcomm
l2cap
bluetooth
af_packet
nf_conntrack_netbios_ns
ipt_REJECT
nf_conntrack_ipv4
xt_state
nf_conntrack
ip6t_REJECT
xt_tcpudp
ip6table_filter
ip6_tables
x_tables
ipv6
binfmt_misc
dm_multipath
parport_pc
lp
parport
nvram
evbug
usbcore
ext3
jbd
mbcache
evdev
raid10
raid456
async_xor
async_memcpy
async_tx
xor
raid1
raid0
multipath
linear
md_mod
dm_mirror
dm_snapshot
dm_mod
fuse
loop
8250
serial_core
&#039;
</pre>
<p>Now the test is red and has the status of &#8220;NOT OK&#8221; since we tested for any ext file system and I&#8217;m running ext3.   To have the data sent to hobbit, simply set the print back to a system call and setup the approprate section within &#8216;clientlaunch.cfg&#8217;, for our example I&#8217;d use:</p>
<pre class="brush: perl">
[modules]
ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg
CMD $HOBBITCLIENTHOME/ext/bb-modules.pl
LOGFILE $HOBBITCLIENTHOME/logs/hobbitclient.log
INTERVAL 5m
</pre>
<p>I know this is a pretty basic example, but its a place to start &#8211; just let the imagination go from here on the millions of tests you could come up with.  Keep in mind I&#8217;m sending this data in on the &#8220;status&#8221; channel in Xymon &#8211; there is also a &#8220;data&#8221; channel which won&#8217;t create a column and with the test approprately setup within hobbit to capture its data to rrd&#8217;s, you can create graphs that just show up in the &#8220;trends&#8221; column if alarming is not necessary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2009/05/creating-your-own-hobbit-xymon-tests/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

