Projet

Général

Profil

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

root / plugins / chrony / chrony_drift @ 7fa8734a

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

1
#! /bin/sh
2
# -*- sh -*-
3

    
4
: <<=cut
5

    
6
=head1 NAME
7

    
8
chrony_drift - Munin plugin to monitor the Chrony drift value.
9

    
10
=head1 APPLICABLE SYSTEMS
11

    
12
Any chronyd host.
13

    
14
=head1 CONFIGURATION
15

    
16
The following configuration parameters are used by this plugin:
17

    
18
 [chrony_drift]
19
 env.driftfile - Path to driftfile.
20

    
21
=head2 DEFAULT CONFIGURATION
22

    
23
 [chrony_drift]
24
 env.driftfile "/var/lib/chrony/chrony.drift"
25

    
26
=head1 USAGE
27

    
28
Link this plugin to /etc/munin/plugins/ and restart the munin-node.
29

    
30
=head1 AUTHOR
31

    
32
HORINOUCHI Masato <thermes+github@confei.to> 2019-07-16
33

    
34
=head1 LICENSE
35

    
36
Same as munin.
37

    
38
=head1 MAGIC MARKERS
39

    
40
#%# family=auto
41
#%# capabilities=autoconf
42

    
43
=cut
44

    
45
driftfile=${driftfile:-'/var/lib/chrony/chrony.drift'}
46

    
47
do_autoconf () {
48
    if [ -r "$driftfile" ]; then
49
        echo "yes"
50
    else
51
        echo "no (could not read driftfile '$driftfile'.)"
52
    fi
53
}
54

    
55

    
56
do_config () {
57
    cat <<'EOM'
58
graph_title Chrony Drift
59
graph_args --base 1000
60
graph_vlabel Parts Per Million
61
graph_category time
62
drift.label System Clock Gain/Loss Rate
63
error_bound.label Estimate of Error Bound
64
graph_info The rate at which the system clock gains or loses time relative to real time.
65
EOM
66
}
67

    
68

    
69
do_ () {
70
    if [ -r "$driftfile" ]; then
71
        echo "drift.value $(awk '{print $1;}' "$driftfile")"
72
        echo "error_bound.value $(awk '{print $2;}' "$driftfile")"
73
    else
74
        echo "drift.value U"
75
        echo "error_bound.value U"
76
    fi
77
}
78

    
79

    
80
case $1 in
81
    autoconf|config|'')
82
        do_"$1"
83
        ;;
84
    *)
85
        echo "Don't know how to do that" >&2
86
        exit 1
87
        ;;
88
esac