mirror of
https://github.com/netdata/netdata.git
synced 2025-04-28 14:42:31 +00:00

* spelling: alleviate Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: available Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: berkeley Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: cannot Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: centos Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: context Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: continuously Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: correlate Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: defaults Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: dependencies Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: dependency Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: different Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: doesn't Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: example Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: forbidden Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: necessary Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: nightly Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: normally Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: notification Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: overridden Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: packet Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: program Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: prompted for Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: proxyadmin Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: red hat Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: relative Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: script Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: scriptlet Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: somewhere Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: spinning Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: substitution Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: success Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: successfully Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: sysadmin Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: tarball Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: telemetry Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: temporary Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: timeout Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: unsupported Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: updates Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: useful Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: way Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Update kickstart script checksums in documentation Co-authored-by: Vladimir Kobal <vlad@prokk.net>
88 lines
2.8 KiB
Bash
88 lines
2.8 KiB
Bash
#!/bin/bash
|
|
|
|
#The health directory to put the alarms
|
|
HEALTHDIR="@configdir_POST@/health.d/"
|
|
|
|
#the current time
|
|
OUTDIR="alarms"
|
|
QUERY="/api/v1/alarms?all"
|
|
MURL="http://localhost:19999$QUERY"
|
|
|
|
#error messages
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
NOCOLOR='\033[0m'
|
|
|
|
ALARMTEST="dev_dim_template"
|
|
|
|
change_alarm_file() {
|
|
if [ -f "$1" ]; then
|
|
rm "$1"
|
|
fi
|
|
|
|
#copy keeping the permissions
|
|
cp -a "$2" "$3"
|
|
}
|
|
|
|
netdata_test_download() {
|
|
grep "HTTP/1.1 200 OK" "$1" 2>/dev/null 1>/dev/null
|
|
TEST="$?"
|
|
if [ "$TEST" -ne "0" ]; then
|
|
echo -e "${RED} Error to get the alarm log. ${NOCOLOR}"
|
|
exit 1
|
|
fi
|
|
|
|
TOTALARM=$(grep "$ALARMTEST" "$2" | grep name | cut -d: -f2 | grep -c "$ALARMTEST")
|
|
|
|
if [ "$TOTALARM" -ne "$3" ]; then
|
|
echo -e "${RED} The number of actives alarms with the name $SYSTEMALARM is wrong ${NOCOLOR}"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
get_the_logs() {
|
|
curl -v -k --create-dirs -o "$OUTDIR/$1.out" "$MURL" 2> "$OUTDIR/$1.err"
|
|
netdata_test_download "$OUTDIR/$1.err" "$OUTDIR/$1.out" "$2"
|
|
}
|
|
|
|
process_data() {
|
|
netdata -D &
|
|
NETDATAPID=$!
|
|
echo -e "${NOCOLOR}Sleeping during 15 seconds to create alarms"
|
|
sleep 15
|
|
kill $NETDATAPID
|
|
get_the_logs "$1" "$2"
|
|
}
|
|
|
|
mkdir "$OUTDIR"
|
|
CREATEDIR="$?"
|
|
if [ "$CREATEDIR" -ne "0" ]; then
|
|
echo -e "${RED}Cannot create the output directory, it already exists. The test will overwrite previous results. ${NOCOLOR}"
|
|
fi
|
|
|
|
if [ -n "$1" ]; then
|
|
MURL="$1$QUERY"
|
|
fi
|
|
|
|
change_alarm_file "./0" "system_cpu.conf.unique_alarm" "$HEALTHDIR/dim_double_without_template.conf"
|
|
process_data "double_without_template" 3 "$HEALTHDIR/dim_double_without_template.conf"
|
|
|
|
change_alarm_file "$HEALTHDIR/dim_double_without_template.conf" "system_cpu.conf.alarm_foreach" "$HEALTHDIR/dim_foreach_without_template.conf"
|
|
process_data "foreach_without_template" 3 "$HEALTHDIR/dim_foreach_without_template.conf"
|
|
|
|
change_alarm_file "$HEALTHDIR/dim_foreach_without_template.conf" "system_cpu.conf.alarm_foreach_sp" "$HEALTHDIR/dim_foreach_without_template_sp.conf"
|
|
process_data "foreach_without_template" 10 "$HEALTHDIR/dim_foreach_without_template_sp.conf"
|
|
|
|
change_alarm_file "$HEALTHDIR/dim_foreach_without_template_sp.conf" "system_cpu.conf.template_alarm" "$HEALTHDIR/dim_double_with_template.conf"
|
|
process_data "double_with_template" 3 "$HEALTHDIR/dim_double_with_template.conf"
|
|
|
|
change_alarm_file "$HEALTHDIR/dim_double_with_template.conf" "system_cpu.conf.template_foreach" "$HEALTHDIR/dim_foreach_with_template.conf"
|
|
process_data "foreach_with_template" 3 "$HEALTHDIR/dim_foreach_with_template.conf"
|
|
|
|
change_alarm_file "$HEALTHDIR/dim_foreach_with_template.conf" "system_cpu.conf.template_foreach_sp" "$HEALTHDIR/dim_foreach_with_template_sp.conf"
|
|
process_data "foreach_with_template" 10 "$HEALTHDIR/dim_foreach_with_template_sp.conf"
|
|
|
|
rm "$HEALTHDIR/dim_foreach_with_template_sp.conf"
|
|
rm -rf "$OUTDIR"
|
|
|
|
echo -e "${GREEN} all the tests were successful ${NOCOLOR}"
|