mirror of
https://github.com/munin-monitoring/muninlite.git
synced 2024-09-28 22:01:29 +02:00
Compare commits
136 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3b6ef20dc1 | ||
|
c2b8d7315d | ||
|
f55b83fdbd | ||
|
a2f1745477 | ||
|
74927fc6e7 | ||
|
631beb931f | ||
|
d1e4d3ef7c | ||
|
32d4362888 | ||
|
1f147fcb1c | ||
|
954395aece | ||
|
f37e97fa9c | ||
|
fa0a661bb2 | ||
|
c9f4699c6a | ||
|
f8111b2d10 | ||
|
c0625af54c | ||
|
b2ca6a4b8a | ||
|
4c53449fa3 | ||
|
0ae0f9cdcb | ||
|
eef090a1ae | ||
|
111bd0ebb3 | ||
|
62230e900e | ||
|
0236ec69e2 | ||
|
b7ecc5699b | ||
|
c4044f749b | ||
|
389c22a0de | ||
|
00cfedfd92 | ||
|
1f6d07e52a | ||
|
5206847aa1 | ||
|
ebd0cca326 | ||
|
e6f5722a04 | ||
|
d889349332 | ||
|
4bc2b62610 | ||
|
8046268893 | ||
|
710334b615 | ||
|
670a871835 | ||
|
9d596643cc | ||
|
a0c555c2bd | ||
|
1b43f16454 | ||
|
aad298f892 | ||
|
884fea3ed1 | ||
|
bf738ea913 | ||
|
216c6ebd04 | ||
|
2ab81cd929 | ||
|
4e857e0a96 | ||
|
4b484f6f99 | ||
|
b039f7c1c8 | ||
|
6d05b016d3 | ||
|
53bc47cc13 | ||
|
f6adc90820 | ||
|
648f3c15d4 | ||
|
c63baf0461 | ||
|
0b06f673ab | ||
|
069a3ecb4d | ||
|
2503aa737b | ||
|
7eebaa7f62 | ||
|
8e433d9a38 | ||
|
a85fc3cb82 | ||
|
829f230b9b | ||
|
fe4c587c27 | ||
|
a4bb625812 | ||
|
e3103bdb6e | ||
|
44d1c8dc3a | ||
|
9cca1e479a | ||
|
a0d4d74f8d | ||
|
0662cfc7e8 | ||
|
6b09d74c9a | ||
|
b5d8f7931b | ||
|
60b16f4121 | ||
|
e439fd79a1 | ||
|
974b07a1af | ||
|
0600bbf113 | ||
|
94a695860d | ||
|
5190244c92 | ||
|
dc242d3631 | ||
|
14251d6791 | ||
|
c2108276eb | ||
|
281578664c | ||
|
b1230609dc | ||
|
02b2eb861e | ||
|
5de3df252e | ||
|
d1da0df1b2 | ||
|
f4518e5375 | ||
|
c547314f3d | ||
|
33bd18f7f7 | ||
|
0cf51803a3 | ||
|
936ac8199c | ||
|
160a767791 | ||
|
92eb719a8b | ||
|
0667b94d0f | ||
|
08e989b780 | ||
|
4e324b45a6 | ||
|
6e921753d6 | ||
|
c7a121f8fc | ||
|
806dc07f89 | ||
|
490da2c8a3 | ||
|
0c4e577e9a | ||
|
5f1d1b03b5 | ||
|
a3fde3c704 | ||
|
9748ebdcfb | ||
|
631e86156e | ||
|
b0e991d4d4 | ||
|
215abe08ae | ||
|
e4ef4eccea | ||
|
6dcd179e56 | ||
|
519a1c2ef9 | ||
|
38586372d2 | ||
|
ab2347f2ac | ||
|
eb5f13e9bd | ||
|
56bf90a6f8 | ||
|
b2366408f6 | ||
|
7b4f376daf | ||
|
f906a5f4da | ||
|
2073b97a6c | ||
|
44628e78cc | ||
|
3e0ecfe678 | ||
|
d9b1b1ad3f | ||
|
22468a04a1 | ||
|
306445b574 | ||
|
b241c4d9fa | ||
|
407be39cb4 | ||
|
53ac3745d6 | ||
|
0e1e1b6bbc | ||
|
7e464ae867 | ||
|
fc1c90b1a2 | ||
|
d31563a156 | ||
|
b3cafac597 | ||
|
9a8bc35de4 | ||
|
380a399a81 | ||
|
42963323c4 | ||
|
f397470d73 | ||
|
8eeb617f22 | ||
|
3b23188011 | ||
|
78f7079596 | ||
|
a18de9ac24 | ||
|
18304c2a4d | ||
|
61be8d19e2 |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
muninlite
|
||||||
|
releases/
|
@ -1,2 +0,0 @@
|
|||||||
munin-node
|
|
||||||
releases/
|
|
23
.travis.yml
Normal file
23
.travis.yml
Normal 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
|
2
CREDITS
2
CREDITS
@ -35,3 +35,5 @@ Kai Ove Gran <kaiove@humla.no>
|
|||||||
- post ini script (post-muninlite.ini) for floppyfw
|
- post ini script (post-muninlite.ini) for floppyfw
|
||||||
(http://pong.no/floppyfw/muninlite/)
|
(http://pong.no/floppyfw/muninlite/)
|
||||||
|
|
||||||
|
Jozsef Marton
|
||||||
|
- Patch to enable plugin directory
|
||||||
|
46
Changelog
46
Changelog
@ -1,46 +0,0 @@
|
|||||||
muninlite
|
|
||||||
|
|
||||||
Changelog:
|
|
||||||
|
|
||||||
1.0.1 - 1.0.1
|
|
||||||
|
|
||||||
Date: 2007-11-30
|
|
||||||
|
|
||||||
- Added ntpdate plugin
|
|
||||||
|
|
||||||
0.9.15 - 1.0.0
|
|
||||||
|
|
||||||
Date: 2007-06-20
|
|
||||||
|
|
||||||
- First major release (no changes)
|
|
||||||
|
|
||||||
0.9.14 - 0.9.15
|
|
||||||
|
|
||||||
Date: 2007-06-15
|
|
||||||
|
|
||||||
- Some documentations added
|
|
||||||
- SF#1736919 - Spike in if_ plugin hopefully fixed
|
|
||||||
|
|
||||||
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
116
Changelog.md
Normal 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"
|
119
Makefile
119
Makefile
@ -1,47 +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 ntpdate
|
$(TARGET_FILE): $(INPUT_FILE) $(PLUGIN_FILES) $(CONFIGURATION_FILE)
|
||||||
#PLUGINS=cpu if_ if_err_ load memory processes netstat uptime interrupts irqstats
|
@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/* munin-node.conf
|
.PHONY: help
|
||||||
@VERSION=$$(cat VERSION); \
|
help:
|
||||||
CONF=$$(grep -v '^#' munin-node.conf); \
|
@$(info Available targets:)
|
||||||
echo "Making munin-node for muninlite version $$VERSION"; \
|
@$(info all - assemble 'TARGET_FILE' ($(TARGET_FILE)))
|
||||||
PLSTR=""; \
|
@$(info clean - remove assembled 'TARGET_FILE' ($(TARGET_FILE)))
|
||||||
for PLGIN in $(PLUGINS); \
|
@$(info clean-all - remove old releases from 'DIST_DIR' ($(DIST_DIR)))
|
||||||
do \
|
@$(info dist - create release archive)
|
||||||
echo "Adding plugin $$PLGIN"; \
|
@$(info install - install the standalone shell script)
|
||||||
PLSTR=$$(echo "$$PLSTR"; grep -v '^#' plugins/$$PLGIN); \
|
@$(info help - show this overview)
|
||||||
done; \
|
@$(info lint - code style checks)
|
||||||
PLSTR=$$(echo "$$PLSTR" | sed -e 's/\\/\\\\/g' \
|
@$(info spelling - check spelling)
|
||||||
-e 's/\//\\\//g' \
|
@$(info test - run tests)
|
||||||
-e 's/\$$/\\$$/g'); \
|
|
||||||
perl -p -e \
|
|
||||||
"s/\@\@VERSION\@\@/$$VERSION/;s/\@\@CONF\@\@/$$CONF/;s/\@\@PLUGINS\@\@/$(PLUGINS)/;s/\@\@PLSTR\@\@/$$PLSTR/;" \
|
|
||||||
munin-node.in > munin-node
|
|
||||||
@chmod +x munin-node
|
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: $(TARGET_FILE)
|
||||||
|
|
||||||
all: munin-node
|
.PHONY: clean-node
|
||||||
|
|
||||||
clean-node:
|
clean-node:
|
||||||
@echo "Removing munin-node"
|
@echo "Removing $(TARGET_FILE)"
|
||||||
@rm -f munin-node
|
@rm -f "$(TARGET_FILE)"
|
||||||
|
|
||||||
clean-tgz:
|
.PHONY: clean-dist
|
||||||
@echo "Old releases"
|
clean-dist:
|
||||||
@rm -rf releases
|
@echo "Removing old releases"
|
||||||
|
@rm -rf "$(DIST_DIR)"
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
clean: clean-node
|
clean: clean-node
|
||||||
|
|
||||||
clean-all: clean-node clean-tgz
|
.PHONY: clean-all
|
||||||
|
clean-all: clean-node clean-dist
|
||||||
|
|
||||||
tgz: clean-node
|
$(TGZ_FILE):
|
||||||
@VERSION=$$(cat VERSION); \
|
@echo "Building $@ ..."
|
||||||
echo "Building release/muninlite-$$VERSION.tar.gz"; \
|
@mkdir -p "$(dir $(@))"
|
||||||
mkdir -p releases; \
|
git archive --prefix=muninlite-$(VERSION)/ --format=tar.gz --output "$@.tmp" HEAD
|
||||||
cp -ra . releases/muninlite-$$VERSION 2>/dev/null || true; \
|
mv "$@.tmp" "$@"
|
||||||
cd releases; \
|
|
||||||
rm -rf muninlite-$$VERSION/releases; \
|
$(TGZ_FILE_SIGNATURE): $(TGZ_FILE)
|
||||||
tar zcvf muninlite-$$VERSION.tar.gz muninlite-$$VERSION >/dev/null; \
|
gpg --armor --detach-sign --sign --local-user="$(SIGN_KEY_NAME)" "$<"
|
||||||
rm -rf muninlite-$$VERSION;
|
|
||||||
|
.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
171
README
@ -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
210
README.md
Normal 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
38
RELEASE_CHECKLIST.md
Normal 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)
|
@ -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
|
|
||||||
|
|
@ -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.
|
|
||||||
|
|
@ -1 +1 @@
|
|||||||
munin-node : 10.42.42.25
|
muninlite : 10.42.42.25
|
||||||
|
@ -1 +1 @@
|
|||||||
munin-node : ALL
|
muninlite : ALL
|
||||||
|
@ -1 +1 @@
|
|||||||
munin stream tcp nowait root /usr/local/bin/munin-node
|
munin stream tcp nowait root /usr/local/bin/muninlite
|
||||||
|
@ -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
|
||||||
|
@ -22,12 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
if [ -f /sbin/inetd ]; then
|
if [ -f /sbin/inetd ]; then
|
||||||
if grep "^lrrd" /etc/inetd.conf >/dev/null 2>&1; then
|
echo "munin stream tcp nowait root /usr/local/bin/muninlite" >> /etc/inetd.conf
|
||||||
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
|
|
||||||
PID=$(ps | grep -v grep | grep inetd | sed 's/^ \{1,\}//' | cut -d\ -f1)
|
PID=$(ps | grep -v grep | grep inetd | sed 's/^ \{1,\}//' | cut -d\ -f1)
|
||||||
if [ ! -z "$PID" ]; then
|
if [ ! -z "$PID" ]; then
|
||||||
echo "inetd already running.. restarting.."
|
echo "inetd already running.. restarting.."
|
||||||
|
@ -4,8 +4,8 @@ service munin
|
|||||||
protocol = tcp
|
protocol = tcp
|
||||||
wait = no
|
wait = no
|
||||||
user = root
|
user = root
|
||||||
group = root
|
group = root
|
||||||
only_from = 10.42.42.25
|
only_from = 10.42.42.25
|
||||||
server = /usr/local/bin/munin-node
|
server = /usr/local/bin/muninlite
|
||||||
disable = no
|
disable = no
|
||||||
}
|
}
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
#
|
|
||||||
NTP_PEER="ntp.pool.org";
|
|
109
munin-node.in
109
munin-node.in
@ -1,109 +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@@"
|
|
||||||
|
|
||||||
@@CONF@@
|
|
||||||
|
|
||||||
# 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 "\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
3
muninlite.conf
Normal 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
135
muninlite.in
Executable 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
|
37
plugins/cpu
37
plugins/cpu
@ -1,16 +1,17 @@
|
|||||||
config_cpu() {
|
config_cpu() {
|
||||||
extinfo=""
|
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"
|
extinfo="iowait irq softirq"
|
||||||
fi
|
fi
|
||||||
NCPU=$(($(grep '^cpu. ' /proc/stat | wc -l) - 1))
|
# shellcheck disable=SC2126
|
||||||
PERCENT=$(($NCPU * 100))
|
NCPU=$(grep '^cpu[0-9]\+ ' /proc/stat | wc -l)
|
||||||
|
PERCENT=$((NCPU * 100))
|
||||||
graphlimit=$PERCENT
|
graphlimit=$PERCENT
|
||||||
SYSWARNING=$(($PERCENT * 30 / 100))
|
SYSWARNING=$((PERCENT * 30 / 100))
|
||||||
SYSCRITICAL=$(($PERCENT * 50 / 100))
|
SYSCRITICAL=$((PERCENT * 50 / 100))
|
||||||
USRWARNING=$(($PERCENT * 80 / 100))
|
USRWARNING=$((PERCENT * 80 / 100))
|
||||||
echo "graph_title CPU usage"
|
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_args --base 1000 -r --lower-limit 0 --upper-limit $graphlimit"
|
||||||
echo "graph_vlabel %"
|
echo "graph_vlabel %"
|
||||||
echo "graph_scale no"
|
echo "graph_scale no"
|
||||||
@ -44,7 +45,7 @@ config_cpu() {
|
|||||||
echo "idle.max 5000"
|
echo "idle.max 5000"
|
||||||
echo "idle.type DERIVE"
|
echo "idle.type DERIVE"
|
||||||
echo "idle.info Idle CPU time"
|
echo "idle.info Idle CPU time"
|
||||||
if [ ! -z "$extinfo" ]; then
|
if [ -n "$extinfo" ]; then
|
||||||
echo "iowait.label iowait"
|
echo "iowait.label iowait"
|
||||||
echo "iowait.draw STACK"
|
echo "iowait.draw STACK"
|
||||||
echo "iowait.min 0"
|
echo "iowait.min 0"
|
||||||
@ -62,22 +63,22 @@ config_cpu() {
|
|||||||
echo "softirq.min 0"
|
echo "softirq.min 0"
|
||||||
echo "softirq.max 5000"
|
echo "softirq.max 5000"
|
||||||
echo "softirq.type DERIVE"
|
echo "softirq.type DERIVE"
|
||||||
echo "softirq.info CPU time spent handling "batched" interrupts"
|
echo "softirq.info CPU time spent handling 'batched' interrupts"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
fetch_cpu() {
|
fetch_cpu() {
|
||||||
extinfo=""
|
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"
|
extinfo="iowait irq softirq"
|
||||||
fi
|
fi
|
||||||
CINFO=$(grep '^cpu ' /proc/stat | cut -c6-)
|
CINFO=$(grep '^cpu ' /proc/stat | cut -c6-)
|
||||||
echo "user.value" $(echo "$CINFO" | cut -d\ -f1)
|
echo "user.value" "$(echo "$CINFO" | cut -d " " -f 1)"
|
||||||
echo "nice.value" $(echo "$CINFO" | cut -d\ -f2)
|
echo "nice.value" "$(echo "$CINFO" | cut -d " " -f 2)"
|
||||||
echo "system.value" $(echo "$CINFO" | cut -d\ -f3)
|
echo "system.value" "$(echo "$CINFO" | cut -d " " -f 3)"
|
||||||
echo "idle.value" $(echo "$CINFO" | cut -d\ -f4)
|
echo "idle.value" "$(echo "$CINFO" | cut -d " " -f 4)"
|
||||||
if [ ! -z "$extinfo" ]; then
|
if [ -n "$extinfo" ]; then
|
||||||
echo "iowait.value" $(echo "$CINFO" | cut -d\ -f5)
|
echo "iowait.value" "$(echo "$CINFO" | cut -d " " -f 5)"
|
||||||
echo "irq.value" $(echo "$CINFO" | cut -d\ -f6)
|
echo "irq.value" "$(echo "$CINFO" | cut -d " " -f 6)"
|
||||||
echo "softirq.value" $(echo "$CINFO" | cut -d\ -f7)
|
echo "softirq.value" "$(echo "$CINFO" | cut -d " " -f 7)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
16
plugins/df
16
plugins/df
@ -4,21 +4,19 @@ graph_args --upper-limit 100 -l 0
|
|||||||
graph_vlabel %
|
graph_vlabel %
|
||||||
graph_category disk
|
graph_category disk
|
||||||
graph_info This graph shows disk usage on the machine."
|
graph_info This graph shows disk usage on the machine."
|
||||||
for PART in $(df | sed '/\/[a-z0-9]*$/!d;s/.* \([a-z0-9\/]\{1,\}\)$/\1/g')
|
df -PT | grep '^/' | grep -vwE "$DF_IGNORE_FILESYSTEM_REGEX" | while read dev type blocks used avail pct mp
|
||||||
do
|
do
|
||||||
PINFO=$(df $PART | tail -1);
|
PNAME=$(clean_fieldname "$mp")
|
||||||
PNAME=$(echo $PINFO | cut -d\ -f1 | sed 's/\//_/g')
|
echo "$PNAME.label $mp"
|
||||||
echo "$PNAME.label $PART"
|
echo "$PNAME.info $dev -> $mp"
|
||||||
echo "$PNAME.info $PNAME -> $PART"
|
|
||||||
echo "$PNAME.warning 92"
|
echo "$PNAME.warning 92"
|
||||||
echo "$PNAME.critical 98"
|
echo "$PNAME.critical 98"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
fetch_df() {
|
fetch_df() {
|
||||||
for PART in $(df | sed '/\/[a-z0-9]*$/!d;s/.* \([a-z0-9\/]\{1,\}\)$/\1/g')
|
df -PT | grep '^/' | grep -vwE "$DF_IGNORE_FILESYSTEM_REGEX" | while read dev type blocks used avail pct mp
|
||||||
do
|
do
|
||||||
PINFO=$(df $PART | tail -1);
|
PNAME=$(clean_fieldname "$mp")
|
||||||
PNAME=$(echo $PINFO | cut -d\ -f1 | sed 's/\//_/g')
|
echo "$PNAME.value" "${pct%\%}"
|
||||||
echo "$PNAME.value" $(echo $PINFO | cut -f5 -d\ | sed -e 's/\%//g')
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
20
plugins/if_
20
plugins/if_
@ -1,6 +1,7 @@
|
|||||||
config_if() {
|
config_if() {
|
||||||
|
INTERFACE=$1
|
||||||
echo "graph_order down up"
|
echo "graph_order down up"
|
||||||
echo "graph_title $1 traffic"
|
echo "graph_title Interface $INTERFACE traffic"
|
||||||
echo "graph_args --base 1000"
|
echo "graph_args --base 1000"
|
||||||
echo "graph_vlabel bits in (-) / out (+) per \${graph_period}"
|
echo "graph_vlabel bits in (-) / out (+) per \${graph_period}"
|
||||||
echo "graph_category network"
|
echo "graph_category network"
|
||||||
@ -15,14 +16,17 @@ config_if() {
|
|||||||
echo "up.min 0"
|
echo "up.min 0"
|
||||||
echo "up.negative down"
|
echo "up.negative down"
|
||||||
echo "up.cdef up,8,*"
|
echo "up.cdef up,8,*"
|
||||||
if ethtool $1 >/dev/null 2>&1; then
|
if [ -n "$(which ethtool)" ] && [ -x "$(which ethtool)" ]; then
|
||||||
MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000))
|
MAX_MBPS=$(ethtool "$INTERFACE" 2>/dev/null | grep "Speed: [0-9]\+Mb/s$" | sed 's/[^0-9]//g')
|
||||||
echo "up.max $MAX"
|
if [ -n "$MAX_MBPS" ]; then
|
||||||
echo "down.max $MAX"
|
echo "up.max $((MAX_MBPS * 1024 * 1024))"
|
||||||
|
echo "down.max $((MAX_MBPS * 1024 * 1024))"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
fetch_if() {
|
fetch_if() {
|
||||||
IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
|
INTERFACE=$1
|
||||||
echo "down.value" $(echo $IINFO | cut -d\ -f1)
|
IINFO=$(grep "^ *$INTERFACE:" /proc/net/dev | cut -d ":" -f 2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
|
||||||
echo "up.value" $(echo $IINFO | cut -d\ -f9)
|
echo "down.value" "$(echo "$IINFO" | cut -d " " -f 1)"
|
||||||
|
echo "up.value" "$(echo "$IINFO" | cut -d " " -f 9)"
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
config_if_err() {
|
config_if_err() {
|
||||||
|
INTERFACE=$1
|
||||||
echo "graph_order rcvd trans"
|
echo "graph_order rcvd trans"
|
||||||
echo "graph_title $1 errors"
|
echo "graph_title Interface $INTERFACE errors"
|
||||||
echo "graph_args --base 1000"
|
echo "graph_args --base 1000"
|
||||||
echo "graph_vlabel packets in (-) / out (+) per \${graph_period}"
|
echo "graph_vlabel packets in (-) / out (+) per \${graph_period}"
|
||||||
echo "graph_category network"
|
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.label packets"
|
||||||
echo "rcvd.type COUNTER"
|
echo "rcvd.type COUNTER"
|
||||||
echo "rcvd.graph no"
|
echo "rcvd.graph no"
|
||||||
@ -15,7 +16,8 @@ config_if_err() {
|
|||||||
echo "trans.warning 1"
|
echo "trans.warning 1"
|
||||||
}
|
}
|
||||||
fetch_if_err() {
|
fetch_if_err() {
|
||||||
IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
|
INTERFACE=$1
|
||||||
echo "rcvd.value" $(echo $IINFO | cut -d\ -f3)
|
IINFO=$(grep "^ *$INTERFACE:" /proc/net/dev | cut -d ":" -f 2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
|
||||||
echo "trans.value" $(echo $IINFO | cut -d\ -f11)
|
echo "rcvd.value" "$(echo "$IINFO" | cut -d " " -f 3)"
|
||||||
|
echo "trans.value" "$(echo "$IINFO" | cut -d " " -f 11)"
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,6 @@ config_interrupts() {
|
|||||||
}
|
}
|
||||||
fetch_interrupts() {
|
fetch_interrupts() {
|
||||||
IINFO=$(cat /proc/stat)
|
IINFO=$(cat /proc/stat)
|
||||||
echo "ctx.value" $(echo "$IINFO" | grep "^ctxt" | cut -d\ -f2)
|
echo "ctx.value" "$(echo "$IINFO" | grep "^ctxt" | cut -d " " -f 2)"
|
||||||
echo "intr.value" $(echo "$IINFO" | grep "^intr" | cut -d\ -f2)
|
echo "intr.value" "$(echo "$IINFO" | grep "^intr" | cut -d " " -f 2)"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
config_irqstats() {
|
config_irqstats() {
|
||||||
echo "graph_title Individual interrupts
|
echo "graph_title Individual interrupts
|
||||||
graph_args --base 1000 -l 0;
|
graph_args --base 1000 -l 0
|
||||||
graph_vlabel interrupts / \${graph_period}
|
graph_vlabel interrupts / \${graph_period}
|
||||||
graph_category system"
|
graph_category system"
|
||||||
CPUS=$(grep 'CPU[0-9]' /proc/interrupts | wc -w)
|
CPUS=$(grep 'CPU[0-9]' /proc/interrupts | wc -w)
|
||||||
@ -8,8 +8,8 @@ graph_category system"
|
|||||||
for ID in $(echo "$IINFO" | cut -d: -f1)
|
for ID in $(echo "$IINFO" | cut -d: -f1)
|
||||||
do
|
do
|
||||||
IDL=$(echo "$IINFO" | grep "^$ID:")
|
IDL=$(echo "$IINFO" | grep "^$ID:")
|
||||||
INFO=$(eval "echo \"$IDL\" | cut -d\ -f$((3+$CPUS))-")
|
INFO=$(eval "echo \"$IDL\" | cut -d ' ' -f '$((3 + CPUS))-'")
|
||||||
if [ "$INFO" = "" ]; then
|
if [ -z "$INFO" ]; then
|
||||||
echo "i$ID.label $ID"
|
echo "i$ID.label $ID"
|
||||||
else
|
else
|
||||||
echo "i$ID.label $INFO"
|
echo "i$ID.label $INFO"
|
||||||
@ -25,11 +25,13 @@ fetch_irqstats() {
|
|||||||
for ID in $(echo "$IINFO" | cut -d: -f1)
|
for ID in $(echo "$IINFO" | cut -d: -f1)
|
||||||
do
|
do
|
||||||
IDL=$(echo "$IINFO" | grep "^$ID:")
|
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
|
VALUE=0
|
||||||
for VAL in $VALS;
|
for VAL in $VALS;
|
||||||
do
|
do
|
||||||
VALUE=$(($VALUE + $VAL))
|
if [ "$VAL" -eq "$VAL" ] 2> /dev/null; then
|
||||||
|
VALUE=$((VALUE + VAL))
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
echo "i$ID.value $VALUE"
|
echo "i$ID.value $VALUE"
|
||||||
done
|
done
|
||||||
|
@ -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."
|
load.info Average load for the five minutes."
|
||||||
}
|
}
|
||||||
fetch_load() {
|
fetch_load() {
|
||||||
echo "load.value" $(cut -f2 -d\ /proc/loadavg)
|
echo "load.value" "$(cut -d " " -f 2 /proc/loadavg)"
|
||||||
}
|
}
|
||||||
|
120
plugins/memory
120
plugins/memory
@ -1,5 +1,5 @@
|
|||||||
config_memory() {
|
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)
|
MEMTOTAL=$(echo "$MINFO" | grep "^MemTotal:" | cut -d\ -f2)
|
||||||
PAGETABLES=$(echo "$MINFO" | grep "^PageTables:" | cut -d\ -f2)
|
PAGETABLES=$(echo "$MINFO" | grep "^PageTables:" | cut -d\ -f2)
|
||||||
SWAPCACHED=$(echo "$MINFO" | grep "^SwapCached:" | 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)
|
ACTIVECACHE=$(echo "$MINFO" | grep "^ActiveCache:" | cut -d\ -f2)
|
||||||
INACTIVE=$(echo "$MINFO" | grep "^Inactive:" | cut -d\ -f2)
|
INACTIVE=$(echo "$MINFO" | grep "^Inactive:" | cut -d\ -f2)
|
||||||
INACTDIRTY=$(echo "$MINFO" | grep "^Inact_dirty:" | 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)
|
INACTCLEAN=$(echo "$MINFO" | grep "^Inact_clean:" | cut -d\ -f2)
|
||||||
|
|
||||||
GRAPH_ORDER="apps";
|
GRAPH_ORDER="apps";
|
||||||
test "$PAGETABLES" != "" && GRAPH_ORDER="$GRAPH_ORDER page_tables"
|
[ -n "$PAGETABLES" ] && GRAPH_ORDER="$GRAPH_ORDER page_tables"
|
||||||
test "$SWAPCACHED" != "" && GRAPH_ORDER="$GRAPH_ORDER swap_cache"
|
[ -n "$SWAPCACHED" ] && GRAPH_ORDER="$GRAPH_ORDER swap_cache"
|
||||||
test "$VMALLOCUSED" != "" && GRAPH_ORDER="$GRAPH_ORDER vmalloc_used"
|
[ -n "$VMALLOCUSED" ] && GRAPH_ORDER="$GRAPH_ORDER vmalloc_used"
|
||||||
test "$SLAB" != "" && GRAPH_ORDER="$GRAPH_ORDER slab"
|
[ -n "$SLAB" ] && GRAPH_ORDER="$GRAPH_ORDER slab"
|
||||||
GRAPH_ORDER="$GRAPH_ORDER cached buffers free swap"
|
GRAPH_ORDER="$GRAPH_ORDER cached buffers free swap"
|
||||||
|
|
||||||
echo "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit $MEMTOTAL"
|
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.label unused"
|
||||||
echo "free.draw STACK"
|
echo "free.draw STACK"
|
||||||
echo "free.info Wasted memory. Memory that is not used for anything at all."
|
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.label slab_cache"
|
||||||
echo "slab.draw STACK"
|
echo "slab.draw STACK"
|
||||||
echo "slab.info Memory used by the kernel (major users are caches like inode, dentry, etc)."
|
echo "slab.info Memory used by the kernel (major users are caches like inode, dentry, etc)."
|
||||||
fi
|
fi
|
||||||
if [ "$SWAPCACHED" != "" ]; then
|
if [ -n "$SWAPCACHED" ]; then
|
||||||
echo "swap_cache.label swap_cache"
|
echo "swap_cache.label swap_cache"
|
||||||
echo "swap_cache.draw STACK"
|
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."
|
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
|
fi
|
||||||
if [ "$PAGETABLES" != "" ]; then
|
if [ -n "$PAGETABLES" ]; then
|
||||||
echo "page_tables.label page_tables"
|
echo "page_tables.label page_tables"
|
||||||
echo "page_tables.draw STACK"
|
echo "page_tables.draw STACK"
|
||||||
echo "page_tables.info Memory used to map between virtual and physical memory addresses.\n"
|
echo "page_tables.info Memory used to map between virtual and physical memory addresses.\n"
|
||||||
fi
|
fi
|
||||||
if [ "$VMALLOCUSED" != "" ]; then
|
if [ -n "$VMALLOCUSED" ]; then
|
||||||
echo "vmalloc_used.label vmalloc_used"
|
echo "vmalloc_used.label vmalloc_used"
|
||||||
echo "vmalloc_used.draw STACK"
|
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
|
fi
|
||||||
if [ "$COMMITTEDAS" != "" ]; then
|
if [ -n "$COMMITTEDAS" ]; then
|
||||||
echo "committed.label committed"
|
echo "committed.label committed"
|
||||||
echo "committed.draw LINE2"
|
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."
|
echo "committed.info The amount of memory that would be used if all the memory that's been allocated were to be used."
|
||||||
fi
|
fi
|
||||||
if [ "$MAPPED" != "" ]; then
|
if [ -n "$MAPPED" ]; then
|
||||||
echo "mapped.label mapped"
|
echo "mapped.label mapped"
|
||||||
echo "mapped.draw LINE2"
|
echo "mapped.draw LINE2"
|
||||||
echo "mapped.info All mmap()ed pages."
|
echo "mapped.info All mmap()ed pages."
|
||||||
fi
|
fi
|
||||||
if [ "$ACTIVE" != "" ]; then
|
if [ -n "$ACTIVE" ]; then
|
||||||
echo "active.label active"
|
echo "active.label active"
|
||||||
echo "active.draw LINE2"
|
echo "active.draw LINE2"
|
||||||
echo "active.info Memory recently used. Not reclaimed unless absolutely necessary."
|
echo "active.info Memory recently used. Not reclaimed unless absolutely necessary."
|
||||||
fi
|
fi
|
||||||
if [ "$ACTIVEANON" != "" ]; then
|
if [ -n "$ACTIVEANON" ]; then
|
||||||
echo "active_anon.label active_anon"
|
echo "active_anon.label active_anon"
|
||||||
echo "active_anon.draw LINE1"
|
echo "active_anon.draw LINE1"
|
||||||
fi
|
fi
|
||||||
if [ "$ACTIVECACHE" != "" ]; then
|
if [ -n "$ACTIVECACHE" ]; then
|
||||||
echo "active_cache.label active_cache"
|
echo "active_cache.label active_cache"
|
||||||
echo "active_cache.draw LINE1"
|
echo "active_cache.draw LINE1"
|
||||||
fi
|
fi
|
||||||
if [ "$INACTIVE" != "" ]; then
|
if [ -n "$INACTIVE" ]; then
|
||||||
echo "inactive.label inactive"
|
echo "inactive.label inactive"
|
||||||
echo "inactive.draw LINE2"
|
echo "inactive.draw LINE2"
|
||||||
echo "inactive.info Memory not currently used."
|
echo "inactive.info Memory not currently used."
|
||||||
fi
|
fi
|
||||||
if [ "$INACTDIRTY" != "" ]; then
|
if [ -n "$INACTDIRTY" ]; then
|
||||||
echo "inact_dirty.label inactive_dirty"
|
echo "inact_dirty.label inactive_dirty"
|
||||||
echo "inact_dirty.draw LINE1"
|
echo "inact_dirty.draw LINE1"
|
||||||
echo "inact_dirty.info Memory not currently used, but in need of being written to disk."
|
echo "inact_dirty.info Memory not currently used, but in need of being written to disk."
|
||||||
fi
|
fi
|
||||||
if [ "$INACTLAUNDRY" != "" ]; then
|
if [ -n "$INACTLAUNDRY" ]; then
|
||||||
echo "inact_laundry.label inactive_laundry"
|
echo "inact_laundry.label inactive_laundry"
|
||||||
echo "inact_laundry.draw LINE1"
|
echo "inact_laundry.draw LINE1"
|
||||||
fi
|
fi
|
||||||
if [ "$INACTCLEAN" != "" ]; then
|
if [ -n "$INACTCLEAN" ]; then
|
||||||
echo "inact_clean.label inactive_clean"
|
echo "inact_clean.label inactive_clean"
|
||||||
echo "inact_clean.draw LINE1"
|
echo "inact_clean.draw LINE1"
|
||||||
echo "inact_clean.info Memory not currently used."
|
echo "inact_clean.info Memory not currently used."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
fetch_memory() {
|
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)
|
MEMTOTAL=$(echo "$MINFO" | grep "^MemTotal:" | cut -d\ -f2)
|
||||||
MEMFREE=$(echo "$MINFO" | grep "^MemFree:" | cut -d\ -f2)
|
MEMFREE=$(echo "$MINFO" | grep "^MemFree:" | cut -d\ -f2)
|
||||||
BUFFERS=$(echo "$MINFO" | grep "^Buffers:" | 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)
|
ACTIVECACHE=$(echo "$MINFO" | grep "^ActiveCache:" | cut -d\ -f2)
|
||||||
INACTIVE=$(echo "$MINFO" | grep "^Inactive:" | cut -d\ -f2)
|
INACTIVE=$(echo "$MINFO" | grep "^Inactive:" | cut -d\ -f2)
|
||||||
INACTDIRTY=$(echo "$MINFO" | grep "^Inact_dirty:" | 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)
|
INACTCLEAN=$(echo "$MINFO" | grep "^Inact_clean:" | cut -d\ -f2)
|
||||||
APPS=$(($MEMTOTAL - $MEMFREE - $BUFFERS - $CACHED))
|
APPS=$((MEMTOTAL - MEMFREE - BUFFERS - CACHED))
|
||||||
SWAP=$(($SWAP_TOTAL - $SWAP_FREE))
|
SWAP=$((SWAP_TOTAL - SWAP_FREE))
|
||||||
echo "buffers.value" $(($BUFFERS * 1024))
|
echo "buffers.value" $((BUFFERS * 1024))
|
||||||
echo "swap.value" $(($SWAP * 1024))
|
echo "swap.value" $((SWAP * 1024))
|
||||||
echo "cached.value" $(($CACHED * 1024))
|
echo "cached.value" $((CACHED * 1024))
|
||||||
echo "free.value" $(($MEMFREE * 1024))
|
echo "free.value" $((MEMFREE * 1024))
|
||||||
if [ "$SLAB" != "" ]; then
|
if [ -n "$SLAB" ]; then
|
||||||
echo "slab.value" $(($SLAB * 1024))
|
echo "slab.value" $((SLAB * 1024))
|
||||||
APPS=$(($APPS - $SLAB))
|
APPS=$((APPS - SLAB))
|
||||||
fi
|
fi
|
||||||
if [ "$SWAPCACHED" != "" ]; then
|
if [ -n "$SWAPCACHED" ]; then
|
||||||
echo "swap_cache.value" $(($SWAPCACHED * 1024))
|
echo "swap_cache.value" $((SWAPCACHED * 1024))
|
||||||
APPS=$(($APPS - $SWAPCACHED))
|
APPS=$((APPS - SWAPCACHED))
|
||||||
fi
|
fi
|
||||||
if [ "$PAGETABLES" != "" ]; then
|
if [ -n "$PAGETABLES" ]; then
|
||||||
echo "page_tables.value" $(($PAGETABLES * 1024))
|
echo "page_tables.value" $((PAGETABLES * 1024))
|
||||||
APPS=$(($APPS - $PAGETABLES))
|
APPS=$((APPS - PAGETABLES))
|
||||||
fi
|
fi
|
||||||
if [ "$VMALLOCUSED" != "" ]; then
|
if [ -n "$VMALLOCUSED" ]; then
|
||||||
echo "vmalloc_used.value" $(($VMALLOCUSED * 1024))
|
echo "vmalloc_used.value" $((VMALLOCUSED * 1024))
|
||||||
APPS=$(($APPS - $VMALLOCUSED))
|
APPS=$((APPS - VMALLOCUSED))
|
||||||
fi
|
fi
|
||||||
if [ "$COMMITTEDAS" != "" ]; then
|
if [ -n "$COMMITTEDAS" ]; then
|
||||||
echo "committed.value" $(($COMMITTEDAS * 1024))
|
echo "committed.value" $((COMMITTEDAS * 1024))
|
||||||
fi
|
fi
|
||||||
if [ "$MAPPED" != "" ]; then
|
if [ -n "$MAPPED" ]; then
|
||||||
echo "mapped.value" $(($MAPPED * 1024))
|
echo "mapped.value" $((MAPPED * 1024))
|
||||||
fi
|
fi
|
||||||
if [ "$ACTIVE" != "" ]; then
|
if [ -n "$ACTIVE" ]; then
|
||||||
echo "active.value" $(($ACTIVE * 1024))
|
echo "active.value" $((ACTIVE * 1024))
|
||||||
fi
|
fi
|
||||||
if [ "$ACTIVEANON" != "" ]; then
|
if [ -n "$ACTIVEANON" ]; then
|
||||||
echo "active_anon.value" $(($ACTIVEANON * 1024))
|
echo "active_anon.value" $((ACTIVEANON * 1024))
|
||||||
fi
|
fi
|
||||||
if [ "$ACTIVECACHE" != "" ]; then
|
if [ -n "$ACTIVECACHE" ]; then
|
||||||
echo "active_cache.value" $(($ACTIVECACHE * 1024))
|
echo "active_cache.value" $((ACTIVECACHE * 1024))
|
||||||
fi
|
fi
|
||||||
if [ "$INACTIVE" != "" ]; then
|
if [ -n "$INACTIVE" ]; then
|
||||||
echo "inactive.value" $(($INACTIVE * 1024))
|
echo "inactive.value" $((INACTIVE * 1024))
|
||||||
fi
|
fi
|
||||||
if [ "$INACTDIRTY" != "" ]; then
|
if [ -n "$INACTDIRTY" ]; then
|
||||||
echo "inact_dirty.value" $(($INACTDIRTY * 1024))
|
echo "inact_dirty.value" $((INACTDIRTY * 1024))
|
||||||
fi
|
fi
|
||||||
if [ "$INACTLAUNDRY" != "" ]; then
|
if [ -n "$INACTLAUNDRY" ]; then
|
||||||
echo "inact_laundry.value" $(($INACTLAUNDRY * 1024))
|
echo "inact_laundry.value" $((INACTLAUNDRY * 1024))
|
||||||
fi
|
fi
|
||||||
if [ "$INACTCLEAN" != "" ]; then
|
if [ -n "$INACTCLEAN" ]; then
|
||||||
echo "inact_clean.value" $(($INACTCLEAN * 1024))
|
echo "inact_clean.value" $((INACTCLEAN * 1024))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "apps.value" $(($APPS * 1024))
|
echo "apps.value" $((APPS * 1024))
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,7 @@ config_netstat() {
|
|||||||
echo "graph_vlabel active connections"
|
echo "graph_vlabel active connections"
|
||||||
echo "graph_category network"
|
echo "graph_category network"
|
||||||
echo "graph_period second"
|
echo "graph_period second"
|
||||||
echo "graph_info This graph shows the TCP activity of all the network interfac
|
echo "graph_info This graph shows the TCP activity of all the network interfaces combined."
|
||||||
es combined."
|
|
||||||
echo "active.label active"
|
echo "active.label active"
|
||||||
echo "active.type DERIVE"
|
echo "active.type DERIVE"
|
||||||
echo "active.max 50000"
|
echo "active.max 50000"
|
||||||
@ -33,9 +32,9 @@ es combined."
|
|||||||
}
|
}
|
||||||
fetch_netstat() {
|
fetch_netstat() {
|
||||||
NINFO=$(netstat -s | sed 's/ \{1,\}/ /g')
|
NINFO=$(netstat -s | sed 's/ \{1,\}/ /g')
|
||||||
echo "active.value" $(echo "$NINFO" | grep "active connections" | 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\ -f2)
|
echo "passive.value" "$(echo "$NINFO" | grep "passive connection" | cut -d " " -f 2)"
|
||||||
echo "failed.value" $(echo "$NINFO" | grep "failed connection" | cut -d\ -f2)
|
echo "failed.value" "$(echo "$NINFO" | grep "failed connection" | cut -d " " -f 2)"
|
||||||
echo "resets.value" $(echo "$NINFO" | grep "connection resets" | cut -d\ -f2)
|
echo "resets.value" "$(echo "$NINFO" | grep "connection resets" | cut -d " " -f 2)"
|
||||||
echo "established.value" $(echo "$NINFO" | grep "connections established" | cut -d\ -f2)
|
echo "established.value" "$(echo "$NINFO" | grep "connections established" | cut -d " " -f 2)"
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
config_ntpdate() {
|
config_ntpdate() {
|
||||||
echo "graph_title NTP offset and dealy to peer $NTP_PEER"
|
echo "graph_title NTP offset and delay to peer $NTP_PEER"
|
||||||
echo "graph_args --base 1000 --vertical-label msec"
|
echo "graph_args --base 1000 --vertical-label msec"
|
||||||
|
echo "graph_category time"
|
||||||
echo "offset.label Offset"
|
echo "offset.label Offset"
|
||||||
echo "offset.draw LINE2"
|
|
||||||
echo "delay.label Delay"
|
echo "delay.label Delay"
|
||||||
echo "delay.draw LINE2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_ntpdate() {
|
fetch_ntpdate() {
|
||||||
NTPDATE="/usr/sbin/ntpdate"
|
NTPDATE="/usr/sbin/ntpdate"
|
||||||
DATA=(0 0)
|
OFFSET=0
|
||||||
if [ "$NTP_PEER" != "" ]; then
|
DELAY=0
|
||||||
if [ -x "$NTPDATE" ]; then
|
if [ -n "$NTP_PEER" ] && [ -x "$NTPDATE" ]; then
|
||||||
DATA=($($NTPDATE -q $NTP_PEER | awk '/^server.*offset/{gsub(/,/,"");printf "%s %s", ($6*1000), ($8*1000);}'))
|
DATA=$("$NTPDATE" -q "$NTP_PEER" | awk '/^server.*offset/{gsub(/,/,""); printf "%s %s", ($6*1000), ($8*1000); exit;}')
|
||||||
fi
|
OFFSET=$(echo "$DATA" | cut -d " " -f 1)
|
||||||
|
DELAY=$(echo "$DATA" | cut -d " " -f 2)
|
||||||
fi
|
fi
|
||||||
echo "offset.value "${DATA[0]}
|
echo "offset.value $OFFSET"
|
||||||
echo "delay.value "${DATA[1]}
|
echo "delay.value $DELAY"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
0
plugins/plugindir_
Normal file
0
plugins/plugindir_
Normal file
@ -5,9 +5,8 @@ config_processes() {
|
|||||||
echo "graph_category processes"
|
echo "graph_category processes"
|
||||||
echo "graph_info This graph shows the number of processes in the system."
|
echo "graph_info This graph shows the number of processes in the system."
|
||||||
echo "processes.label processes"
|
echo "processes.label processes"
|
||||||
echo "processes.draw LINE2"
|
|
||||||
echo "processes.info The current number of processes."
|
echo "processes.info The current number of processes."
|
||||||
}
|
}
|
||||||
fetch_processes() {
|
fetch_processes() {
|
||||||
echo "processes.value" $(echo /proc/[0-9]* | wc -w)
|
echo "processes.value" "$(echo /proc/[0-9]* | wc -w)"
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,11 @@ config_swap() {
|
|||||||
fetch_swap() {
|
fetch_swap() {
|
||||||
if [ -f /proc/vmstat ]; then
|
if [ -f /proc/vmstat ]; then
|
||||||
SINFO=$(cat /proc/vmstat)
|
SINFO=$(cat /proc/vmstat)
|
||||||
echo "swap_in.value" $(echo "$SINFO" | grep "^pswpin" | 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" | grep "^pswpout" | cut -d\ -f2)
|
echo "swap_out.value" "$(echo "$SINFO" | awk 'BEGIN { result="U"; } { if ($1 == "pswpout") result=$2; } END { print(result); }')"
|
||||||
else
|
else
|
||||||
SINFO=$(grep "^swap" /proc/stat)
|
SINFO=$(grep "^swap" /proc/stat)
|
||||||
echo "swap_in.value" $(echo "$SINFO" | cut -d\ -f2)
|
echo "swap_in.value" "$(echo "$SINFO" | cut -d " " -f 2)"
|
||||||
echo "swap_out.value" $(echo "$SINFO" | cut -d\ -f3)
|
echo "swap_out.value" "$(echo "$SINFO" | cut -d " " -f 3)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ config_uptime() {
|
|||||||
echo "graph_title Uptime"
|
echo "graph_title Uptime"
|
||||||
echo "graph_args --base 1000 -l 0 "
|
echo "graph_args --base 1000 -l 0 "
|
||||||
echo "graph_vlabel uptime in days"
|
echo "graph_vlabel uptime in days"
|
||||||
|
echo "graph_category system"
|
||||||
echo "uptime.label uptime"
|
echo "uptime.label uptime"
|
||||||
echo "uptime.draw AREA"
|
echo "uptime.draw AREA"
|
||||||
echo "uptime.cdef uptime,86400,/"
|
|
||||||
}
|
}
|
||||||
fetch_uptime() {
|
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
38
plugins/wireless
Normal 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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user