Compare commits

...

140 Commits

Author SHA1 Message Date
Steve Schnepp 3b6ef20dc1
Merge pull request #17 from daald/improve-df
Improve df
2023-12-14 14:33:37 +01:00
Daniel Alder c2b8d7315d Fix previous change. The key for config and values was the mountpoint
I accidently changed this to dev. This also works but breaks existing history
2023-12-14 13:26:47 +01:00
Daniel Alder f55b83fdbd Improve df
Before, there were 1+n calls of df where n is the number of output values. I introduced some script magic to use the values from the
first call. Motivation was, there was a very complex sed call which failed to process some of my df output lines. The new code is much
safer.

Actually, the original problem obviously was that the sed regex didn't cover capital letters which I had in my mountpoints.
2023-12-13 14:58:34 +01:00
Lars Kruse a2f1745477 plugin ntpdate: tolerate multiple NTP servers (e.g. in a pool)
Previously multiple "server" lines were consumed, but the output of the
awk filter lacked the line ending.  Thus the last numeric value of the
previous "server" line was concatenated with the first numeric value of
the following "server" line.  Thus multiple dots occurred in a single
numeric value and parsing just failed.

Thanks, glyndon!

Closes: #16
2022-05-04 14:55:41 +02:00
Kim B. Heino 74927fc6e7
ntpdate: fix typo on graph title 2021-08-22 19:37:40 +03:00
Lars Kruse 631beb931f Release 2.1.2 2021-07-14 13:40:35 +02:00
Lars Kruse d1e4d3ef7c docs: prepare changelog for release 2021-07-14 13:40:01 +02:00
Lars Kruse 32d4362888 fix: do not interprete leading hyphens in commands as "echo" arguments
Previously an input token with a leading hyphen (e.g. "-n") could be
inadvertently interpreted by "echo" instead of being taken literally.

No further damage was possible, but this would have been unexpected.
2021-07-14 13:40:01 +02:00
Lars Kruse 1f147fcb1c fix: read more than one line from configuration file
Previously only the first line of the configuration file (without a
comment) was applied during build.
Thus `DF_IGNORE_FILESYSTEM_REGEX` was previously ignored.

Reported and fixed by Tobias Meyer, thanks!
2021-07-14 13:39:45 +02:00
Lars Kruse 954395aece doc: add more details to OpenWrt release update checklist 2020-10-19 20:09:49 +02:00
Kim B. Heino f37e97fa9c
Update RELEASE_CHECKLIST.md 2020-10-19 20:15:53 +03:00
Kim B. Heino fa0a661bb2
Update RELEASE_CHECKLIST.md 2020-10-19 20:08:06 +03:00
Kim B. Heino c9f4699c6a Release 2.1.1 2020-10-19 15:34:52 +03:00
Lars Kruse f8111b2d10 Release documentation: mention upload to github 2020-10-18 22:13:16 +02:00
Kim B. Heino c0625af54c plugins: don't draw LINE2 where it's not needed 2020-10-18 20:27:05 +03:00
Kim B. Heino b2ca6a4b8a irqstats: rework previous commit to make shellcheck happy
Tested on dash/bash/busybox.
2020-10-09 15:40:46 +03:00
Kim B. Heino 4c53449fa3 irqstats: fix iqrstats on Raspberry Pi (partial revert for 5190244c)
Raspberry Pi has line "FIQ:              usb_fiq" in /proc/interrupts.
"VALUE=$((VALUE + VAL))" results "Illegal number" in dash (Raspberry Pi)
"VALUE=$((VALUE + $VAL))" works in dash, bash and busybox (OpenWrt).
2020-10-09 15:40:46 +03:00
Kim B. Heino 0ae0f9cdcb
Merge pull request #12 from kimheino/master
muninlite: do not hardcode acceptable network interface names
2020-10-09 10:17:59 +03:00
Kim B. Heino eef090a1ae muninlite: do not hardcode acceptable network interface names
Interface can be called f.ex. "enp0s31f6" in modern system with
predictable network names enabled. Allow any name instead of
list of hardcoded names.
2020-10-09 10:10:05 +03:00
Kim B. Heino 111bd0ebb3 ntpdate: add "graph_category time" to config 2020-10-08 16:14:17 +02:00
Lars Kruse 62230e900e Release 2.1.0 2020-10-08 14:23:12 +02:00
Lars Kruse 0236ec69e2 Update changelog for previous release (v2.0.1) 2020-10-08 14:23:12 +02:00
Lars Kruse b7ecc5699b Update documentation 2020-10-08 14:23:11 +02:00
Lars Kruse c4044f749b Document the new configuration file /etc/munin/muninlite.conf
Also mention Kim B. Heino as an author due to significant contributions.
2020-10-08 14:22:47 +02:00
Kim B. Heino 389c22a0de
muninlite: add support for minimal runtime configuration file (#10)
It's executed as shell script. For example, you can remove unwanted
plugin by adding following line to /etc/munin/muninlite.conf:

PLUGINS=${PLUGINS/ swap/}

It could also be used to add more plugins (with runtime on/off detection!),
although pluginsdir is the preferred way to do it.

It can also be used to override other hardcoded settings, like NTP_PEER or
DF_IGNORE_FILESYSTEM_REGEX.
2020-10-08 14:02:37 +02:00
Lars Kruse 00cfedfd92
Merge pull request #7 from kimheino/wireless
wireless: add new plugin to get info about OpenWRT's APs
2020-10-08 13:28:46 +02:00
Kim B. Heino 1f6d07e52a wireless: cleanup interfaces-variable usage 2020-10-08 07:31:36 +03:00
Kim B. Heino 5206847aa1
df: fix "config" vs "fetch" mismatches (#9)
Two fixes:
1) Use same regexp to skip df partitions in "config" and "fetch".
2) Use same function (was two different sed) to cleanup partition name.

