Nethence Newdoc Olddoc Lab Your IP BBDock  

Setting up ClusterIt

Requirements

Make sure you’ve set up SSH without a password from the clusterit system against the target hosts.

Make sur you’ve got GCC and shit as well as curses.h & X11/Xlib.h to compile the source,

yum groupinstall "Development Tools"
yum install libX11-devel ncurses-devel

Installation

Fetch, extract and install ClusterIt ,

wget "http://prdownloads.sourceforge.net/clusterit/clusterit-2.5.tar.gz"
tar xzf clusterit-2.5.tar.gz
cd clusterit-2.5/
./configure && make clean && make
make install

Configuration

Setup a few needed variables on the system,

vi ~/.bashrc

export RCMD_CMD=ssh
export RCP_CMD=scp
export CLUSTER=/etc/clusterit.conf

source ~/.bashrc

Note if you need special arguments to ssh or scp, just add them,

export RCMD_CMD="ssh -p portnum"
export RCP_CMD="scp -o Port=portnum"

Systems' Inventory

Note. you shouldn’t repeat a same system name in various groups to use the overwall dsh (without -g nor -w) command. If you want to, however, which would make senses if you want to be able to convert this inventory to also be used by Ansible too, then add -w or -g to define targets (e.g. here -g hosts to reproduce the overall behaviour).

vi /etc/clusterit.conf

GROUP:centos6
host1
host2

GROUP:centos7
host3
host4

GROUP:solaris9
host5

LUMP:hosts
centos6
centos7
solaris9

cd ~/
ln -s /etc/clusterit.conf

Usage

Display the hosts and groups,

dsh -q

Check that a generic command works on every target,

dsh -e echo check ok

Execute defined hosts only,

dsh -e -w node1,node2

Then choose a specific group to proceed with more specific system commands,

dsh -e -g group

To upload and execute a script,

dsh -e -g group -s scriptname.bash

Note. rather use /bin/bash instead of /bin/ksh which is not necessarily available everywhere.

The simplest monitoring system ever

tested on NetBSD

Notes

Prepare the scripts,

mkdir ~/report/
cd ~/report/
wget http://pbraun.nethence.com/scripts/net/diskusage.bash
wget http://pbraun.nethence.com/scripts/net/memoryusage.bash
wget http://pbraun.nethence.com/scripts/net/omreport.bash
chmod +x diskusage.bash
chmod +x memoryusage.bash
chmod +x omreport.bash

test them,

cd ~/
dsh -e -g linux -s report/diskusage.bash
dsh -e -g linux -s report/memoryusage.bash
dsh -e -g poweredge -s report/omreport.bash

Make sure you’ve setup the root alias in /etc/mail/aliases.

Eventually setup a smarthost (relayhost =) into /etc/postfix/main.cf

Then finally enable the crontab e.g.,

crontab -e
*/5 * * * * /usr/pkg/bin/dsh -e -g linux -s /root/report/diskusage.bash
0 * * * * /usr/pkg/bin/dsh -e -g poweredge -s /root/report/omreport.bash

on NetBSD, also change the daily/weekly/monthly crontabs so you won’t get bugged (no need to setup a filter which would make the alerts useless!),

15 3 * * * /bin/sh /etc/daily >> /var/log/daily.out 2>&1
30 4 * * 6 /bin/sh /etc/weekly >> /var/log/weekly.out 2>&1
30 5 1 * * /bin/sh /etc/monthly >> /var/log/monthly.out 2>&1

Note. full path for script to be executed is needed into the crontab, while on command line you can use -s report/scriptname where ever you are (so it’s not even relative to your current working directory but to the homedir), strange.

To enable the Web UI, launch the NetBSD built-in web server (Bozohttpd),

cd /etc/
cp inetd.conf inetd.conf.dist
vi inetd.conf

http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd -X /var/www
http stream tcp6 nowait:600 _httpd /usr/libexec/httpd httpd -X /var/www

/etc/rc.d/inetd reload

Note. -X to enable directory listing

Miscellaneous

If you are using Ansible or other System Manager then this script might be useful to maintain a shared list of hosts or systems,

echo -n converting clusterit.conf to ansible hosts file...
sed 's/GROUP:\(.*\)/\[\1\]/' /etc/clusterit.conf > /etc/ansible/hosts && echo done

Alternatives

References


Home | GitHub | Donate | Contact