~ubuntu-branches/ubuntu/gutsy/munin/gutsy

« back to all changes in this revision

Viewing changes to node/node.d/mysql_bytes.in

  • Committer: Bazaar Package Importer
  • Author(s): Tore Anderson
  • Date: 2004-05-21 20:51:19 UTC
  • Revision ID: james.westby@ubuntu.com-20040521205119-oz8bllbjp9hs80ig
Tags: upstream-0+1.0.0pre5
ImportĀ upstreamĀ versionĀ 0+1.0.0pre5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Plugin to monitor the number of bytes sent from and received by mysql.
 
4
#
 
5
# Parameters:
 
6
#
 
7
#       config
 
8
#       autoconf
 
9
#
 
10
# Configuration variables
 
11
#
 
12
#   mysqlopts    - Options to pass to mysql
 
13
#
 
14
# $Log: mysql_bytes.in,v $
 
15
# Revision 1.2  2004/04/27 18:58:53  jimmyo
 
16
# Fixed bug in mysql-plugins (Deb#233762).
 
17
#
 
18
# Revision 1.1  2004/01/02 18:50:00  jimmyo
 
19
# Renamed occurrances of lrrd -> munin
 
20
#
 
21
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
 
22
# Import of LRRD CVS tree after renaming to Munin
 
23
#
 
24
# Revision 1.7  2003/11/07 22:12:50  jimmyo
 
25
# Changed deprecated plugin options
 
26
#
 
27
# Revision 1.6  2003/11/07 17:43:16  jimmyo
 
28
# Cleanups and log entries
 
29
#
 
30
#
 
31
#
 
32
#%# family=auto
 
33
#%# capabilities=autoconf
 
34
 
 
35
MYSQLOPTS="$mysqlopts";
 
36
MYSQLADMIN=${mysqladmin:-mysqladmin}
 
37
 
 
38
if [ "$1" = "autoconf" ]; then
 
39
        $MYSQLADMIN --version 2>/dev/null >/dev/null
 
40
        if [ $? -eq 0 ]
 
41
        then
 
42
                $MYSQLADMIN $MYSQLOPTS extended-status 2>/dev/null >/dev/null
 
43
                if [ $? -eq 0 ]
 
44
                then
 
45
                        echo yes
 
46
                        exit 0
 
47
                else
 
48
                        echo "no (could not connect to mysql)"
 
49
                fi
 
50
        else
 
51
                echo "no (mysqladmin not found)"
 
52
        fi
 
53
        exit 1
 
54
fi
 
55
 
 
56
if [ "$1" = "config" ]; then
 
57
        echo 'graph_title MySQL throughput'
 
58
        echo 'graph_args --base 1024'
 
59
        echo 'graph_vlabel bytes received (-) / sent (+)'
 
60
        echo 'recv.label received'
 
61
        echo 'recv.type COUNTER'
 
62
        echo 'recv.draw LINE2'
 
63
        echo 'recv.max 80000000'
 
64
        echo 'recv.graph no'
 
65
        echo 'sent.label bps'
 
66
        echo 'sent.type COUNTER'
 
67
        echo 'sent.max 80000000'
 
68
        echo 'sent.draw LINE2'
 
69
        echo 'sent.negative recv'
 
70
        exit 0
 
71
fi
 
72
 
 
73
($MYSQLADMIN $MYSQLOPTS extended-status 2>/dev/null || ( echo Bytes_sent a a U; echo Bytes_received a a U)) | awk '/Bytes_sent/ { print "sent.value " $4} /Bytes_received/ { print "recv.value " $4}'