#!/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
