HowTo: Installing Munin-Node on pfsense 2.0



  • Following the locked(???) thread at http://forum.pfsense.org/index.php/topic,17388.0.html , here is a complete HowTo for installing Munin-Node on a pfense 2.0 beta.

    1. Install latest munin-node
    pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.1-release/sysutils/munin-node-1.4.4.tbz
    
    1. Install Python (needed by some plug-ins)
    pkg_add -r python
    rehash
    
    1. Add some needed dirs
    mkdir /var/run/munin
    mkdir /var/munin/plugin-state
    
    
    1. Edit /usr/local/etc/munin/munin-node.conf to at-least add your allowed munin servers

    2. if you wish to use hddtemp_smartctl and smart_ plug-ins, add the following line to
      /usr/local/etc/munin/plugin-conf.d/plugins.conf

    
    [hddtemp_smartctl]
    user root
    group operator
    env.smartctl /usr/local/sbin/smartctl
    
    [smart_*]
       user root
       group operator
       env.smartpath /usr/local/sbin/smartctl
    
    
    1. Assign some plug-ins. He are the one I use. Change it according to your needs..
    
    cd /usr/local/etc/munin/plugins/
    ln -s /usr/local/share/munin/plugins/smart_ smart_ad0
    ln -s /usr/local/share/munin/plugins/cpu
    ln -s /usr/local/share/munin/plugins/df
    ln -s /usr/local/share/munin/plugins/df_inode
    ln -s /usr/local/share/munin/plugins/iostat
    ln -s /usr/local/share/munin/plugins/load
    ln -s /usr/local/share/munin/plugins/memory
    ln -s /usr/local/share/munin/plugins/netstat
    ln -s /usr/local/share/munin/plugins/open_files
    ln -s /usr/local/share/munin/plugins/processes
    ln -s /usr/local/share/munin/plugins/vmstat
    ln -s /usr/local/share/munin/plugins/swap
    ln -s /usr/local/share/munin/plugins/hddtemp_smartctl
    
    ln -s /usr/local/share/munin/plugins/if_ if_vr0
    ln -s /usr/local/share/munin/plugins/if_ if_rl0
    ln -s /usr/local/share/munin/plugins/if_ if_re0
    
    
    1. Unfortunately when pfsense reboots or after some update, the needed /var/run/munin directory gets deleted, so add the following line in /usr/local/etc/rc.d/munin-node, to re-create this directory if it is missing.
      We also need a second line to let /et/rc.conf be regenerated after each reboot. So after "rcvar=set_rcvar" add :
    
    [ -d /var/run/munin ] || mkdir /var/run/munin
    [ -d /etc/rc.conf ] || echo 'munin_node_enable="YES"' >> /etc/rc.conf
    
    

    8.) let munin-node correctly started after each reboot:

    mv /usr/local/etc/rc.d/munin-node /usr/local/etc/rc.d/munin-node.sh
    

    9.) finally , start munin:

    /usr/local/etc/rc.d/munin-node.sh restart
    
    

    (Thank to jimp  for helping to solve the boot issue)



  • I did not found the right place to put this final line in order to start munin-node at each reboot, so you will have to start munin manually every time you reboot. (BTW Any help to fix this, would be appreciated…)

    Missing execute bit? as it should start any shell script in that folder on boot.


  • Rebel Alliance Developer Netgate

    pfSense only looks for *.sh in the /usr/local/etc/rc.d/ directory. If you mv munin-node munin-node.sh it will auto start.



  • Jimp and Perry, Thank you for your help. It helped me to fix the boot issue. I've modified the initial HowTo to include your changes.

    A question:
    I'm used to Linux, but not really to freeBSD habbits. But even after having read the FreeBSD docs, i expected to find init scripts in /etc/rc.d/ (not in /usr/local/etc/rc.d/). I could not even imagined that init scripts should be suffixed by .sh (notice that munin installs an initscript without .sh at end) . Munin also expects to have defaults parameters sets in /etc/rc.conf, but this file does not exist in pfsense, and worst, if you create the file, it get deleted on each reboots….
    Well really confusing…  :P
    Being a professionnal php developper, also trained with linux scripts (at least those documented…) and willing to give back to the OpenSource Community, I would be happy to help to build useful pfsense add-ons.

    BUt I did not succeed to find any serious documentation, any detailed "HowTo write a package" ReadMe, or any page listing "What are the main differences between pfense and  a normal FreeBSD installation"... Anything making writing a plug-in a bit faster than reverse-engeneering pFense  ;D

    Is it me or did I missed some hidden doc that only Jedi Masters have access to?  ???  ::)


  • Rebel Alliance Developer Netgate

    Most of the differences aren't really documented. In FreeBSD you don't need to end your scripts in *.sh, but in pfSense you do. It's just one of the many subtle differences.


Locked