Check the difference between the results of the command. diff-detector is written to work as a mackerel check plugin.
% ./diff-detector -h
Usage:
diff-detector [OPTIONS] -- command args1 args2
Application Options:
--identifier= indetify a file store the command result with given string
-w, --warn Set the error level to warning
-v, --version Show version
Help Options:
-h, --help Show this help message
% echo $(date) > date.txt
% ./diff-detector -- cat date.txt
diff-detector OK: first time execution command: 'cat date.txt'
% ./diff-detector -- cat date.txt
diff-detector OK: no difference: ```Wed Aug 12 00:39:23 JST 2020```
% echo $(date) > date.txt
% ./diff-detector -- cat date.txt
diff-detector CRITICAL: found difference: ```@@ -1 +1 @@
-Wed Aug 12 00:39:23 JST 2020
+Wed Aug 12 00:39:40 JST 2020```
[plugin.checks.uname-changed]
command = "/usr/local/bin/diff-detector -- uname -a"
[plugin.checks.passwd-changed]
command = "/usr/local/bin/diff-detector -- cat /etc/passwd"
Please download release page