summaryrefslogtreecommitdiffstats
path: root/tests/lib/monitor
blob: 6b804ec2a6598dba999ff5e53306d476f55bb739 (plain)
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
#!/bin/bash

MONITOR_TYPE=${MONITOR_TYPE:-sample}

function is_monitor_supported {
    local monitor="$1"
    [[ -f $TOP_DIR/lib/monitors/$monitor/$monitor ]]
}

function is_monitor {
    local monitor="$1"
    [[ $monitor == $MONITOR_TYPE ]]
}

function start_monitor {
    start_monitor_$MONITOR_TYPE
}

function stop_monitor {
    stop_monitor_$MONITOR_TYPE
}

function cleanup_monitor {
    cleanup_monitor_$MONITOR_TYPE
}

if ! is_monitor_supported $MONITOR_TYPE; then
    die $LINENO "MONITOR_TYPE=$MONITOR_TYPE is not supported."
fi

source $TOP_DIR/lib/monitors/$MONITOR_TYPE/$MONITOR_TYPE