Setting up ClusterIt

From source

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

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

On Debian systems,

apt install build-essential
apt install libx11-dev libncurses5-dev

Fetch, extract and install ClusterIt

tar xzf clusterit-2.5.tar.gz
cd clusterit-2.5/
make -j4
make install
which dsh


as user

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

Make sure you are good with SSH client setup already

vi ~/.ssh/config

Setup a few needed variables on the system,

vi ~/.bashrc

export RCMD_CMD=ssh
export RCP_CMD=scp
export CLUSTER=$HOME/clusterit.conf
export RCMD_CMD="ssh -o VisualHostKey=no"
export RCP_CMD="scp -o VisualHostKey=no"

source ~/.bashrc

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 $HOME/clusterit.conf






Display the hosts and groups,

dsh -q

Check that a generic command works on every target,

dsh -e echo ok
dsh -e "grep -v ^# /etc/resolv.conf"
dsh -e "grep -v ^# /etc/hosts"

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


Prepare the scripts,

mkdir ~/report/
cd ~/report/
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/

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


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



Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml