Tartalomjegyzék

Munin - Node

Telepítés

  1. Telepítsd fel a MacPorts-ot és játszásdiból indítsd el a munin MacPorts-os telepítését, hogy legyen SVN kliens:
    port install munin +server

    Le lehet állítani pár másodperc múlva

  2. Telepítsd fel az AppStore-ból az Xcode programot
  3. Indítsd el az Xcode programot és telepítsd fel a Command Line Tools-t:
    1. PreferencesDownloads
    2. Itt kattints a csomag melletti kis letöltés ikonra
  4. Nyiss egy rendszergazdai terminált (sudo -s)
  5. Felhasználó és csoport létrehozása:
    dscl . create /Groups/munin PrimaryGroupID 4949
    dscl . create /Users/munin UniqueID 4949
    dscl . create /Users/munin PrimaryGroupID 4949
    dscl . create /Users/munin UserShell /bin/false
    dscl . create /Users/munin NFSHomeDirectory /usr/local/munin/var/run/munin
    dscl . create /Users/munin RealName Munin
    dscl . create /Groups/munin GroupMembership munin
    defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add munin
  6. Takarítás:
    rm -rf /usr/src/munin
    rm -rf /usr/local/munin
    rm -rf /opt/munin
    rm -rf /etc/opt/munin/
    rm /Library/LaunchDaemons/org.munin-monitoring.munin-node.plist
  7. Környezet kialakítása:
    export LANG=C
    mkdir -p /usr/local/munin/var/run/munin
    chown munin:munin /usr/local/munin/var/run/munin
  8. Forráskód letöltése:
    mkdir -p /usr/src/munin
    cd /usr/src/munin
    svn checkout "svn://munin.projects.linpro.no/munin/trunk"
    cd /usr/src/munin/trunk
  9. Forrás átalakítása a Mac rendszerhez:
    Makefile.config
    ...
    # Default user to run the plugins as
    PLUGINUSER := munin
    ...
  10. Forráskódok forgatása:
    make install-common
    make install-node
    make install-node-plugins
    make install
  11. Pluginek bekapcsolása:
    /opt/munin/sbin/munin-node-configure --suggest --shell | sh
    
    rm /etc/opt/munin/plugins/munin_stats
  12. if_err_ plugin javítása:
    --- /opt/munin/lib/plugins/if_err_ 2018-11-05 13:27:43.000000000 +0100
    +++ /opt/munin/lib/plugins/if_err_ 2018-11-05 13:27:55.000000000 +0100
    @@ -82,4 +82,4 @@
     
     # Name  Mtu   Network       Address            Ipkts Ierrs     Ibytes    Opkts Oerrs     Obytes  Coll
     # en1   1500  <Link#5>    00:17:f2:e8:f8:3c 11548082 38116  702690133 22938005   170 16013565627     0
    -netstat -nib -I "$INTERFACE" | awk '$3 ~ /Link/ { print "down.value " $6 "\nup.value " $9 "\ncollisions.value " $11 }'
    +netstat -nib -I "$INTERFACE" | awk '$3 ~ /Link/ { print "down.value " $6 "\nup.value " $9 '
  13. dar_memusage plugin javítása:
    --- /opt/git-3th/munin-monitoring_contrib/plugins/system/dar_memusage.orig      2018-11-05 13:46:54.000000000 +0100
    +++ /opt/git-3th/munin-monitoring_contrib/plugins/system/dar_memusage   2018-11-05 13:52:21.000000000 +0100
    @@ -83,9 +83,9 @@
     for ( $i = 1;  ($i < $#top and $quit == 0); $i++ ) {
            if ( $top[$i] =~ /^PhysMem/ ) {
                    $wired = $free = $used = $top[$i];
    -               $wired =~ s/^.+?\((\d+)M wired.+$/$1/; chomp $wired; $wired = $wired * 1024 * 1024;
    -               $free =~ s/^.+?, (\d+)([M|K]) unused.+$/$1/; chomp $free; $free = $free * 1024 * 1024; if ( $2 eq "K" ) { $free = $free / 1024; }
    -               $used =~ s/^.+?: (\d+)([M|G]) used.+$/$1/; chomp $used; $used = $used * 1024 * 1024; if ( $2 eq "G" ) { $used = $used * 1024; }
    +               $wired =~ s/^.+?\((\d+)([K|M|G]) wired.+$/$1/; chomp $wired; $wired = $wired * 1024 * 1024; if ( $2 eq "K" ) { $wired = $wired / 1024; }; if ( $2 eq "G" ) { $wired = $wired * 1024; }
    +               $free =~ s/^.+?, (\d+)([K|M|G]) unused.+$/$1/; chomp $free; $free = $free * 1024 * 1024; if ( $2 eq "K" ) { $free = $free / 1024; }; if ( $2 eq "G" ) { $free = $free * 1024; }
    +               $used =~ s/^.+?: (\d+)([K|M"G]) used.+$/$1/; chomp $used; $used = $used * 1024 * 1024; if ( $2 eq "K" ) { $used = $used / 1024; }; if ( $2 eq "G" ) { $used = $used * 1024; }
                    print "wired.value " . $wired . "\n";
                    print "free.value " . $free . "\n";
                    print "used.value " . $used . "\n";
  14. Munin config Mac-esítése:
    cd /etc/opt/munin/
    munin-node.conf
    log_level 4
    log_file Sys::Syslog
    pid_file /usr/local/munin/var/run/munin/munin-node.pid
     
    #background 1
    #setsid 1
     
    user munin
    group daemon
    ...
    cd /Library/LaunchDaemons
    org.munin-monitoring.munin-node.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>EnvironmentVariables</key>
            <dict>
                    <key>LANG</key>
                    <string>en_GB.UTF-8</string>
                    <key>LC_ALL</key>
                    <string>en_GB.UTF-8</string>
            </dict>
            <key>Label</key>
            <string>org.munin-monitoring.munin-node</string>
            <key>ProgramArguments</key>
            <array>
                      <string>/opt/munin/sbin/munin-node</string>
            </array>
            <key>WorkingDirectory</key>
            <string>/usr/local/munin/var/run/munin</string>
            <key>RunAtLoad</key>
            <true/>
    </dict>
    </plist>
  15. Daemon indítása:
    launchctl load org.munin-monitoring.munin-node.plist
  16. Innentől pedig kövessük a Linux-os munin-node beállítást!

Pluginek

Smartmontools

  1. Telepítsd fel a binárist:
    port install smartmontools
  2. Munin beállítása:
    ln -s /opt/munin/lib/plugins/smart_ /etc/opt/munin/plugins/smart_disk0
    /etc/opt/munin/plugin-conf.d/munin-node
    [smart_disk0]
    user root
    env.smartpath /opt/local/sbin/smartctl
  3. Daemon újraindítása:
    cd /Library/LaunchDaemons
    launchctl unload org.munin-monitoring.munin-node.plist
    launchctl load org.munin-monitoring.munin-node.plist

USB-s lemez

Ebben az esetben a típust nekünk kell kézzel megadni a fenti linken elérhető táblázat alapján:

/etc/opt/munin/plugin-conf.d/munin-node
[smart_chieftec-usb-disk1]
env.smartargs -d sat -a

Darwin specifikus pluginek

  1. A szükséges git repo klónozása:
    mkdir -p /opt/git-3th
    git clone 'https://github.com/andras-tim/contrib.git' /opt/git-3th/munin-monitoring_contrib
  2. Pluginek bekötése, beállítása:
    cd /opt/git-3th/munin-monitoring_contrib/plugins/system
    ls dar_* |
        grep -v 'dar_uptime' | 
        while read a 
        do
            ln -s "/opt/git-3th/munin-monitoring_contrib/plugins/system/$a" /etc/opt/munin/plugins/
            "/etc/opt/munin/plugins/$a" autoconf yes
        done
  3. Pluginek tesztelése:
    /opt/munin/sbin/munin-run dar_cpuusage
    /opt/munin/sbin/munin-run dar_memusage
    /opt/munin/sbin/munin-run dar_swap
    /opt/munin/sbin/munin-run dar_vmstat
  4. munin-node újraindítása:
    launchctl unload /Library/LaunchDaemons/org.munin-monitoring.munin-node.plist
    launchctl load /Library/LaunchDaemons/org.munin-monitoring.munin-node.plist