The server every admin needs
Wednesday, July 15th, 2009 | Author: Ozzik

The 3 main files you need to edit are: bb-hosts, bb-services and hobbit-alerts.cfg. All found in /etc/hobbit/ directory.
First, add some essential (for you) services to bb-services file. For example, for me it was MS SQL port(1433) and port 80. So in addition to a lot of services that already exist in the file I added:

[port80]
   options telnet
   port 80        
	
[mssql]
   options telnet
   port 1433

Now we need to add some hosts. Basically it can be done in a variety of ways, including different pages and subpages (and if like me you have more than a 150 servers, you must categorize them).

But you can read all about it in help pages of the project, so I’m not going to bore you with it. To get help, just go to “Help” –> “Hobbit Man-Pages” in your Xymon menu.
Just to give you an example:

10.0.0.5  example-server               # port80

it’s just one of my lines in the file.

This server is monitored by ICMP(ping) and telnet port 80, as configured above.
And finally, we need to configure the alerts. There is an hobbit-clients.cfg file with the default configuration, which works pretty good for me, but you might want to change it. And there’s a hobbit-alerts.cfg file, which is actually responsible for deciding whether to send an alert and which kind.
This is what I added there:

HOST=server1,server2,server5,server7 EXSERVICE=msgs,cpu,memory
SCRIPT /usr/lib/hobbit/server/ext/smsplus.sh 5555555555@smsgateway.com
FORMAT=sms COLOR=red DURATION>3 REPEAT=7d RECOVERED
MAIL myemail@myemail.com COLOR=red DURATION>3 REPEAT=7d RECOVERED
	
HOST=* EXSERVICE=msgs EXHOST=server1,server2,server5,server7
MAIL myemail@myemail.com COLOR=red DURATION>3 REPEAT=7d RECOVERED
SCRIPT /usr/lib/hobbit/server/ext/smsplus.sh 5555555555@smsgateway.com
FORMAT=sms COLOR=red DURATION>3 REPEAT=7d RECOVERED

Please note the lines started with “FORMAT” are actually the continuation of the previous lines (wordpress limitation). What I have here is servers 1,2,5 and 7 configured to alert me by sms and email if anything goes wrong and it lasts for at least 3 minutes. The alert will repeat itself every 7 days, until recovered. If anything to happen with cpu, memory or messages - it will be ignored.

All the other hosts will alert me in the same way, but will only disregard the messages.

A small explanation of my tactics. If you leave messages “on” - it will drive you crazy within an hour. So do yourself a favor and don’t:) Unless you absolutely must. 3 minutes is because sometimes the ping gets lost, but it doesn’t mean that the server is down, but since the next round will be only after 30 sec or maybe even a minute - you don’t wanna get false alarm. The same goes for the cpu and memory spikes, and well, for all the services the way I see them. YMMV, of course. There are a lot of ways to configure the alerts file, so read the manual to learn how.

The last thing regarding the alerts is the SMS script you saw me use before.
I use this one:

sudo nano /usr/lib/hobbit/server/ext/smsplus.sh


#!/bin/bash
msg=`echo "${BBALPHAMSG}" | egrep "&yellow|&red"`
msg="\n${msg}"
# CODE:
#=======
subject="!HB ${ACKCODE}"
alert="${BBHOSTSVC} ${MACHIP} ${BBCOLORLEVEL} ${DOWNSECS} ${RECOVERED}"
message="\n${alert}${msg}"
echo -e "${message}" | mail -s "${subject}" $RCPT

adjust to your needs. Also it is impossible to use mobile providers to send SMS in my country, so I’m using SMS gateway: I send the email - they convert it to SMS.
And the last thing I wanna tell you about (before I send you once again to read the manual) is the client.

Basically, I use the old one, and I believe it will work just as well with the new version. The procedure is very simple: the client is installed on the server, gathering the information and once every 5 min(I think) sends it to the Xymon server on port 1984 (should be forwarded if inside LAN). And of course, you can change it to any other port if you like.

The info it collects is cpu, memory, hard drive space, etc. You don’t need it if all you want to monitor is network services, such as ICMP or telnet.
I use 2 version of clients: for Linux and for Windows.

Linux version is here (deb file) and the windows version is here.
Small configurations needed for both. On Linux I edit the /etc/default/hobbit-client file and change the “server” to the actual Xymon server IP. I also edit the “client” and change it to the exact same name I have in bb-hosts file for it on Xymon server. If those won’t match - the server will get no info.

On Windows, after installing the client, I edit the C:\Program Files\BBWin\etc\BBWin.cfg file and change this value:
"setting name="bbdisplay" value="XymonServer"
input the Xymon server IP there. Afterwords I edit the registry - I’m not sure if it’s needed in the newer versions of the client, but I once read it’s necessary, so I’m doing it ever since:)

HKEY_LOCAL_MACHINE\Software\BBWin

edit the “hostname” value to match the name of the server in the bb-hosts file on Xymon server. Now restart the “Big Brother Hobbit Client” service and you’re done.
OK…
I guess that’s about it for now. Next I’ll talk about the rest of the setup, so don’t go anywhere:)

Ozzik.

P.S. check that you’re able to send mail, otherwise it’s a little pointless to count on the alerts.
If not - try to troubleshoot Postfix.

VN:F [1.9.6_1107]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)
  • Digg
  • Facebook
  • Twitter
  • Google Reader
  • Google Bookmarks
  • Delicious
  • Gmail
  • LinkedIn
  • LiveJournal
  • Reddit
  • Slashdot
  • StumbleUpon
  • Identi.ca
  • Share/Bookmark
Pages: 1 2 3