#!/bin/sh

output_config() {
    echo "graph_order node_pckin node_pckout"
    echo "graph_title Node 3 Pakete"
#    echo "graph_args --base 1000 -u 50 -l -20"
    echo "graph_args --base 1000 -l 0"
    echo "graph_vlabel Nachrichten"
    echo "graph_scale no"
    echo "graph_category aqhome"

    echo "node_pckin.label eingehend"
    echo "node_pckout.label ausgehend"
}


output_values() {
    printf "node_pckin.value %f\n" $(get_var_pckin)
    printf "node_pckout.value %f\n" $(get_var_pckout)
}


get_var_pckin() {
    cat /var/cache/aqhome/mqttlog/buero_rack_back_net_packetsin
}

get_var_pckout() {
    cat /var/cache/aqhome/mqttlog/buero_rack_back_net_packetsout
}






output_usage() {
    printf >&2 "%s - munin plugin to monitor packets\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

