Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / network / smtp_hello_ @ 92483a04

Historique | Voir | Annoter | Télécharger (1,75 ko)

1 e5f02659 Marek Mahut
#!/bin/bash
2
#
3
# smtp_hello_ - munin plugin for measuring smtp hello response
4
# Copyright (C) 2008 Marek Mahut <mmahut@fedoraproject.org>
5
#
6
# Usage:
7
#       ln -s /usr/share/munin/plugins/smtp_hello_ /etc/munin/plugins/smtp_hello_mysmtpserver.example.com
8
#
9
# This program is free software; you can redistribute it and/or
10
# modify it under the terms of the GNU General Public License
11
# as published by the Free Software Foundation; either version 2
12
# of the License, or (at your option) any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22
#
23
#$log$
24
#Revision 1.0  2008/12/15 17:21:58 Marek Mahut (mmahut)
25
#Initial commit.
26
#
27
#%# family=auto
28
#%# capabilities=autoconf
29
30
31
host=`basename $0 | sed 's/^smtp_hello_//g'`
32
33
if [ "$1" == "config" ]; then
34
35
        echo "graph_title smtp response time"
36
        echo "graph_vlabel response in sec"
37
        echo "graph_period minute"
38
        echo "graph_category Network"
39
        echo "graph_args --base 1000 --lower-limit 0"
40
        echo "host.label $host"
41
42
elif [ "$1" == "autoconf" ]; then
43
44
        if [ -x /usr/bin/time ] && [ -x /usr/bin/nc ]; then
45
                echo "yes"
46
        else
47
                echo "no (/usr/bin/time or /usr/bin/nc missing)"
48
        fi
49 e4cd049b Lars Kruse
        exit 0
50 e5f02659 Marek Mahut
51
else
52
53
        response=`echo HELO localhost | /usr/bin/time -f "%e" nc -C -w 120 $host 25 2>&1 | tail -n 1`
54
        echo "host.value $response"
55
56
fi