This fixes bug #5.
2020-10-07 19:11:11 +02:00
Kim B. Heino ebd0cca326
muninlite: do not crash if empty line is received (#8)
Trivial fix for the following error:

  root@naru:~# echo "" | ./muninlite
  ./muninlite: line 696: do_: not found
  root@naru:~#
2020-10-07 19:08:49 +02:00
Kim B. Heino e6f5722a04 plugins/if: include "Interface" to graph_title for better grouping
Nowadays network interfaces have names like docker0, team0, ip_vti0, eno,
wlp61s0 and so on. Including word "Interface" in beginning of
graph_title groups these graphs together in web interface, not randomly
before/after other network-graphs (ipconntrack, firewall, ...).

See commit 70711831c44 in munin repository for similar change.
2020-10-07 18:41:47 +02:00
Kim B. Heino d889349332 wireless: fix shellcheck warnings
Shellcheck warned about "dash doesn't support x". This plugin runs
only on OpenWRT and there is no dash...
2020-10-07 13:50:48 +03:00
Kim B. Heino 4bc2b62610 wireless: add new plugin to get info about OpenWRT's APs
Following info is returned, per AP:
- Signal strength (dBm)
- Number of associated clients
2020-10-07 13:20:00 +03:00
Lars Kruse 8046268893 if_: handle "Unknown" emitted by ethtool
Previously error messages were emitted due to this non-numeric value.

Closes: #3
2020-08-22 20:28:09 +02:00
Lars Kruse 710334b615 Remove handling of "lrrd"
The "lrrd" service seems to be some historical cruft, that is no longer
in use.  It is still an alias for the "munin" service (port 4949) in
/etc/services, but probably not in use anymore.
2020-07-19 15:44:50 +02:00
Lars Kruse 670a871835 Use /usr/local/bin/muninlite consistently in examples
Packagers (e.g. for OpenWrt) usually pick a different path (e.g.
/usr/bin/muninlite or /usr/sbin/muninlite), but a native installation
from source should point to /usr/local/... by default.

The change affects only examples, thus it should do no harm.
2020-07-19 15:41:53 +02:00
Lars Kruse 9d596643cc Release 2.0.1 2020-04-12 17:50:27 +02:00
Lars Kruse a0c555c2bd Makefile: create gzipped release archive
Previously it just looked like a tar.gz file, but it was a plain tar
archive.
2020-04-12 17:49:36 +02:00
Lars Kruse 1b43f16454 Network interface names: tolerate more than one hyphen
Previously the handling of network interface names allowed something
like "foo-bar", but failed over "foo-bar-baz".

Thanks to Kai-Uwe Eckhardt.
2020-04-12 15:53:48 +02:00
B. van Berkum aad298f892 Fixed category for uptime graph. 2020-02-12 04:38:07 +01:00
Lars Kruse 884fea3ed1 Describe the purpose of the muninlite.conf file 2020-02-12 03:25:29 +01:00
Lars Kruse bf738ea913 Makefile: sign the release archive instead of the checksum
Additionally the gnupg key identified by the commit's author's email
address is used by default.  It can be overridden by a make variable.
2020-02-12 03:23:12 +01:00
Lars Kruse 216c6ebd04 Release 2.0.0 2020-02-12 03:01:27 +01:00
Lars Kruse 2ab81cd929 Change formatting of changelog to markdown
The style is based on https://keepachangelog.com/en/1.0.0/.
2020-02-12 02:45:12 +01:00
Lars Kruse 4e857e0a96 README: improve wording 2020-02-11 06:32:00 +01:00
Lars Kruse 4b484f6f99 Tolerate plugin filenames containing special characters
We may only allow characters allowed in shell function names.
2020-02-09 02:21:17 +01:00
Lars Kruse b039f7c1c8 Fix remaining spelling errors 2020-02-09 02:10:41 +01:00
Lars Kruse 6d05b016d3 Makefile: really ignore excluded directory names 2020-02-09 02:08:24 +01:00
Lars Kruse 53bc47cc13 README: improve formatting 2020-02-09 02:00:39 +01:00
Lars Kruse f6adc90820 Add documentation for the release process 2020-02-09 01:58:22 +01:00
Lars Kruse 648f3c15d4 README: rephrase overview 2020-02-09 00:57:57 +01:00
Lars Kruse c63baf0461 README: restructure sections 2020-02-09 00:54:36 +01:00
Lars Kruse 0b06f673ab README: move license and copyright to the bottom 2020-02-09 00:50:47 +01:00
Lars Kruse 069a3ecb4d Makefile: replace "tgz" target with "dist"
The new target also creates a signed checksum of the archive.
2020-02-09 00:48:34 +01:00
Lars Kruse 2503aa737b README: describe scope of the project and unwanted features 2020-02-09 00:48:34 +01:00
Lars Kruse 7eebaa7f62 README: remove list of integrated plugins and runtime requirements 2020-02-09 00:48:34 +01:00
Lars Kruse 8e433d9a38 README: clarify title for munin configuration section 2020-02-09 00:48:34 +01:00
Lars Kruse a85fc3cb82 README: mention external plugins 2020-02-09 00:48:34 +01:00
Lars Kruse 829f230b9b CHange default plugin directory to /etc/munin/plugins
This path is also used by the official `munin-node` implementation.
2020-02-09 00:45:59 +01:00
Lars Kruse fe4c587c27 Remove outdated documentation 2020-02-09 00:45:59 +01:00
Lars Kruse a4bb625812 Makefile: skip comments with leading whitespace 2020-02-08 23:41:48 +01:00
Lars Kruse e3103bdb6e Plugin df: ignore read-only and virtual filesystem types
The set of filesystems is based on the list of excluded filesystems in
munin's "df" plugin for Linux.
2020-02-08 23:39:44 +01:00
Lars Kruse 44d1c8dc3a Plugin if_: do not expose errors from ethtool
ethtool prints the error message "Cannot get device settings: No such
device" for VLAN devices.  This error message should not be exposed via
the munin protocol.
2020-02-08 23:39:44 +01:00
Lars Kruse 9cca1e479a Change encoding of main script to UTF-8 2020-02-08 23:39:44 +01:00
Lars Kruse a0d4d74f8d hostname: fall back to /proc/sys/kernel/hostname (linux) if "hostname" is missing
This provides a usable alternative on OpenWrt.
2020-02-08 23:39:44 +01:00
Lars Kruse 0662cfc7e8 Enable "exit-on-error" and "error-on-unset" for shell execution 2020-02-08 23:39:44 +01:00
Lars Kruse 6b09d74c9a Remove tabs from plugins 2020-02-08 23:39:44 +01:00
Lars Kruse b5d8f7931b Plugin if_ and if_err_: use explicit variable for interface name 2020-02-08 23:39:44 +01:00
Lars Kruse 60b16f4121 Plugin netstat: adjust filter to newer netstat version
Newer versions of netstat use "active connection openings" instead of
"active connections".
2020-02-08 23:39:44 +01:00
Lars Kruse e439fd79a1 Use "read" without escaping 2020-02-08 23:39:44 +01:00
Lars Kruse 974b07a1af Remove unnecessary "cat" operations 2020-02-08 23:39:44 +01:00
Lars Kruse 0600bbf113 Simplify grep-based conditionals
The "-q" argument avoids the requirement for output redirections.
2020-02-08 23:39:44 +01:00
Lars Kruse 94a695860d Simplify checks for empty or non-empty strings 2020-02-08 23:39:44 +01:00
Lars Kruse 5190244c92 Simplify arithemtic shell expressions
Variable names within arithmetic expressions are evaluated even without
the '$' prefix.
2020-02-08 23:39:44 +01:00
Lars Kruse dc242d3631 Plugin cpu: fix handling of more than ten CPUs
Previously only CPU entries with a single digit (0..9) were parsed.
The improved regular expression simplifies the calculation of the CPU
count, since the combined entry ("cpu" without digits) is skipped.
2020-02-08 23:39:44 +01:00
Lars Kruse 14251d6791 Add missing quoting 2020-02-08 23:39:44 +01:00
Lars Kruse c2108276eb Improve parsing of commands and plugin names
Previously special characters for regular expressions (e.g. ".") could
work around the name check (without being able to cause harm).
2020-02-08 23:39:44 +01:00
Lars Kruse 281578664c Command "version": fix spelling of "muninlite" 2020-02-08 23:39:44 +01:00
Lars Kruse b1230609dc Command "list": sort plugins by name and remove surrounding whitespace
Previously the plugin names were not sorted and a leading space was
emitted.
2020-02-08 23:39:44 +01:00
Lars Kruse 02b2eb861e Plugin directory: use "find" instead of "ls"
Relying on shell globbing is discouraged.
2020-02-08 23:39:44 +01:00
Lars Kruse 5de3df252e Plugin swap: fix evaluation of swap usage
The variable name was misspelled.
2020-02-08 23:39:44 +01:00
Lars Kruse d1da0df1b2 Plugin memory: fix evaluation of "inactive laundry"
The variable name was misspelled.
2020-02-08 23:39:44 +01:00
Lars Kruse f4518e5375 Change name of executable from "munin-node" to "muninlite"
Previously MuninLite tried to create a drop-in-replacement for
munin-node by using the same name.  But MuninLite behaves differently
and may even be used in parallel to a regular munin-node setup on a host,
thus it should use a distinct name.
2020-02-08 23:39:44 +01:00
Lars Kruse c547314f3d Makefile: add "install" target 2020-02-08 23:39:44 +01:00
Lars Kruse 33bd18f7f7 README: change to UTF8 2020-02-08 23:39:44 +01:00
Lars Kruse 0cf51803a3 Makefile: configurable set of plugins
The Makefile variable "PLUGINS" may be specified on the command line in
order to pick specific plugins:

  make PLUGINS="cpu load uptime"
2020-02-08 23:39:44 +01:00
Lars Kruse 936ac8199c Makefile: use proper indentation for assembling command 2020-02-08 23:39:42 +01:00
Lars Kruse 160a767791 Makefile: simplify script assembling 2020-02-08 23:39:15 +01:00
Lars Kruse 92eb719a8b Makefile: reduce dependencies to the set of configured plugins 2020-02-08 23:38:15 +01:00
Lars Kruse 0667b94d0f Makefile: add dependency for template input file 2020-02-08 23:38:15 +01:00
Lars Kruse 08e989b780 examples: unify whitespace 2020-02-08 23:38:15 +01:00
Lars Kruse 4e324b45a6 CI: add travis test description 2020-02-08 23:38:15 +01:00
Lars Kruse 6e921753d6 Makefile: add trivial test
For now only the basic functionality of the script is tested.
2020-02-08 23:38:15 +01:00
Lars Kruse c7a121f8fc Makefile: add spelling check 2020-02-08 23:38:15 +01:00
Lars Kruse 806dc07f89 README: reduce less relevant details 2020-02-08 23:37:55 +01:00
Lars Kruse 490da2c8a3 README: document the installation as an executable without TCP 2020-02-08 23:37:55 +01:00
Lars Kruse 0c4e577e9a Makefile: add 'lint' target
For now most plugins contain issues according to 'shellcheck'.
2020-02-08 23:37:52 +01:00
Lars Kruse 5f1d1b03b5 Transfer remaining subversion details to git 2020-02-06 07:29:11 +01:00
Lars Kruse a3fde3c704 Makefile: use "git archive" for generating release file 2020-02-06 07:29:11 +01:00
Lars Kruse 9748ebdcfb Makefile: add "help" target 2020-02-06 07:29:11 +01:00
Lars Kruse 631e86156e Fix spelling issues
reported by "codespell"
2020-02-06 07:29:11 +01:00
Lars Kruse b0e991d4d4 whitespace cleanup 2020-02-06 07:29:11 +01:00
Lars Kruse 215abe08ae Makefile: mark non-file targets as "PHONY" 2020-02-06 07:29:11 +01:00
Lars Kruse e4ef4eccea Makefile: do not create empty target file in case of errors 2020-02-06 07:29:11 +01:00
Lars Kruse 6dcd179e56 Makefile: use make variables for filenames 2019-07-23 05:19:42 +02:00
Lars Kruse 519a1c2ef9 Makefile: cleanup whitespace and comments 2019-07-23 04:42:56 +02:00
Lars Kruse 38586372d2 Format README as markdown 2019-07-19 06:25:57 +02:00
Lars Kruse ab2347f2ac swap: return "U" in case of missing swap
The swap plugin should return "U" if no value was found.

Source: patch "310-fix-swap-output" from Opennet Firmware
2019-07-19 06:10:34 +02:00
Lars Kruse eb5f13e9bd Makefile: fix assembly of plugins
Source: package "300-fix-munin-node-assembly" from Opennet Firmware
2019-07-19 06:08:23 +02:00
Lars Kruse 56bf90a6f8 muninlite: fix irqstats plugin
The config() function of irqstats seems to contain a superfluous
semicolon, causing munin to choke on this plugin. This simple patch
fixes exactly that.

Source: patch "240-fix-irqstats" from OpenWrt
Author: Jorik Jonker
2019-07-19 06:03:51 +02:00
Lars Kruse b2366408f6 Fix parsing the available network interface names
Source: patch "230-fix-available-interface-parsing" from OpenWrt
Author: Martin Blumenstingl
2019-07-19 06:02:42 +02:00
Lars Kruse 7b4f376daf Fix fetching data for interfaces with a dash in the name
munin-node passes the original interface name (as extracted from
/proc/net/dev) to if_* and if_err_*. Thus replacing dash with underscore
results in interfaces not being found anymore.

Source: patch "220-modify-ifname-parser" from OpenWrt
Author: Martin Blumenstingl
2019-07-19 06:01:08 +02:00
Lars Kruse f906a5f4da Fix error messages on server regarding recognition bridge interfaces
OpenWrt uses the naming convention "br-*" for bridge network interfaces.

Source: patch "210-add-bridge-devs" from OpenWrt
Author: cshore
2019-07-19 05:59:49 +02:00
Lars Kruse 2073b97a6c Fix error messages on server regarding recognition of tapX devices
Source: patch "200-add-tap-dev" from OpenWrt
Author: cshore
2019-07-19 05:56:35 +02:00
Lars Kruse 44628e78cc uptime should report days, not seconds
Source: https://sourceforge.net/p/muninlite/patches/8/
Author: Craig Gallek

See patch "110-fix-uptime-days" in OpenWrt.
2019-07-19 05:54:53 +02:00
Lars Kruse 3e0ecfe678 Fix error messages on server due to missing ethtool on node
Source: patch "100-fix-no-ethtool" from OpenWrt
Author: cshore
2019-07-19 05:49:51 +02:00
Lars Kruse d9b1b1ad3f Enable the df plugin again and fix parsing disk usage
Source: patch "001-fix_disks" from OpenWrt
Author: Martin Blumenstingl
2019-07-19 05:45:48 +02:00
runesk 22468a04a1 Ignore .svn in release
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@36 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-27 10:11:08 +00:00
runesk 306445b574 git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@35 35caa317-6b62-4e8a-81c0-b04f0c356266 2011-01-27 10:07:07 +00:00
runesk b241c4d9fa Release VERSION 1.0.4
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@34 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-27 10:06:30 +00:00
runesk 407be39cb4 Forget the previous change
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@33 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-27 10:03:27 +00:00
runesk 53ac3745d6 Added ipsec to monitored interfaces - Thanks to Tamas TEVESZ
Added VLANs to monitored interfaces - Patch from Christophe GUILLOUX (#3162054)


git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@32 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-27 10:02:06 +00:00
runesk 0e1e1b6bbc Arrays is a bashismn
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@31 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-27 09:58:58 +00:00
runesk 7e464ae867 $HOSTNAME seems to be a bashism
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@30 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-27 09:56:17 +00:00
runesk fc1c90b1a2 Keith Taylor submitted a patch to support older kernels ID: 2716990
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@29 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-14 20:52:13 +00:00
runesk d31563a156 Forgot these
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@28 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-14 20:39:50 +00:00
runesk b3cafac597 New Release: Added patch from Jozsef Marton
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@27 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-14 20:28:51 +00:00
runesk 9a8bc35de4 Added plugindir_ as a default plugin
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@26 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-14 20:27:09 +00:00
runesk 380a399a81 Build need this empty file
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@25 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-14 20:25:53 +00:00
runesk 42963323c4 Accepted patch from Jozsef Marton. Plugins might now be added
dynamicly using the plugindir_



git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@24 35caa317-6b62-4e8a-81c0-b04f0c356266
2011-01-14 20:24:16 +00:00
runesk f397470d73 git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@23 35caa317-6b62-4e8a-81c0-b04f0c356266 2009-03-17 12:42:38 +00:00
runesk 8eeb617f22 New release
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@22 35caa317-6b62-4e8a-81c0-b04f0c356266
2009-03-17 12:38:09 +00:00
runesk 3b23188011 Added support for if_ and if_err_ on ppp devices
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@21 35caa317-6b62-4e8a-81c0-b04f0c356266
2009-03-17 12:36:48 +00:00
runesk 78f7079596 Closes 2080844
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@20 35caa317-6b62-4e8a-81c0-b04f0c356266
2009-03-17 12:35:31 +00:00
runesk a18de9ac24 Closes 2078765
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@19 35caa317-6b62-4e8a-81c0-b04f0c356266
2009-03-17 12:17:51 +00:00
runesk 18304c2a4d Wrong hostname for NTP pool
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@18 35caa317-6b62-4e8a-81c0-b04f0c356266
2007-11-30 11:24:46 +00:00
runesk 61be8d19e2 BUG: Line break
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@17 35caa317-6b62-4e8a-81c0-b04f0c356266
2007-11-30 11:24:07 +00:00
runesk 6eb9e91c1f 1.0.1
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@16 35caa317-6b62-4e8a-81c0-b04f0c356266
2007-11-30 10:43:07 +00:00
runesk 84fd994485 Nicer pipe (hint from janl)
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@15 35caa317-6b62-4e8a-81c0-b04f0c356266
2007-09-25 12:53:05 +00:00
runesk 3c061b6e67 1.0.0-release
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@14 35caa317-6b62-4e8a-81c0-b04f0c356266
2007-06-20 16:52:57 +00:00
runesk 4e38cb63be FOrgot this
git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@13 35caa317-6b62-4e8a-81c0-b04f0c356266
2007-06-18 08:03:20 +00:00
38 changed files with 814 additions and 562 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
muninlite
releases/

View File

@ -1,2 +0,0 @@
munin-node
releases/

23
.travis.yml Normal file
View File

@ -0,0 +1,23 @@
---
addons:
apt:
packages:
- codespell
- make
- perl
- shellcheck
notifications:
email: false
irc:
on_success: change
on_failure: always
channels:
- "irc.oftc.net#munin"
template:
- "%{repository} (%{branch} - %{commit} : %{author}): %{message}"
- "Build details: %{build_url}"
script:
- make lint
- make spelling
- make test

10
CREDITS
View File

@ -14,11 +14,11 @@ Jimmy Olsen <jimmyo@linpro.no>
- memory plugin in Munin
- processes plugin in Munin
- interupts plugin in Munin
Mike Fedyk <mfedyk@mikefedyk.com>
- memory plugin in Munin
- context switch graphing in interupts plugin in Munin
Nicolas Salles <mosan@users.sourceforge.net>
- uptime plugin in Munin
@ -32,6 +32,8 @@ Kai Ove Gran <kaiove@humla.no>
- Help regarding available features in busybox in floppyfw
- Build script (muninlite.mk) for floppyfw devkit
(http://pong.no/floppyfw/muninlite/)
- post ini script (post-muninlite.ini) for floppyfw
- post ini script (post-muninlite.ini) for floppyfw
(http://pong.no/floppyfw/muninlite/)
Jozsef Marton
- Patch to enable plugin directory

View File

@ -1,34 +0,0 @@
muninlite
Changelog:
0.9.14 - 0.9.15
Date:
- Some documentations added
0.9.13 - 0.9.14
Date: 2007-06-10
- Plugins as separate files
- Makefile (make smaller munin-node for systems with less plugins)
0.9.12 - 0.9.13
Date: 2007-06-10
- Fixed spikes (hopefully) in if_ and if_err_
- Fixed missing output due to parsed $ in variables in multiple plugins
0 - 0.9.12
Date: 2007-06-08
- First Changelog
- Initial "release"

116
Changelog.md Normal file
View File

@ -0,0 +1,116 @@
# [2.1.2] - 2021-07-14
* handle tokens with leading hyphens carefully
* do not ignore `DF_IGNORE_FILESYSTEM_REGEX` during build
# [2.1.1] - 2020-10-19
* muninlite: do not hardcode accepted network interface names
* irqstats: fix irqstats on Raspberry Pi
* ntpdate: add missing "graph_category time" to config section
* processes, ntpdate: draw graphs with normal 1px lines
# [2.1.0] - 2020-10-08
* if_: handle "Unknown" emitted by ethtool
* if: include "Interface" to graph_title for better grouping
* muninlite: do not crash if empty line is received
* df: fix "config" vs "fetch" mismatches
* new plugin "wireless" (based on `iwinfo`, suitable for OpenWrt)
* add support for optional configuration file `/etc/munin/muninlite.conf`
# [2.0.1] - 2020-04-12
* network interface names: tolerate more than one hyphen
* fix category for uptime graph
# [2.0.0] - 2020-02-12
* change plugin path to `/etc/munin/plugins`
(previously: `munin-node-plugin.d` next to the muninlite script)
* change name of standalone script from "munin-node" to "muninlite"
* various improvements of most plugins
* add checks for code style and spelling
* rework Makefile
* import patches from [Opennet Initiative](https://opennet-initiative.de/)
* import patches from [OpenWrt](https://openwrt.org/)
* move project hosting to the "munin" organization in github
(https://github.com/munin-monitoring/muninlite)
# [1.0.4] - 2011-01-27
* `munin-node.conf`: Forget the previous change
* `munin-node.in`: Added ipsec to monitored interfaces - Thanks to Tamas TEVESZ
* Added VLANs to monitored interfaces - Patch from Christophe GUILLOUX
(Closes: #3162054)
* `plugins/ntpdate`: Arrays is a bashismn
* `munin-node.conf`: $HOSTNAME seems to be a bashism
* `plugins/cpu`: Keith Taylor submitted a patch to support older kernels ID
(Closes: #2716990)
# [1.0.3] - 2011-01-14
* Added patch from Jozsef Marton
* Makefile: Added `plugindir_` as a default plugin
* `plugins/plugindir_`: Build need this empty file
* `munin-node.in`: Accepted patch from Jozsef Marton. Plugins might now be
added dynamically using the `plugindir_`
# [1.0.2] - 2009-03-17
* `munin-node.in`: Added support for `if_` and `if_err_` on ppp devices
* `plugins/df`: Closes 2080844
* `plugins/if_`: Closes 2078765
* `munin-node.conf`: Wrong hostname for NTP pool
* `plugins/netstat`: BUG: Line break
# [1.0.1] - 2007-11-30
* munin-node.conf, munin-node.in, plugins/ntpdate
* plugins/df: Nicer pipe (hint from janl)
# [1.0.0] - 2007-06-20
* `plugins/if_`: SF#1736919
* Changed type to DERIVE and added min values to 0
* Added check for ethtool to check if max value could be calculated
* Makefile: munin-node depends on plugins
* `doc/floppyfw.txt`: More fixes to the floppyfw howto
* `examples/post-muninlite.ini`: Added post-boot script for floppyfw
* `doc/floppyfw.txt`: Rewrote how to compile floppyfw with muninlite support
* `doc/floppyfw.txt`: Howto for floppyfw
* `doc/Working-distributions.txt`: Some Endian Firewall documentation
* Makefile: Fix
* import into a subversion repository
# [0.9.15] - 2007-06-10
* Some documentations added
# [0.9.14] - 2007-06-10
* Plugins as separate files
* Makefile (make smaller munin-node for systems with less plugins)
# [0.9.13] - 2007-06-10
* Fixed spikes (hopefully) in `if_` and `if_err_`
* Fixed missing output due to parsed $ in variables in multiple plugins
# [0.9.12] - 2007-06-08
* First Changelog
* Initial "release"

122
Makefile
View File

@ -1,46 +1,94 @@
PLUGINS ?= df cpu if_ if_err_ load memory processes swap netstat uptime interrupts irqstats ntpdate wireless plugindir_
CONFIGURATION_FILE ?= muninlite.conf
INPUT_FILE ?= muninlite.in
TARGET_FILE ?= muninlite
PLUGIN_DIRECTORY ?= plugins
PLUGIN_FILES = $(patsubst %,$(PLUGIN_DIRECTORY)/%,$(PLUGINS))
VERSION ?= $(shell cat VERSION)
DIST_DIR = releases
DESTDIR ?= /usr/local/bin
TGZ_FILE ?= $(DIST_DIR)/muninlite-$(VERSION).tar.gz
TGZ_FILE_SIGNATURE ?= $(TGZ_FILE).asc
SIGN_KEY_NAME ?= $(shell git show --no-patch --format=%ae)
PLUGINS=df cpu if_ if_err_ load memory processes swap netstat uptime interrupts irqstats
#PLUGINS=cpu if_ if_err_ load memory processes netstat uptime interrupts irqstats
$(TARGET_FILE): $(INPUT_FILE) $(PLUGIN_FILES) $(CONFIGURATION_FILE)
@echo "Making muninlite version $$VERSION"
@for plugin_filename in $(PLUGIN_FILES); do \
echo "Adding plugin $$(basename "$$plugin_filename")"; done
@export VERSION="$(VERSION)"; \
export "PLUGINS=$(PLUGINS)"; \
export CONF="$$(grep -v '^#' "$(CONFIGURATION_FILE)")"; \
export PLSTR="$$(grep -vh '^[ \t]*#' $(PLUGIN_FILES))"; \
perl -p -e '\
s/\@\@VERSION\@\@/$$ENV{"VERSION"}/; \
s/\@\@CONF\@\@/$$ENV{"CONF"}/; \
s/\@\@PLUGINS\@\@/$$ENV{"PLUGINS"}/; \
s/\@\@PLSTR\@\@/$$ENV{"PLSTR"}/;' \
"$(INPUT_FILE)" >"$(TARGET_FILE).tmp"
@chmod +x "$(TARGET_FILE).tmp"
@mv "$(TARGET_FILE).tmp" "$(TARGET_FILE)"
munin-node: plugins/*
@VERSION=$$(cat VERSION); \
echo "Making munin-node for muninlite version $$VERSION"; \
PLSTR=""; \
for PLGIN in $(PLUGINS); \
do \
echo "Adding plugin $$PLGIN"; \
PLSTR=$$(echo "$$PLSTR"; grep -v '^#' plugins/$$PLGIN); \
done; \
PLSTR=$$(echo "$$PLSTR" | sed -e 's/\\/\\\\/g' \
-e 's/\//\\\//g' \
-e 's/\$$/\\$$/g'); \
perl -p -e \
"s/\@\@VERSION\@\@/$$VERSION/;s/\@\@PLUGINS\@\@/$(PLUGINS)/;s/\@\@PLSTR\@\@/$$PLSTR/;" \
munin-node.in > munin-node
@chmod +x munin-node
.PHONY: help
help:
@$(info Available targets:)
@$(info all - assemble 'TARGET_FILE' ($(TARGET_FILE)))
@$(info clean - remove assembled 'TARGET_FILE' ($(TARGET_FILE)))
@$(info clean-all - remove old releases from 'DIST_DIR' ($(DIST_DIR)))
@$(info dist - create release archive)
@$(info install - install the standalone shell script)
@$(info help - show this overview)
@$(info lint - code style checks)
@$(info spelling - check spelling)
@$(info test - run tests)
all: munin-node
.PHONY: all
all: $(TARGET_FILE)
.PHONY: clean-node
clean-node:
@echo "Removing munin-node"
@rm -f munin-node
@echo "Removing $(TARGET_FILE)"
@rm -f "$(TARGET_FILE)"
clean-tgz:
@echo "Old releases"
@rm -rf releases
.PHONY: clean-dist
clean-dist:
@echo "Removing old releases"
@rm -rf "$(DIST_DIR)"
.PHONY: clean
clean: clean-node
clean-all: clean-node clean-tgz
tgz: clean-node
@VERSION=$$(cat VERSION); \
echo "Building release/muninlite-$$VERSION.tar.gz"; \
mkdir -p releases; \
cp -ra . releases/muninlite-$$VERSION 2>/dev/null || true; \
cd releases; \
rm -rf muninlite-$$VERSION/releases; \
tar zcvf muninlite-$$VERSION.tar.gz muninlite-$$VERSION >/dev/null; \
rm -rf muninlite-$$VERSION;
.PHONY: clean-all
clean-all: clean-node clean-dist
$(TGZ_FILE):
@echo "Building $@ ..."
@mkdir -p "$(dir $(@))"
git archive --prefix=muninlite-$(VERSION)/ --format=tar.gz --output "$@.tmp" HEAD
mv "$@.tmp" "$@"
$(TGZ_FILE_SIGNATURE): $(TGZ_FILE)
gpg --armor --detach-sign --sign --local-user="$(SIGN_KEY_NAME)" "$<"
.PHONY: dist
dist: $(TGZ_FILE_SIGNATURE)
.PHONY: install
install: $(TARGET_FILE)
mkdir -p "$(dir $(DESTDIR))"
cp "$(TARGET_FILE)" "$(DESTDIR)/"
.PHONY: lint
lint:
shellcheck -s dash --exclude=SC2230 $(PLUGIN_FILES) "$(INPUT_FILE)"
.PHONY: spelling
spelling:
@find -name .git -prune -or -name $(DIST_DIR) -prune -or -type f -print | xargs codespell
.PHONY: test
test: $(TARGET_FILE)
@# verify that the assembled shell script can be interpreted by the local shell
@if echo "list" | "$(abspath $(TARGET_FILE))" | grep -qw "uptime"; then \
echo "Test OK"; else echo "Test FAILED"; false; fi

171
README
View File

@ -1,171 +0,0 @@
README for MuninLite
====================
MuninLite is a single Bourne Shell script that implements the Munin
protocoll as well as some Linux specific plugins. The motivation for
developing MuninLite was to provide a simple Munin Node, using inetd
on systems without a full featured Perl and/or bash or a busybox
system.
MuninLite is Copyright (C) 2007 Rune Nordbøe Skillingstad
<rune@skillingstad.no> and released under GPLv2 (see LICENSE file)
Features
--------
MuninLite implements the following plugins:
* df
* cpu
* if_
* if_err_
* load
* memory
* processes
* swap
* netstat
* uptime
* interrupts
* irqstats
Included files
--------------
Changelog Changelog
CREDITS Credits to contributors
LICENSE GPLv2 License
Makefile Rules to make munin-node
README This file
TODO Things to do in future releases
VERSION Current version
munin-node.in The MuninLite script skeleton
examples/xinetd.d/munin Sample xinetd configuration
examples/inetd.conf Sample inetd.conf configuration
examples/inetd.busybox Sample inetd.conf configuration for busybox
examples/hosts.deny Sample hosts.deny configuration
examples/hosts.allow Sample hosts.allow configuration
plugins/cpu CPU usage plugin
plugins/df Filesystem usage plugin
plugins/if_ Network interface traffic plugin
plugins/if_err_ Network interface errors plugin
plugins/interrupts Interrupts & context switches plugin
plugins/irqstats Individual interrupts plugin
plugins/load Load average plugin
plugins/memory Memory usage plugin
plugins/netstat Netstat plugin
plugins/processes Number of Processes plugin
plugins/swap Swap in/out plugin
plugins/uptime Uptime plugin
Build requirements
------------------
Make (Not sure what requirements)
Perl (even very old versions should work)
Requirements
------------
Bourne Shell (ash or dash should be sufficient)
grep (simple grep in busybox is sufficient)
sed (simple sed in busybox is sufficient -- but a bit strange...)
cut (cut in busybox is sufficient)
wc (wc in busybox is sufficient)
xargs (xargs in busybox is sufficient)
inetd (inetd in busybox is sufficient)
Installation
------------
Download source and unpack it.
Edit Makefile to suit your choice of plugins
Make munin-node by running "make"
# make
Making munin-node for muninlite version 0.9.14
Adding plugin df
Adding plugin cpu
Adding plugin if_
Adding plugin if_err_
Adding plugin load
Adding plugin memory
Adding plugin processes
Adding plugin swap
Adding plugin netstat
Adding plugin uptime
Adding plugin interrupts
Adding plugin irqstats
Copy munin-node to a suitable location (/usr/local/bin/) and make it
executable (there will be a "make install" at a later release)
# cp munin-node /usr/local/bin
# chmod +x /usr/local/bin/munin-node
Add munin port to /etc/services
# echo "munin 4949/tcp lrrd # Munin" >>/etc/services
Configure inetd or xinetd to fork this script for request on the
munin port (4949).
Sample configuration for xinetd is located in examples/xinetd.d/munin
# cp examples/xinetd.d/munin /etc/xinetd.d
# killall -HUP xinetd
Sample configuration for inetd is located in examples/inetd.conf
# cat examples/inetd.conf >> /etc/inetd.conf
# killall -HUP inetd
Restrict access to munin port using hosts.allow and
hosts.deny or add a rule to your favorite firewall config.
Examples of hosts.allow/deny settings is provided in the examples
directory.
Iptables might be set with something like this:
# iptables -A INPUT -p tcp --dport munin --source 10.42.42.25 -j ACCEPT
Test
----
To test script, just run it (/usr/bin/local/munin-node):
# /usr/local/bin/munin-node
# munin node at localhost.localdomain
help
# Unknown command. Try list, nodes, config, fetch, version or quit
list
df cpu if_eth0 if_eth1 if_err_eth0 if_err_eth1 load memory
version
munins node on mose.medisin.ntnu.no version: 0.0.5 (munin-lite)
quit
For inetd-test, try to telnet to munin port from allowed host.
# telnet localhost 4949
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
# munin node at localhost.localdomain
help
# Unknown command. Try list, nodes, config, fetch, version or quit
list
df cpu if_eth0 if_eth1 if_err_eth0 if_err_eth1 load memory
version
munins node on mose.medisin.ntnu.no version: 0.0.5 (munin-lite)
quit
Connection closed by foreign host.
Plugin configuration
------------------------
To configure which plugins should be enabled, locate the PLUGINS
variable in munin-node and remove unwanted plugins.
There is no specific configuration for plugins.
Munin configuration
-------------------
Configure your /etc/munin/munin.conf as you would for a regular
munin-node.
[some.host.tld]
address 10.42.42.25
use_node_name yes

210
README.md Normal file
View File

@ -0,0 +1,210 @@
# MuninLite
MuninLite is a standalone shell script implementing the Munin
protocol and containing a few basic plugins out of the box.
It can run as an inetd-based service over TCP or a simple
executable script communicating via stdin/stdout. The latter
does not require root privileges.
# Project scope
MuninLite is supposed to be a minimal portable and shell-based
implementation of `munin-node`. It provides a small set of
essential plugins suitable for basic monitoring of a host.
Additionally external plugins can be used.
Only essential tools (e.g. the ones provided by busybox) should
be required for MuninLite.
# Missing features (by design)
The following features of the official `munin-node` implementation
are not included (see "Project scope" above):
* no configuration per plugin
(e.g. environment variables or reduced privileges)
* no host-based access control for incoming requests
(may be configured via `/etc/hosts.allow` or firewall rules)
* no advanced plugin state tracking
(e.g. killing a plugin process after a timeout)
# Installation
## Build requirements
* Make
* Perl
## Installation
Download source and unpack it.
Assemble the MuninLite shell script by running `make`:
```shell
$ make
```
You may assemble a reduced script by including only specific plugins:
```shell
$ make PLUGINS="cpu load uptime"
```
Run `make install` or simply copy `muninlite` to a suitable location.
```shell
make install
```
Two typical ways of using MuninLite as a `munin-node` replacement are:
* direct execution: suitable for remote hosts lacking root access (e.g. shared host)
* TCP service via inetd/xinetd: providing a service that is accessible via TCP (like `munin-node`)
Both approaches are detailed below.
### Installation for direct execution
Configure the `address` setting of the node in the master's configuration with
a suitable transport, e.g.:
```
[some.host.tld]
address ssh://node-a.example.org/usr/local/bin/muninlite
```
The above example causes the master to connect to the node via ssh and to
execute the MuninLite script directly. The running script responds to request
from standard input just like it would do as a TCP service via inetd/xinetd.
### Installation as a TCP service (inetd/xinetd)
Add munin port to `/etc/services` (in case it is missing):
```shell
echo "munin 4949/tcp lrrd # Munin" >>/etc/services
```
Configure inetd or xinetd to fork this script for request on the
munin port (4949).
Sample configuration for xinetd is located in `examples/xinetd.d/munin`:
```shell
cp examples/xinetd.d/munin /etc/xinetd.d
killall -HUP xinetd
```
Sample configuration for inetd is located in `examples/inetd.conf`:
```shell
cat examples/inetd.conf >> /etc/inetd.conf
killall -HUP inetd
```
Restrict access to munin port using hosts.allow and
hosts.deny or add a rule to your favorite firewall config.
Examples of hosts.allow/deny settings is provided in the examples
directory.
Iptables might be set with something like this:
```shell
iptables -A INPUT -p tcp --dport munin --source 10.42.42.25 -j ACCEPT
```
## Test
To test the script, just run it (`/usr/local/bin/muninlite`):
```shell
$ /usr/local/bin/muninlite
# munin node at localhost.localdomain
help
# Unknown command. Try list, nodes, config, fetch, version or quit
list
df cpu if_eth0 if_eth1 if_err_eth0 if_err_eth1 load memory
version
munins node on example.org version: 0.0.5 (muninlite)
quit
```
An (x)inetd setup can be tested via telnet or netcat:
```shell
# telnet localhost 4949
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
# munin node at localhost.localdomain
help
# Unknown command. Try list, nodes, config, fetch, version or quit
list
df cpu if_eth0 if_eth1 if_err_eth0 if_err_eth1 load memory
version
munins node on example.org version: 0.0.5 (muninlite)
quit
Connection closed by foreign host.
```
# Configuration
## Plugin configuration
MuninLite does not support explicit configurations per plugin
(as `munin-node` does).
But the file `/etc/munin/muninlite.conf` (if it exists) is sourced
as a shell script during the execution of MuninLite.
This optional configuration file allows a variety of customizations:
* override integrated plugins
(by redefining their functions, e.g. `config_if` and `fetch_if`)
* disable integrated plugins (e.g. `PLUGINS=${PLUGINS/ wireless / }`)
* overwrite configuration variables for integrated plugins
(e.g. `NTP_PEER` or `DF_IGNORE_FILESYSTEM_REGEX`)
* specify configuration settings required for external plugins
(provided in `/etc/munin/plugins/`):
`export FOO_SERVICE=http://localhost:7123`
## External plugins
MuninLite includes a set of integrated plugins. In addition it is
possible to expose additional plugins (just like the official
`munin-node` implementation). By default all executables files
(or symlinks) below the directory `/etc/munin/plugins` are treated
as plugins.
## Munin master configuration
Configure /etc/munin/munin.conf on you munin master as you would for a regular
`munin-node`. If you configured MuninLite as a TCP service (e.g. via
inetd/xinetd):
```
[some.host.tld]
address 10.42.42.25
use_node_name yes
```
In case of direct execution of MuninLite on the remote host (without a TCP
service), you need to configure a transport and execute the script directly:
```
[some.host.tld]
address ssh://10.42.42.25/usr/local/bin/muninlite
use_node_name yes
```
The ssh transport obviously requires the use of `authorized_keys` on
the host running MuninLite.
# License and copyright
MuninLite is released under GPLv2 (see LICENSE file).
* Copyright (C) 2007-2011 Rune Nordbøe Skillingstad <rune@skillingstad.no>
* Copyright (C) 2019-2020 Lars Kruse <devel@sumpfralle.de>
* Copyright (C) 2020 Kim B. Heino <b@bbbs.net>

38
RELEASE_CHECKLIST.md Normal file
View File

@ -0,0 +1,38 @@
# Release checklist
The following steps are required for a release:
1. update the `Changelog.md` file
2. execute the following commands:
```shell
new_version=2.0.0
echo "$new_version" >VERSION
git commit -m "Release $new_version" VERSION Changelog.md
git tag -s "$new_version" -m "$new_version"
make dist
```
3. push the commits (and the tag) to github:
```shell
git push
git push --tags
```
4. attach the locally generated release archive and the signature to the
[new release](https://github.com/munin-monitoring/muninlite/releases/)
# Downstream notifications
## OpenWrt
The following minimal set of changes is applicable only, if no incompatible changes
(e.g. new filenames) are introduced in this release.
1. update the
[release references](https://github.com/openwrt/packages/blob/master/admin/muninlite/Makefile)
in OpenWrt:
* `PKG_VERSION`: the new muninlite version
* `PKG_HASH`: `sha256sum` of the release archive (`.tar.gz`)
* see [example](https://github.com/openwrt/packages/pull/13717/commits/0f4db441b82a257252b775b1fee6de1737295bdc)
2. create a pull request:
* the commit needs to contain a `Signed-off-by: NAME <MAIL_ADDRESS>` line (`git commit --signoff`)
* see [example](https://github.com/openwrt/packages/pull/13717)

2
TODO
View File

@ -1,2 +0,0 @@
* Homepage
* Documentation

View File

@ -1 +1 @@
0.9.16
2.1.2

View File

@ -1,17 +0,0 @@
These distributions are known to be working with muninlite:
* Floppyfw 3.0
- Needs a busybox with inetd
- See http://pong.no/floppyfw/muninlite/
* Endian Firewall Community 2.1
- Needs some kind of inetd (xinetd RPM from Centos might work)
- # rpm -ivh --nodeps ftp://mirror.ii.uib.no/sites/msync.centos.org/centos/2.1/final/i386/CentOS/RPMS/xinetd-2.3.11-2.AS2.1.i386.rpm
- Remove '[ "${NETWORKING}" = "yes" ] || exit 0' from /etc/inet.d/xinetd
- Add /etc/xinetd.d/munin (see examples dir for config)
- Add munin (port 4949) to /etc/services
- Add "munin-node : <ip adress of munin gatherer>" to /etc/hosts.allow
* OpenSuSE 10.2
- Just works

View File

@ -1,54 +0,0 @@
How to make busybox with inetd
------------------------------
Some version numbers might be different, but the steps should be valid
anyway.
Get a copy of the floppyfw devkit:
# http://www.zelow.no/floppyfw/trac/wiki/TheDevkit
Follow the readme to get a svn check out of the source.
For the stable 3.0 series, the command is as follows:
# svn co http://www.zelow.no/svn/floppyfw-3.0
Edit the BusyBox config with your favourite editor. It's located at
/floppyfw-3.0/configs/config-busybox-1.2.2.1
Change the line "# CONFIG_INETD is not set" to "CONFIG_INETD=y".
To add the muninlite package, you should download muninlite.mk.txt from
http://pong.no/floppyfw/muninlite/.
Rename muninlite.mk.txt to muninlite.mk and place in the makefile
directory.
Edit /floppyfw-3.0/Makefile. Find all the TARGETS and add
"TARGETS+=muninlite" next to them.
Then build your own version of floppyfw:
# cd /floppyfw-3.0; make
If you want additional packages, copy the .ffw-files from the
/floppyfw-3.0/build_i386/ directory to the /floppyfw-3.0/floppy/packages
directory.
Download post-muninlite.ini.txt from http://pong.no/floppyfw/muninlite/
to the /floppyfw-3.0/floppy/packages directory and rename it to
post-muninlite.ini.
Make the floppy-image:
# cd /floppyfw-3.0; make floppyimage
You now have a floppy image with muninlite installed and configured.
Transfer the image to a floppy and make your customizations to the
config and floppyfw.ini files (if any are needed).
Boot your firewall.
If it works, you will see these messages during boot:
Looking for post- scripts...
/mnt/tmp/packages/post-muninlite.ini stripped
/mnt/tmp/packages/post-muninlite.ini chmoded
Running /etc/post-muninlite.ini
Starting inetd.

View File

@ -1 +1 @@
munin-node : 10.42.42.25
muninlite : 10.42.42.25

View File

@ -1 +1 @@
munin-node : ALL
muninlite : ALL

View File

@ -1 +1 @@
munin stream tcp nowait root /usr/local/bin/munin-node
munin stream tcp nowait root /usr/local/bin/muninlite

View File

@ -1 +1 @@
munin stream tcp nowait root /usr/sbin/tcpd /usr/local/bin/munin-node
munin stream tcp nowait root /usr/sbin/tcpd /usr/local/bin/muninlite

View File

@ -22,12 +22,7 @@
if [ -f /sbin/inetd ]; then
if grep "^lrrd" /etc/inetd.conf >/dev/null 2>&1; then
echo "muninlite can not start as lrrd is already in use"
exit 1
else
echo "lrrd stream tcp nowait root /usr/bin/munin-node" >> /etc/inetd.conf
fi
echo "munin stream tcp nowait root /usr/local/bin/muninlite" >> /etc/inetd.conf
PID=$(ps | grep -v grep | grep inetd | sed 's/^ \{1,\}//' | cut -d\ -f1)
if [ ! -z "$PID" ]; then
echo "inetd already running.. restarting.."
@ -36,6 +31,6 @@ if [ -f /sbin/inetd ]; then
echo "Starting inetd."
inetd /etc/inetd.conf
fi
else
else
echo "inetd not found, not installing muninlite"
fi

View File

@ -4,8 +4,8 @@ service munin
protocol = tcp
wait = no
user = root
group = root
only_from = 10.42.42.25
server = /usr/local/bin/munin-node
group = root
only_from = 10.42.42.25
server = /usr/local/bin/muninlite
disable = no
}

View File

@ -1,103 +0,0 @@
#!/bin/sh
#
# Simple Bourne Shell script that implements Munin protocoll and
# some common Linux plugins.
#
# For latest version, see http://muninlite.sf.net/
#
# Copyright (c) 2007 Rune Nordbøe Skillingstad <rune@skillingstad.no>
#
# Licensed under GPLv2 (see LICENSE file for full License)
#
# $Id: $
#
VERSION="@@VERSION@@"
# Remove unwanted plugins from this list
PLUGINS="@@PLUGINS@@"
# ===== PLUGINS CODE =====
@@PLSTR@@
# ===== NODE CODE =====
do_list() {
echo $PLUGINS
}
do_nodes() {
echo "$HOSTNAME"
echo "."
}
do_config() {
if echo "$PLUGINS" | grep "\b$1\b" >/dev/null 2>&1; then
config_$1
else
echo "# Unknown service"
fi
echo "."
}
do_fetch() {
if echo "$PLUGINS" | grep "\b$1\b" >/dev/null 2>&1; then
fetch_$1
else
echo "# Unknown service"
fi
echo "."
}
do_version() {
echo "munins node on $HOSTNAME version: $VERSION (munin-lite)"
}
do_quit() {
exit 0
}
# ===== Runtime config =====
RES=""
for PLUG in $PLUGINS
do
if [ "$PLUG" = "if_" ]; then
for INTER in $(grep '^ *\(eth\|wlan\|ath\|ra\)[0-9]\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
do
RES="$RES if_$INTER"
eval "fetch_if_${INTER}() { fetch_if $INTER $@; };"
eval "config_if_${INTER}() { config_if $INTER $@; };"
done
elif [ "$PLUG" = "if_err_" ]; then
for INTER in $(grep '^ *\(eth\|wlan\|ath\|ra\)[0-9]\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
do
RES="$RES if_err_$INTER"
eval "fetch_if_err_${INTER}() { fetch_if_err $INTER $@; };"
eval "config_if_err_${INTER}() { config_if_err $INTER $@; };"
done
elif [ "$PLUG" = "netstat" ]; then
if netstat -s >/dev/null 2>&1; then
RES="$RES netstat"
fi
else
RES="$RES $PLUG";
fi
done
PLUGINS=$RES
# ===== MAIN LOOP =====
FUNCTIONS="list nodes config fetch version quit"
HOSTNAME=$(hostname -f 2>/dev/null || hostname)
echo "# munin node at $HOSTNAME"
while read arg0 arg1
do
arg0=$(echo "$arg0" | xargs)
arg1=$(echo "$arg1" | xargs)
if ! echo "$FUNCTIONS" | grep "\b$arg0\b" >/dev/null 2>&1 ; then
echo "# Unknown command. Try" $(echo "$FUNCTIONS" | sed -e 's/\( [[:alpha:]]\{1,\}\)/,\1/g' -e 's/,\( [[:alpha:]]\{1,\}\)$/ or\1/')
continue
fi
do_$arg0 $arg1
done

3
muninlite.conf Normal file
View File

@ -0,0 +1,3 @@
# the following variables are added to the top of the assembled muninlite script
NTP_PEER="pool.ntp.org"
DF_IGNORE_FILESYSTEM_REGEX="(none|unknown|rootfs|iso9660|squashfs|udf|romfs|ramfs|debugfs|cgroup_root|devtmpfs)"

135
muninlite.in Executable file
View File

@ -0,0 +1,135 @@
#!/bin/sh
#
# Simple Bourne Shell script that implements Munin protocol and
# some common Linux plugins.
#
# For latest version, see http://muninlite.sf.net/
#
# Copyright (c) 2007-2011 Rune Nordbøe Skillingstad <rune@skillingstad.no>
#
# Licensed under GPLv2 (see LICENSE file for full License)
#
VERSION="@@VERSION@@"
set -eu
@@CONF@@
# Name of runtime configuration file
CONFIG_FILE=/etc/munin/muninlite.conf
# if plugindir_ is present in $PLUGINS, executables (scripts, binaries) in the specified path
# and matching the pattern will be scanned and operated as plugins
PLUGIN_DIRECTORY=/etc/munin/plugins
PLUGINPATTERN="*"
# Remove unwanted plugins from this list
PLUGINS="@@PLUGINS@@"
# ===== LIB FUNCTIONS =====
clean_fieldname() {
echo "$@" | sed -e 's/^[^A-Za-z_]/_/' -e 's/[^A-Za-z0-9_]/_/g'
}
# ===== PLUGINS CODE =====
@@PLSTR@@
# ===== NODE CODE =====
do_list() {
echo "$PLUGINS"
}
do_nodes() {
echo "$HOSTNAME"
echo "."
}
do_config() {
if echo "$PLUGINS" | grep -qwF "$1"; then
"config_$1"
else
echo "# Unknown service"
fi
echo "."
}
do_fetch() {
if echo "$PLUGINS" | grep -qwF "$1"; then
"fetch_$1"
else
echo "# Unknown service"
fi
echo "."
}
do_version() {
echo "munins node on $HOSTNAME version: $VERSION (muninlite)"
}
do_quit() {
exit 0
}
# ===== Runtime config =====
# shellcheck source=/dev/null
[ -f ${CONFIG_FILE} ] && . ${CONFIG_FILE}
RES=""
for PLUG in $PLUGINS; do
case "$PLUG" in
if_|if_err_)
interface_names=$(sed 's/^ *//; s/:.*$//; / /d; /^lo$/d' /proc/net/dev)
for INTER in $interface_names; do
INTERRES=$(echo "$INTER" | sed -e 's/\./VLAN/' -e 's/\-/_/g')
RES="$RES ${PLUG}${INTERRES}"
eval "fetch_${PLUG}${INTERRES}() { 'fetch_${PLUG%_}' '$INTER'; }"
eval "config_${PLUG}${INTERRES}() { 'config_${PLUG%_}' '$INTER'; }"
done
;;
netstat)
if netstat -s >/dev/null 2>&1; then
RES="$RES netstat"
fi
;;
wireless)
if iwinfo >/dev/null 2>&1; then
RES="${RES} ${PLUG}"
fi
;;
plugindir_)
for MYPLUGIN in $(if [ -d "$PLUGIN_DIRECTORY" ]; then find -L "$PLUGIN_DIRECTORY" -type f -name "$PLUGINPATTERN"; fi); do
if [ -f "$MYPLUGIN" ] && [ -x "$MYPLUGIN" ]; then
# generate a name suitable for shell function names
MYPLUGINNAME=$(basename "$MYPLUGIN" | sed 's/[^0-9a-zA-Z_]/_/g')
# detect and avoid name collision
if echo "$RES" | grep -qwF "$MYPLUGINNAME"; then
MYPLUGINNAME="plugindir_$MYPLUGINNAME"
fi
RES="$RES $MYPLUGINNAME"
eval "fetch_${MYPLUGINNAME}() { '$MYPLUGIN'; }"
eval "config_${MYPLUGINNAME}() { '$MYPLUGIN' config; }"
fi
done
;;
*)
RES="$RES $PLUG"
;;
esac
done
# sort plugin names and remove surrounding whitespace
PLUGINS=$(echo "$RES" | xargs -r -n 1 echo | sort | xargs echo)
# ===== MAIN LOOP =====
FUNCTIONS="list nodes config fetch version quit"
HOSTNAME=$( { hostname -f || hostname || cat /proc/sys/kernel/hostname || echo "unknown"; } 2>/dev/null )
echo "# munin node at $HOSTNAME"
while read -r arg0 arg1
do
arg0=$(printf '%s\n' "$arg0" | xargs)
arg1=$(printf '%s\n' "$arg1" | xargs)
if ! echo "$FUNCTIONS" | grep -qwF -- "$arg0"; then
echo "# Unknown command. Try $(echo "$FUNCTIONS" | sed -e 's/\( [[:alpha:]]\{1,\}\)/,\1/g' -e 's/,\( [[:alpha:]]\{1,\}\)$/ or\1/')"
elif [ -n "$arg0" ]; then
"do_$arg0" "$arg1"
fi
done

View File

@ -1,16 +1,17 @@
config_cpu() {
extinfo=""
if grep '^cpu \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\}' /proc/stat >/dev/null 2>&1; then
if grep -q '^cpu \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\}' /proc/stat; then
extinfo="iowait irq softirq"
fi
NCPU=$(($(grep '^cpu. ' /proc/stat | wc -l) - 1))
PERCENT=$(($NCPU * 100))
# shellcheck disable=SC2126
NCPU=$(grep '^cpu[0-9]\+ ' /proc/stat | wc -l)
PERCENT=$((NCPU * 100))
graphlimit=$PERCENT
SYSWARNING=$(($PERCENT * 30 / 100))
SYSCRITICAL=$(($PERCENT * 50 / 100))
USRWARNING=$(($PERCENT * 80 / 100))
SYSWARNING=$((PERCENT * 30 / 100))
SYSCRITICAL=$((PERCENT * 50 / 100))
USRWARNING=$((PERCENT * 80 / 100))
echo "graph_title CPU usage"
echo "graph_order system user nice idle" $extinfo
echo "graph_order system user nice idle $extinfo" | sed 's/ $//'
echo "graph_args --base 1000 -r --lower-limit 0 --upper-limit $graphlimit"
echo "graph_vlabel %"
echo "graph_scale no"
@ -44,7 +45,7 @@ config_cpu() {
echo "idle.max 5000"
echo "idle.type DERIVE"
echo "idle.info Idle CPU time"
if [ ! -z "$extinfo" ]; then
if [ -n "$extinfo" ]; then
echo "iowait.label iowait"
echo "iowait.draw STACK"
echo "iowait.min 0"
@ -62,22 +63,22 @@ config_cpu() {
echo "softirq.min 0"
echo "softirq.max 5000"
echo "softirq.type DERIVE"
echo "softirq.info CPU time spent handling "batched" interrupts"
echo "softirq.info CPU time spent handling 'batched' interrupts"
fi
}
fetch_cpu() {
extinfo=""
if grep '^cpu \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\}' /proc/stat >/dev/null 2>&1; then
if grep -q '^cpu \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\}' /proc/stat; then
extinfo="iowait irq softirq"
fi
CINFO=$(grep '^cpu ' /proc/stat | cut -c6-)
echo "user.value" $(echo "$CINFO" | cut -d\ -f1)
echo "nice.value" $(echo "$CINFO" | cut -d\ -f2)
echo "system.value" $(echo "$CINFO" | cut -d\ -f3)
echo "idle.value" $(echo "$CINFO" | cut -d\ -f4)
if [ ! -z "$extinfo" ]; then
echo "iowait.value" $(echo "$CINFO" | cut -d\ -f5)
echo "irq.value" $(echo "$CINFO" | cut -d\ -f6)
echo "softirq.value" $(echo "$CINFO" | cut -d\ -f7)
echo "user.value" "$(echo "$CINFO" | cut -d " " -f 1)"
echo "nice.value" "$(echo "$CINFO" | cut -d " " -f 2)"
echo "system.value" "$(echo "$CINFO" | cut -d " " -f 3)"
echo "idle.value" "$(echo "$CINFO" | cut -d " " -f 4)"
if [ -n "$extinfo" ]; then
echo "iowait.value" "$(echo "$CINFO" | cut -d " " -f 5)"
echo "irq.value" "$(echo "$CINFO" | cut -d " " -f 6)"
echo "softirq.value" "$(echo "$CINFO" | cut -d " " -f 7)"
fi
}

View File

@ -4,21 +4,19 @@ graph_args --upper-limit 100 -l 0
graph_vlabel %
graph_category disk
graph_info This graph shows disk usage on the machine."
for PART in $(df | grep '\/[a-z0-9]*$' | sed 's/ \{1,\}/ /g;' | cut -d\ -f6)
df -PT | grep '^/' | grep -vwE "$DF_IGNORE_FILESYSTEM_REGEX" | while read dev type blocks used avail pct mp
do
PINFO=$(df $PART | tail -1);
PNAME=$(echo $PINFO | cut -d\ -f1 | sed 's/\//_/g')
echo "$PNAME.label $PART"
echo "$PNAME.info $PNAME -> $PART"
PNAME=$(clean_fieldname "$mp")
echo "$PNAME.label $mp"
echo "$PNAME.info $dev -> $mp"
echo "$PNAME.warning 92"
echo "$PNAME.critical 98"
done
}
fetch_df() {
for PART in $(df | grep '\/[a-z0-9]*$' | sed 's/ \{1,\}/ /g;' | cut -d\ -f6)
df -PT | grep '^/' | grep -vwE "$DF_IGNORE_FILESYSTEM_REGEX" | while read dev type blocks used avail pct mp
do
PINFO=$(df $PART | tail -1);
PNAME=$(echo $PINFO | cut -d\ -f1 | sed 's/\//_/g')
echo "$PNAME.value" $(echo $PINFO | cut -f5 -d\ | sed -e 's/\%//g')
PNAME=$(clean_fieldname "$mp")
echo "$PNAME.value" "${pct%\%}"
done
}

View File

@ -1,6 +1,7 @@
config_if() {
INTERFACE=$1
echo "graph_order down up"
echo "graph_title $1 traffic"
echo "graph_title Interface $INTERFACE traffic"
echo "graph_args --base 1000"
echo "graph_vlabel bits in (-) / out (+) per \${graph_period}"
echo "graph_category network"
@ -15,14 +16,17 @@ config_if() {
echo "up.min 0"
echo "up.negative down"
echo "up.cdef up,8,*"
if ethtool $1 >/dev/null 2>&1; then
MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000))
echo "up.max $MAX"
echo "down.max $MAX"
if [ -n "$(which ethtool)" ] && [ -x "$(which ethtool)" ]; then
MAX_MBPS=$(ethtool "$INTERFACE" 2>/dev/null | grep "Speed: [0-9]\+Mb/s$" | sed 's/[^0-9]//g')
if [ -n "$MAX_MBPS" ]; then
echo "up.max $((MAX_MBPS * 1024 * 1024))"
echo "down.max $((MAX_MBPS * 1024 * 1024))"
fi
fi
}
fetch_if() {
IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
echo "down.value" $(echo $IINFO | cut -d\ -f1)
echo "up.value" $(echo $IINFO | cut -d\ -f9)
INTERFACE=$1
IINFO=$(grep "^ *$INTERFACE:" /proc/net/dev | cut -d ":" -f 2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
echo "down.value" "$(echo "$IINFO" | cut -d " " -f 1)"
echo "up.value" "$(echo "$IINFO" | cut -d " " -f 9)"
}

View File

@ -1,10 +1,11 @@
config_if_err() {
INTERFACE=$1
echo "graph_order rcvd trans"
echo "graph_title $1 errors"
echo "graph_title Interface $INTERFACE errors"
echo "graph_args --base 1000"
echo "graph_vlabel packets in (-) / out (+) per \${graph_period}"
echo "graph_category network"
echo "graph_info This graph shows the amount of errors on the $1 network interface."
echo "graph_info This graph shows the amount of errors on the $INTERFACE network interface."
echo "rcvd.label packets"
echo "rcvd.type COUNTER"
echo "rcvd.graph no"
@ -15,7 +16,8 @@ config_if_err() {
echo "trans.warning 1"
}
fetch_if_err() {
IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
echo "rcvd.value" $(echo $IINFO | cut -d\ -f3)
echo "trans.value" $(echo $IINFO | cut -d\ -f11)
INTERFACE=$1
IINFO=$(grep "^ *$INTERFACE:" /proc/net/dev | cut -d ":" -f 2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
echo "rcvd.value" "$(echo "$IINFO" | cut -d " " -f 3)"
echo "trans.value" "$(echo "$IINFO" | cut -d " " -f 11)"
}

View File

@ -17,6 +17,6 @@ config_interrupts() {
}
fetch_interrupts() {
IINFO=$(cat /proc/stat)
echo "ctx.value" $(echo "$IINFO" | grep "^ctxt" | cut -d\ -f2)
echo "intr.value" $(echo "$IINFO" | grep "^intr" | cut -d\ -f2)
echo "ctx.value" "$(echo "$IINFO" | grep "^ctxt" | cut -d " " -f 2)"
echo "intr.value" "$(echo "$IINFO" | grep "^intr" | cut -d " " -f 2)"
}

View File

@ -1,6 +1,6 @@
config_irqstats() {
echo "graph_title Individual interrupts
graph_args --base 1000 -l 0;
graph_args --base 1000 -l 0
graph_vlabel interrupts / \${graph_period}
graph_category system"
CPUS=$(grep 'CPU[0-9]' /proc/interrupts | wc -w)
@ -8,8 +8,8 @@ graph_category system"
for ID in $(echo "$IINFO" | cut -d: -f1)
do
IDL=$(echo "$IINFO" | grep "^$ID:")
INFO=$(eval "echo \"$IDL\" | cut -d\ -f$((3+$CPUS))-")
if [ "$INFO" = "" ]; then
INFO=$(eval "echo \"$IDL\" | cut -d ' ' -f '$((3 + CPUS))-'")
if [ -z "$INFO" ]; then
echo "i$ID.label $ID"
else
echo "i$ID.label $INFO"
@ -25,11 +25,13 @@ fetch_irqstats() {
for ID in $(echo "$IINFO" | cut -d: -f1)
do
IDL=$(echo "$IINFO" | grep "^$ID:")
VALS=$(eval "echo \"$IDL\" | cut -d\ -f2-$((1+$CPUS))")
VALS=$(eval "echo \"$IDL\" | cut -d ' ' -f '2-$((1 + CPUS))'")
VALUE=0
for VAL in $VALS;
do
VALUE=$(($VALUE + $VAL))
if [ "$VAL" -eq "$VAL" ] 2> /dev/null; then
VALUE=$((VALUE + VAL))
fi
done
echo "i$ID.value $VALUE"
done

View File

@ -11,5 +11,5 @@ graph_info The load average of the machine describes how many processes are in t
load.info Average load for the five minutes."
}
fetch_load() {
echo "load.value" $(cut -f2 -d\ /proc/loadavg)
echo "load.value" "$(cut -d " " -f 2 /proc/loadavg)"
}

View File

@ -1,5 +1,5 @@
config_memory() {
MINFO=$(cat /proc/meminfo | sed 's/ \{1,\}/ /g;')
MINFO=$(sed 's/ \{1,\}/ /g;' /proc/meminfo)
MEMTOTAL=$(echo "$MINFO" | grep "^MemTotal:" | cut -d\ -f2)
PAGETABLES=$(echo "$MINFO" | grep "^PageTables:" | cut -d\ -f2)
SWAPCACHED=$(echo "$MINFO" | grep "^SwapCached:" | cut -d\ -f2)
@ -14,14 +14,14 @@ config_memory() {
ACTIVECACHE=$(echo "$MINFO" | grep "^ActiveCache:" | cut -d\ -f2)
INACTIVE=$(echo "$MINFO" | grep "^Inactive:" | cut -d\ -f2)
INACTDIRTY=$(echo "$MINFO" | grep "^Inact_dirty:" | cut -d\ -f2)
INACTLAUNDY=$(echo "$MINFO" | grep "^Inact_laundry:" | cut -d\ -f2)
INACTLAUNDRY=$(echo "$MINFO" | grep "^Inact_laundry:" | cut -d\ -f2)
INACTCLEAN=$(echo "$MINFO" | grep "^Inact_clean:" | cut -d\ -f2)
GRAPH_ORDER="apps";
test "$PAGETABLES" != "" && GRAPH_ORDER="$GRAPH_ORDER page_tables"
test "$SWAPCACHED" != "" && GRAPH_ORDER="$GRAPH_ORDER swap_cache"
test "$VMALLOCUSED" != "" && GRAPH_ORDER="$GRAPH_ORDER vmalloc_used"
test "$SLAB" != "" && GRAPH_ORDER="$GRAPH_ORDER slab"
[ -n "$PAGETABLES" ] && GRAPH_ORDER="$GRAPH_ORDER page_tables"
[ -n "$SWAPCACHED" ] && GRAPH_ORDER="$GRAPH_ORDER swap_cache"
[ -n "$VMALLOCUSED" ] && GRAPH_ORDER="$GRAPH_ORDER vmalloc_used"
[ -n "$SLAB" ] && GRAPH_ORDER="$GRAPH_ORDER slab"
GRAPH_ORDER="$GRAPH_ORDER cached buffers free swap"
echo "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit $MEMTOTAL"
@ -44,72 +44,72 @@ config_memory() {
echo "free.label unused"
echo "free.draw STACK"
echo "free.info Wasted memory. Memory that is not used for anything at all."
if [ "$SLAB" != "" ]; then
if [ -n "$SLAB" ]; then
echo "slab.label slab_cache"
echo "slab.draw STACK"
echo "slab.info Memory used by the kernel (major users are caches like inode, dentry, etc)."
fi
if [ "$SWAPCACHED" != "" ]; then
if [ -n "$SWAPCACHED" ]; then
echo "swap_cache.label swap_cache"
echo "swap_cache.draw STACK"
echo "swap_cache.info A piece of memory that keeps track of pages that have been fetched from swap but not yet been modified."
fi
if [ "$PAGETABLES" != "" ]; then
if [ -n "$PAGETABLES" ]; then
echo "page_tables.label page_tables"
echo "page_tables.draw STACK"
echo "page_tables.info Memory used to map between virtual and physical memory addresses.\n"
fi
if [ "$VMALLOCUSED" != "" ]; then
if [ -n "$VMALLOCUSED" ]; then
echo "vmalloc_used.label vmalloc_used"
echo "vmalloc_used.draw STACK"
echo "vmalloc_used.info Virtual memory used by the kernel (used when the memory does not have to be physically contigious)."
echo "vmalloc_used.info Virtual memory used by the kernel (used when the memory does not have to be physically contiguous)."
fi
if [ "$COMMITTEDAS" != "" ]; then
if [ -n "$COMMITTEDAS" ]; then
echo "committed.label committed"
echo "committed.draw LINE2"
echo "committed.warn" $(($SWAPTOTAL + $MEMTOTAL))
echo "committed.warn" $((SWAPTOTAL + MEMTOTAL))
echo "committed.info The amount of memory that would be used if all the memory that's been allocated were to be used."
fi
if [ "$MAPPED" != "" ]; then
if [ -n "$MAPPED" ]; then
echo "mapped.label mapped"
echo "mapped.draw LINE2"
echo "mapped.info All mmap()ed pages."
fi
if [ "$ACTIVE" != "" ]; then
if [ -n "$ACTIVE" ]; then
echo "active.label active"
echo "active.draw LINE2"
echo "active.info Memory recently used. Not reclaimed unless absolutely necessary."
fi
if [ "$ACTIVEANON" != "" ]; then
if [ -n "$ACTIVEANON" ]; then
echo "active_anon.label active_anon"
echo "active_anon.draw LINE1"
fi
if [ "$ACTIVECACHE" != "" ]; then
if [ -n "$ACTIVECACHE" ]; then
echo "active_cache.label active_cache"
echo "active_cache.draw LINE1"
fi
if [ "$INACTIVE" != "" ]; then
if [ -n "$INACTIVE" ]; then
echo "inactive.label inactive"
echo "inactive.draw LINE2"
echo "inactive.info Memory not currently used."
fi
if [ "$INACTDIRTY" != "" ]; then
if [ -n "$INACTDIRTY" ]; then
echo "inact_dirty.label inactive_dirty"
echo "inact_dirty.draw LINE1"
echo "inact_dirty.info Memory not currently used, but in need of being written to disk."
fi
if [ "$INACTLAUNDRY" != "" ]; then
if [ -n "$INACTLAUNDRY" ]; then
echo "inact_laundry.label inactive_laundry"
echo "inact_laundry.draw LINE1"
fi
if [ "$INACTCLEAN" != "" ]; then
if [ -n "$INACTCLEAN" ]; then
echo "inact_clean.label inactive_clean"
echo "inact_clean.draw LINE1"
echo "inact_clean.info Memory not currently used."
fi
}
fetch_memory() {
MINFO=$(cat /proc/meminfo | sed 's/ \{1,\}/ /g;')
MINFO=$(sed 's/ \{1,\}/ /g;' /proc/meminfo)
MEMTOTAL=$(echo "$MINFO" | grep "^MemTotal:" | cut -d\ -f2)
MEMFREE=$(echo "$MINFO" | grep "^MemFree:" | cut -d\ -f2)
BUFFERS=$(echo "$MINFO" | grep "^Buffers:" | cut -d\ -f2)
@ -129,57 +129,57 @@ fetch_memory() {
ACTIVECACHE=$(echo "$MINFO" | grep "^ActiveCache:" | cut -d\ -f2)
INACTIVE=$(echo "$MINFO" | grep "^Inactive:" | cut -d\ -f2)
INACTDIRTY=$(echo "$MINFO" | grep "^Inact_dirty:" | cut -d\ -f2)
INACTLAUNDY=$(echo "$MINFO" | grep "^Inact_laundry:" | cut -d\ -f2)
INACTLAUNDRY=$(echo "$MINFO" | grep "^Inact_laundry:" | cut -d\ -f2)
INACTCLEAN=$(echo "$MINFO" | grep "^Inact_clean:" | cut -d\ -f2)
APPS=$(($MEMTOTAL - $MEMFREE - $BUFFERS - $CACHED))
SWAP=$(($SWAP_TOTAL - $SWAP_FREE))
echo "buffers.value" $(($BUFFERS * 1024))
echo "swap.value" $(($SWAP * 1024))
echo "cached.value" $(($CACHED * 1024))
echo "free.value" $(($MEMFREE * 1024))
if [ "$SLAB" != "" ]; then
echo "slab.value" $(($SLAB * 1024))
APPS=$(($APPS - $SLAB))
APPS=$((MEMTOTAL - MEMFREE - BUFFERS - CACHED))
SWAP=$((SWAP_TOTAL - SWAP_FREE))
echo "buffers.value" $((BUFFERS * 1024))
echo "swap.value" $((SWAP * 1024))
echo "cached.value" $((CACHED * 1024))
echo "free.value" $((MEMFREE * 1024))
if [ -n "$SLAB" ]; then
echo "slab.value" $((SLAB * 1024))
APPS=$((APPS - SLAB))
fi
if [ "$SWAPCACHED" != "" ]; then
echo "swap_cache.value" $(($SWAPCACHED * 1024))
APPS=$(($APPS - $SWAPCACHED))
if [ -n "$SWAPCACHED" ]; then
echo "swap_cache.value" $((SWAPCACHED * 1024))
APPS=$((APPS - SWAPCACHED))
fi
if [ "$PAGETABLES" != "" ]; then
echo "page_tables.value" $(($PAGETABLES * 1024))
APPS=$(($APPS - $PAGETABLES))
if [ -n "$PAGETABLES" ]; then
echo "page_tables.value" $((PAGETABLES * 1024))
APPS=$((APPS - PAGETABLES))
fi
if [ "$VMALLOCUSED" != "" ]; then
echo "vmalloc_used.value" $(($VMALLOCUSED * 1024))
APPS=$(($APPS - $VMALLOCUSED))
if [ -n "$VMALLOCUSED" ]; then
echo "vmalloc_used.value" $((VMALLOCUSED * 1024))
APPS=$((APPS - VMALLOCUSED))
fi
if [ "$COMMITTEDAS" != "" ]; then
echo "committed.value" $(($COMMITTEDAS * 1024))
if [ -n "$COMMITTEDAS" ]; then
echo "committed.value" $((COMMITTEDAS * 1024))
fi
if [ "$MAPPED" != "" ]; then
echo "mapped.value" $(($MAPPED * 1024))
if [ -n "$MAPPED" ]; then
echo "mapped.value" $((MAPPED * 1024))
fi
if [ "$ACTIVE" != "" ]; then
echo "active.value" $(($ACTIVE * 1024))
if [ -n "$ACTIVE" ]; then
echo "active.value" $((ACTIVE * 1024))
fi
if [ "$ACTIVEANON" != "" ]; then
echo "active_anon.value" $(($ACTIVEANON * 1024))
if [ -n "$ACTIVEANON" ]; then
echo "active_anon.value" $((ACTIVEANON * 1024))
fi
if [ "$ACTIVECACHE" != "" ]; then
echo "active_cache.value" $(($ACTIVECACHE * 1024))
if [ -n "$ACTIVECACHE" ]; then
echo "active_cache.value" $((ACTIVECACHE * 1024))
fi
if [ "$INACTIVE" != "" ]; then
echo "inactive.value" $(($INACTIVE * 1024))
if [ -n "$INACTIVE" ]; then
echo "inactive.value" $((INACTIVE * 1024))
fi
if [ "$INACTDIRTY" != "" ]; then
echo "inact_dirty.value" $(($INACTDIRTY * 1024))
if [ -n "$INACTDIRTY" ]; then
echo "inact_dirty.value" $((INACTDIRTY * 1024))
fi
if [ "$INACTLAUNDRY" != "" ]; then
echo "inact_laundry.value" $(($INACTLAUNDRY * 1024))
if [ -n "$INACTLAUNDRY" ]; then
echo "inact_laundry.value" $((INACTLAUNDRY * 1024))
fi
if [ "$INACTCLEAN" != "" ]; then
echo "inact_clean.value" $(($INACTCLEAN * 1024))
if [ -n "$INACTCLEAN" ]; then
echo "inact_clean.value" $((INACTCLEAN * 1024))
fi
echo "apps.value" $(($APPS * 1024))
echo "apps.value" $((APPS * 1024))
}

View File

@ -4,8 +4,7 @@ config_netstat() {
echo "graph_vlabel active connections"
echo "graph_category network"
echo "graph_period second"
echo "graph_info This graph shows the TCP activity of all the network interfac
es combined."
echo "graph_info This graph shows the TCP activity of all the network interfaces combined."
echo "active.label active"
echo "active.type DERIVE"
echo "active.max 50000"
@ -33,9 +32,9 @@ es combined."
}
fetch_netstat() {
NINFO=$(netstat -s | sed 's/ \{1,\}/ /g')
echo "active.value" $(echo "$NINFO" | grep "active connections" | cut -d\ -f2)
echo "passive.value" $(echo "$NINFO" | grep "passive connection" | cut -d\ -f2)
echo "failed.value" $(echo "$NINFO" | grep "failed connection" | cut -d\ -f2)
echo "resets.value" $(echo "$NINFO" | grep "connection resets" | cut -d\ -f2)
echo "established.value" $(echo "$NINFO" | grep "connections established" | cut -d\ -f2)
echo "active.value" "$(echo "$NINFO" | grep "active connection" | cut -d " " -f 2)"
echo "passive.value" "$(echo "$NINFO" | grep "passive connection" | cut -d " " -f 2)"
echo "failed.value" "$(echo "$NINFO" | grep "failed connection" | cut -d " " -f 2)"
echo "resets.value" "$(echo "$NINFO" | grep "connection resets" | cut -d " " -f 2)"
echo "established.value" "$(echo "$NINFO" | grep "connections established" | cut -d " " -f 2)"
}

20
plugins/ntpdate Normal file
View File

@ -0,0 +1,20 @@
config_ntpdate() {
echo "graph_title NTP offset and delay to peer $NTP_PEER"
echo "graph_args --base 1000 --vertical-label msec"
echo "graph_category time"
echo "offset.label Offset"
echo "delay.label Delay"
}
fetch_ntpdate() {
NTPDATE="/usr/sbin/ntpdate"
OFFSET=0
DELAY=0
if [ -n "$NTP_PEER" ] && [ -x "$NTPDATE" ]; then
DATA=$("$NTPDATE" -q "$NTP_PEER" | awk '/^server.*offset/{gsub(/,/,""); printf "%s %s", ($6*1000), ($8*1000); exit;}')
OFFSET=$(echo "$DATA" | cut -d " " -f 1)
DELAY=$(echo "$DATA" | cut -d " " -f 2)
fi
echo "offset.value $OFFSET"
echo "delay.value $DELAY"
}

0
plugins/plugindir_ Normal file
View File

View File

@ -5,9 +5,8 @@ config_processes() {
echo "graph_category processes"
echo "graph_info This graph shows the number of processes in the system."
echo "processes.label processes"
echo "processes.draw LINE2"
echo "processes.info The current number of processes."
}
fetch_processes() {
echo "processes.value" $(echo /proc/[0-9]* | wc -w)
echo "processes.value" "$(echo /proc/[0-9]* | wc -w)"
}

View File

@ -17,11 +17,11 @@ config_swap() {
fetch_swap() {
if [ -f /proc/vmstat ]; then
SINFO=$(cat /proc/vmstat)
echo "swap_in.value" $(echo "$SINFO" | grep "^pswpin" | cut -d\ -f2)
echo "swap_out.value" $(echo "$SINFO" | grep "^pswpout" | cut -d\ -f2)
echo "swap_in.value" "$(echo "$SINFO" | awk 'BEGIN { result="U"; } { if ($1 == "pswpin") result=$2; } END { print(result); }')"
echo "swap_out.value" "$(echo "$SINFO" | awk 'BEGIN { result="U"; } { if ($1 == "pswpout") result=$2; } END { print(result); }')"
else
SINFO=$(grep "^swap" /proc/stat)
echo "swap_in.value" $(echo "$SINFO" | cut -d\ -f2)
echo "swap_out.value" $(echo "$SINFO" | cut -d\ -f3)
echo "swap_in.value" "$(echo "$SINFO" | cut -d " " -f 2)"
echo "swap_out.value" "$(echo "$SINFO" | cut -d " " -f 3)"
fi
}

View File

@ -2,10 +2,10 @@ config_uptime() {
echo "graph_title Uptime"
echo "graph_args --base 1000 -l 0 "
echo "graph_vlabel uptime in days"
echo "graph_category system"
echo "uptime.label uptime"
echo "uptime.draw AREA"
echo "uptime.cdef uptime,86400,/"
}
fetch_uptime() {
echo "uptime.value" $(cut -d\ -f1 /proc/uptime)
awk '{printf "uptime.value %.2f",$1/86400; print ""}' /proc/uptime
}

38
plugins/wireless Normal file
View File

@ -0,0 +1,38 @@
config_wireless() {
interfaces=$(iwinfo 2> /dev/null | sed '/^[a-zA-Z]/!d; s/ .*//')
radios=$(echo "${interfaces}" | sed '/-/d')
for radio in ${radios}
do
echo "multigraph wireless_${radio}
graph_title WLAN ${radio} AP Statistics
graph_vlabel Strength (dBm)
graph_category network
graph_scale no
signal.label Signal
noise.label Noise"
done
for interface in ${interfaces}
do
echo "multigraph wireless_assoc_$(clean_fieldname "${interface}")
graph_title WLAN ${interface} associations
graph_vlabel Clients
graph_args --lower-limit 0
graph_category network
graph_scale no
clients.label Clients"
done
}
fetch_wireless() {
interfaces=$(iwinfo 2> /dev/null | sed '/^[a-zA-Z]/!d; s/ .*//')
radios=$(echo "${interfaces}" | sed '/-/d')
for radio in ${radios}
do
echo "multigraph wireless_${radio}"
iwinfo "${radio}" info | sed -r 's/unknown/0 dBm/g; /Signal.*Noise/!d; s/^.* Signal: ([-0-9]+) dBm Noise: ([-0-9]+) dBm/signal.value \1\nnoise.value \2/'
done
for interface in ${interfaces}
do
echo "multigraph wireless_assoc_$(clean_fieldname "${interface}")"
echo "clients.value $(iwinfo "${interface}" assoc | grep -c SNR)"
done
}