check_ntp 825 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#!/bin/sh
# Petit plugin histoire de mesurer la dérive temporelle (spécialement des domU)

output_config() {
    echo "graph_title Suivi du temps"
    echo "graph_category time"
    echo "local_date.label Date courante"
    echo "local_date.type DERIVE"
}

output_values() {
    
    printf "local_date.value %d\n" $(cur_timestamp)
}

cur_timestamp() {
    date +%s
}

output_usage() {
    printf >&2 "%s - munin plugin to graph an example value\n" ${0##*/}
    printf >&2 "Usage: %s [config]\n" ${0##*/}
}

case $# in
    0)
        output_values
        ;;
    1)
        case $1 in
            config)
                output_config
                ;;
            *)
                output_usage
                exit 1
                ;;
        esac
        ;;
    *)
        output_usage
        exit 1
        ;;
esac