From fdbfa2c9036f7f9aabe746f7384675f88887339a Mon Sep 17 00:00:00 2001 From: jolan78 Date: Mon, 10 Apr 2017 17:04:44 +0200 Subject: [PATCH 1/3] dspam_ : minor doc fix --- plugins/dspam/dspam_ | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/dspam/dspam_ b/plugins/dspam/dspam_ index eed80c55..a4b4e882 100755 --- a/plugins/dspam/dspam_ +++ b/plugins/dspam/dspam_ @@ -61,7 +61,7 @@ EXAMPLES and USAGE for details). Link this plugin to /etc/munin/plugins/ and restart the munin-node. The link should be in the format: dspam__, where: - graph - One of: accuracy, processed, processed_abs. + graph - One of: accuracy, processed, absprocessed. target - The uid that DSPAM generates in dspam_stats output, but converted to Munin internal name format. Normally this means that non-alphabetic and non-numeral characters @@ -88,7 +88,7 @@ The plugin supports the following graph types: numbers are stacked, making the height of the column display the increase of processed messages over time. - processed - Shows the same data as dspam_processed_abs_, but as + processed - Shows the same data as dspam_absprocessed_, but as percentage of the total amount of processed messages, making it clear to see how the amounts of classified messages are divided. From a27374ac4b9f199a34537e4715d233b02e90ae46 Mon Sep 17 00:00:00 2001 From: jolan78 Date: Mon, 10 Apr 2017 17:17:51 +0200 Subject: [PATCH 2/3] dspam_ : remove lock if previous execution failed --- plugins/dspam/dspam_ | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/dspam/dspam_ b/plugins/dspam/dspam_ index a4b4e882..c16ddfe5 100755 --- a/plugins/dspam/dspam_ +++ b/plugins/dspam/dspam_ @@ -211,7 +211,16 @@ file_is_locked() { local file=$1 local lock=$1.lock - [ -f $lock ] && debug file $file is locked && return 0 # EX_OK + if [ -f "$lock" ];then + debug file $file is locked + local pid=$(cat "$lock") + if ps h -p "$pid" -o comm=|grep -q dspam_; then + return 0 # EX_OK + else + debug lock for file $file is no longer valid + file_remove_lock $file + fi + fi debug file $file is not locked return 69 # EX_UNAVAILABLE } From 5d346e981b0d9a67e58b4a4b4b7256a884d29635 Mon Sep 17 00:00:00 2001 From: jolan78 Date: Mon, 10 Apr 2017 17:23:00 +0200 Subject: [PATCH 3/3] dspam_ : new graph relprocessed --- plugins/dspam/dspam_ | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/plugins/dspam/dspam_ b/plugins/dspam/dspam_ index c16ddfe5..e429e625 100755 --- a/plugins/dspam/dspam_ +++ b/plugins/dspam/dspam_ @@ -61,7 +61,7 @@ EXAMPLES and USAGE for details). Link this plugin to /etc/munin/plugins/ and restart the munin-node. The link should be in the format: dspam__, where: - graph - One of: accuracy, processed, absprocessed. + graph - One of: accuracy, processed, absprocessed, relprocessed. target - The uid that DSPAM generates in dspam_stats output, but converted to Munin internal name format. Normally this means that non-alphabetic and non-numeral characters @@ -88,6 +88,10 @@ The plugin supports the following graph types: numbers are stacked, making the height of the column display the increase of processed messages over time. + relprocessed - Shows the same data as dspam_absprocessed_, but as + messages per minute instead of ever-growing asolute + values. + processed - Shows the same data as dspam_absprocessed_, but as percentage of the total amount of processed messages, making it clear to see how the amounts of classified @@ -340,6 +344,7 @@ print_suggest() { echo accuracy_ALL echo processed_ALL echo absprocessed_ALL + echo relprocessed_ALL } # @@ -438,7 +443,7 @@ print_config() { echo nc.draw AREASTACK ;; - absprocessed) + *processed) if [ -n "$pattern" ]; then debug env.pattern was set, so use it: $pattern local uid=$description @@ -461,26 +466,34 @@ print_config() { echo "graph_title Processed messages for $uid" echo graph_category spamfilter echo graph_args --base 1000 - echo graph_vlabel Messages + [ "$graph" = absprocessed ] && echo graph_vlabel Messages + [ "$graph" = relprocessed ] && echo graph_vlabel Messages / minute + [ "$graph" = relprocessed ] && echo graph_period minute echo graph_total Total echo "graph_info This graph shows the messages that DSPAM processed for $uid ($uid_count uids). Messages are divided in the following categories: true positives/negatives, false positives/negatives, and corpusfed ham/spam." echo tp.label True positives echo tp.info Spam messages correctly classified as spam. + [ "$graph" = relprocessed ] && echo tp.type DERIVE echo tp.draw AREASTACK echo tn.label True negatives echo tn.info Ham messages correctly classified as ham. + [ "$graph" = relprocessed ] && echo tn.type DERIVE echo tn.draw AREASTACK echo fp.label False positives echo fp.info Ham messages incorrectly classified as spam, but corrected by the user. + [ "$graph" = relprocessed ] && echo fp.type DERIVE echo fp.draw AREASTACK echo fn.label False negatives echo fn.info Spam messages incorrectly classified as ham, but corrected by the user. + [ "$graph" = relprocessed ] && echo fn.type DERIVE echo fn.draw AREASTACK echo sc.label Corpusfed spam echo sc.info Spam messages from a collected corpus for training purposes. + [ "$graph" = relprocessed ] && echo sc.type DERIVE echo sc.draw AREASTACK echo nc.label Corpusfed ham echo nc.info Ham messages from a collected corpus for training purposes. + [ "$graph" = relprocessed ] && echo nc.type DERIVE echo nc.draw AREASTACK ;; @@ -569,7 +582,7 @@ print_fetch() { echo nc.value $(abs2perc $all_nc $total) ;; - absprocessed) + *processed) if [ -n "$pattern" ]; then debug env.pattern was set, so use it: $pattern continue