Friday, April 08, 2011

Installing Monit in Solaris 10

Here are the instructions to get Monit installed in Solaris 10. Note that your system might need several packages that you might not have. As you might be aware you can get most of them from Sun Free Ware.

At least version 5/09 (which I was forced to use as the latest supported by the server I am hosting: Advent Geneva) comes with gcc out of the box so be sure you add to your path the location for it "export PATH=$PATH:/usr/sfw/bin"

I had all kind of issues when I tried to use gcc 4.5.1 especially the -m64 flag not working. Solaris 10 5/09 comes with gcc 3.4.3 and it after all does compile monit without any problems.

Pay special attention to your specific environment. In my case this was an AMD 64 bits machine and I had to set LD_LIBRARY_PATH to get 64 bits library:
export LD_LIBRARY_PATH=/usr/sfw/lib/64:$LD_LIBRARY_PATH

While the above is good for installation purposes it is not enough to run monit later on. So make the path mandatory for the whole system library loader:
crle -64 -u -l /usr/sfw/lib/64

Considering you have read the above then you should be OK following this steps:
  1. Copy sources to the server
    $ scp /Users/nestor/Downloads/monit-5.2.5.tar.gz admin@solaris.sample.com:/export/home/admin
    
  2. Install the binary in the server
    $ cd /export/home/admin
    $ digest -a sha256 monit-5.2.5.tar.gz #3c2496e9f653ff8a46b75b61126a86cb3861ad35e4eeb7379d64a0fc55c1fd8d
    $ gzip -cd monit-5.2.5.tar.gz | tar xfv -
    $ cd monit-5.2.5
    ./configure \
          --with-ssl-incl-dir=/usr/sfw/include \
          --with-ssl-lib-dir=/usr/sfw/lib/64 \
          CFLAGS='-m64 -mtune=opteron' \
          LDFLAGS='-m64 -mtune=opteron'
    $ gmake
    $ gmake install
    
  3. Configure monit
    $ mkdir /usr/local/etc #in case it does not exist
    $ vi /usr/local/etc/monitrc
    $ chmod 700 /usr/local/etc/monitrc
    $ ps -ef|grep monit|grep -v grep|awk '{print $2}'|xargs kill
    $ vi /etc/inittab
    m:2345:respawn:/usr/local/bin/monit -Ic /usr/local/etc/monitrc
    mon:2345:wait:/usr/local/bin/monit -Ic /usr/local/etc/monitrc start all
    moff:06:wait:/usr/local/bin/monit -Ic /usr/local/etc/monitrc stop all
    $ /etc/telinit q
    
  4. Now monit should be running and if it is killed it will be brought back. After restarting the server it should start automatically as well. You can check its status with:
    /usr/local/bin/monit status
    

No comments:

Followers