Wednesday 23 March 2011

Joyent smart machines and munin monitoring

ok it's time i gather what little info i have gathered on how to make this work.
Joyent uses Solaris, their own branded bastard perverted version (as if Solaris wasn't perverted enough!). it makes things difficult. very difficult.

so anyhow, to set up a munin server on joyent here are the instructions:

pkg_add munin-server

which will install the stuff.

then you must fix the munin user to something more "real" (Solaris love):

usermod -d /var/munin -s /usr/bin/bash munin
cp /home/admin/.profile /var/munin
chown munin:munin /var/munin/.profile
passwd munin (whatever, you will not actually log on w user munin)

then create a cron job to poll the nodes every 5 mins:
crontab -e munin
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /opt/local/bin/munin-cron


then as munin generates graphs and sticks them in /opt/local/www/munin/data, you must make this available via apache:


ServerName munin.yourdomain.com
DocumentRoot /opt/local/www/munin/data

AllowOverride All
Order allow,deny
Allow from all



obv you will wanna tighten this up in terms of security, like add .htpasswd permissions, symlink it or whatever.


this is pretty much it for the server.

note that any node will need to be added to the munin.conf file, and then a forced update will need to be run to reflect changes.
/opt/local/lib/munin/munin-update --force-root

(if you do that as it is running the cron job you will get a lock error/ dying)



now the nodes!

that is a little easier... just a little.

pkg_add munin-node

there again the munin user must be fixed as above, skip these steps if you are installing the node on the munin server machine.

to pre configure the plugins, this command should be run:

/opt/local/sbin/munin-node-configure --shell | sh

but beware, it doesn't always work. effectively it checks a plugin to see if it is working, and if so creates a link. the plugin itself is stored in /opt/local/lib/munin/plugins but you need to create a link in /opt/local/etc/munin/plugins to make it work.

also to get a nice easy way to restart the munin node, do:

svccfg import /opt/local/share/smf/manifest/munin-node.xm

svcadm enable munin
(or disable)

much easier than killing processes i find!

to test if everything is working ok on the client node side, do:

telnet localhost 4949
list
fetch

if you get a reasonable looking output, you're in!

2 comments:

  1. With the crontab, you can run it every 5 mins like so:

    1-59/5 * * * /opt/local/bin/munin-cron

    this avoids manually writing every 5 mins
    so you could run it every 3 mins like so
    1-59/3 * * * etc etc

    ReplyDelete