Felhasználói eszközök

Eszközök a webhelyen


tudasbazis:mac:munin-node

Összehasonlítás

A kiválasztott és az jelenlegi változat között az alábbi különbségek fordulnak elő:

Összehasonlító nézet hivatkozása

Következő változat
Előző változat
tudasbazis:mac:munin-node [2014.12.08 19:40] – külső szerkesztés 127.0.0.1tudasbazis:mac:munin-node [2021.09.23 01:42] (aktuális) – [Smartmontools] tia
Sor 1: Sor 1:
 +====== Munin - Node ======
 +  * http://munin-monitoring.org/wiki/MuninInstallationDarwin
  
 +
 +===== Telepítés =====
 +  - Telepítsd fel a [[http://www.macports.org/install.php | MacPorts]]-ot és játszásdiból indítsd el a ''munin'' MacPorts-os telepítését, hogy legyen SVN kliens: <code bash>
 +port install munin +server
 +</code> //Le lehet állítani pár másodperc múlva//
 +  - Telepítsd fel az [[https://itunes.apple.com/en/app/xcode/id497799835?mt=12 | AppStore]]-ból az **Xcode** programot
 +  - Indítsd el az **Xcode** programot és telepítsd fel a **Command Line Tools**-t:
 +    - **Preferences** -> **Downloads**
 +    - Itt kattints a csomag melletti kis letöltés ikonra
 +  - Nyiss egy rendszergazdai terminált (''sudo -s'')
 +  - Felhasználó és csoport létrehozása: <code bash>
 +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
 +</code>
 +  - Takarítás: <code bash>
 +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
 +</code>
 +  - Környezet kialakítása: <code bash>
 +export LANG=C
 +mkdir -p /usr/local/munin/var/run/munin
 +chown munin:munin /usr/local/munin/var/run/munin
 +</code>
 +  - Forráskód letöltése: <code bash>
 +mkdir -p /usr/src/munin
 +cd /usr/src/munin
 +svn checkout "svn://munin.projects.linpro.no/munin/trunk"
 +cd /usr/src/munin/trunk
 +</code>
 +  - Forrás átalakítása a Mac rendszerhez: <code bash Makefile.config>
 +...
 +# Default user to run the plugins as
 +PLUGINUSER := munin
 +...
 +</code>
 +  - Forráskódok forgatása: <code bash>
 +make install-common
 +make install-node
 +make install-node-plugins
 +make install
 +</code>
 +  - Pluginek bekapcsolása: <code>
 +/opt/munin/sbin/munin-node-configure --suggest --shell | sh
 +
 +rm /etc/opt/munin/plugins/munin_stats
 +</code>
 +  - ''if_err_'' plugin javítása: <file diff >
 +--- /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 '
 +</file>
 +  - ''dar_memusage'' plugin javítása: <file diff >
 +--- /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";
 +</file>
 +  - Munin config Mac-esítése: <code bash>
 +cd /etc/opt/munin/
 +</code> <file bash 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
 +...
 +</file> <code bash>
 +cd /Library/LaunchDaemons
 +</code> <file bash 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>
 +</file>
 +  - Daemon indítása: <code bash>
 +launchctl load org.munin-monitoring.munin-node.plist
 +</code>
 +  - Innentől pedig kövessük a [[tudasbazis:linux:munin|Linux-os munin-node]] beállítást!
 +
 +
 +===== Pluginek =====
 +==== Smartmontools ====
 +  - Telepítsd fel a binárist: <code bash>
 +port install smartmontools
 +</code>
 +  - Munin beállítása:  <code bash>
 +ln -s /opt/munin/lib/plugins/smart_ /etc/opt/munin/plugins/smart_disk0
 +</code> <file bash /etc/opt/munin/plugin-conf.d/munin-node>
 +[smart_disk0]
 +user root
 +env.smartpath /opt/local/sbin/smartctl
 +</file>
 +  - Daemon újraindítása: <code bash>
 +cd /Library/LaunchDaemons
 +launchctl unload org.munin-monitoring.munin-node.plist
 +launchctl load org.munin-monitoring.munin-node.plist
 +</code>
 +
 +
 +=== USB-s lemez ===
 +  * https://www.smartmontools.org/wiki/Supported_USB-Devices
 +
 +Ebben az esetben a típust nekünk kell kézzel megadni a fenti linken elérhető táblázat alapján: <file bash /etc/opt/munin/plugin-conf.d/munin-node>
 +[smart_chieftec-usb-disk1]
 +env.smartargs -d sat -a
 +</file>
 +==== Darwin specifikus pluginek ====
 +  - A szükséges git repo klónozása: <file bash>
 +mkdir -p /opt/git-3th
 +git clone 'https://github.com/andras-tim/contrib.git' /opt/git-3th/munin-monitoring_contrib
 +</file>
 +  - Pluginek bekötése, beállítása: <file bash>
 +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
 +</file>
 +  - Pluginek tesztelése: <file bash>
 +/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
 +</file>
 +  - //munin-node// újraindítása: <file bash>
 +launchctl unload /Library/LaunchDaemons/org.munin-monitoring.munin-node.plist
 +launchctl load /Library/LaunchDaemons/org.munin-monitoring.munin-node.plist
 +</file>