From c3d5e109c00ba949a493f8b628e7cbc04a20f35b Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Sat, 3 Sep 2016 21:04:25 +1000 Subject: [PATCH] [file_length_] A versatile plugin to count the lines in specified files Signed-off-by: Olivier Mehani --- plugins/system/file_length_ | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 plugins/system/file_length_ diff --git a/plugins/system/file_length_ b/plugins/system/file_length_ new file mode 100755 index 00000000..7aff3e5e --- /dev/null +++ b/plugins/system/file_length_ @@ -0,0 +1,63 @@ +#!/bin/bash + +: << =cut + +=head1 NAME + +file_length_ - Plugin to monitor the length of specified files + +Useful for things such as lists (white, black, user, ...). + +=head1 CONFIGURATION + + [file_length_IDENTIFIER] + env.files FILEPATHGLOB1 FILEPATHGLOB2 ... + env.category DEFAULTS_TO_system + env.title OPTIONAL_TITLE + +=head1 AUTHOR + +Olivier Mehani (based on disk/log_sizes) + +=head1 LICENSE + +GPLv2 + +=head1 MAGIC MARKERS + + #%# family=auto + #%# capabilities=autoconf suggest + +=cut + +#NAME=`echo $0 | sed 's/.*_//'` +NAME=${0#*_} +TITLE=${title:-File lengths for $NAME} +CATEGORY=${category:-system} + +FILES=${files:-/var/log/messages} +FILES=$(echo $(ls $FILES)) + +if [ "$1" = "config" ] ; then + cat <