source: trunk/munin-plugins/cms_spip_count @ 593

Last change on this file since 593 was 239, checked in by sebas, 15 years ago

plugin munin para tener la cantidad de spip instalados

  • Property svn:executable set to *
File size: 1.0 KB
RevLine 
[239]1#!/bin/sh
2#
3# Plugin to monitor the number of installed Spip instances
4#
5# Parameters:
6#       
7#       config
8#       autoconf
9#
10#
11#%# family=contrib
12#%# capabilities=autoconf
13
14CACHEFILE="/var/local/cache/cms-versions-installed/spip.txt"
15
16if [ "$1" = "autoconf" ]; then
17        if [ -f $CACHEFILE ]; then
18                echo yes
19                exit 0
20        else
21                echo "no (could not find cache file)"
22        fi
23        exit 1
24fi
25
26if [ "$1" = "config" ]; then
27        echo 'graph_title Spip - number of installations'
28        echo 'graph_vlabel quantity'
29        echo 'graph_category cms'
30        # echo 'graph_scale no'
31        # echo 'graph_args --base 1024 -l 0'
32
33        cat $CACHEFILE \
34                | awk '{print $2}' \
35                | sed 's/\./v/g'  \
36                | awk ' {foo[$1]++} END { for (f in foo ) { print "v" f ".label", f }}' \
37                | sed 's/ \([0-9]*\)v\([0-9]*\)v\([0-9a-zA-Z]*\)/ \1.\2.\3/' \
38                | sed 's/ \([0-9]*\)v\([0-9]*\)/ \1.\2/' \
39                | sed 's/v.label /unknown.label unknown/'
40        exit 0
41fi
42
43cat $CACHEFILE |  awk '{print $2}' | sed 's/\./v/g'  | awk ' {foo[$1]++} END { for (f in foo ) { print "v" f ".value", foo[f] }}' | sed 's/v.value /unknown.value /'
Note: See TracBrowser for help on using the repository browser.