From ca540a730c0b880922e86074f994a95b8d413bea Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 13 Oct 2019 10:37:32 +0200 Subject: Merging upstream version 1.18.0. Signed-off-by: Daniel Baumann --- tests/Makefile.am | 3 + tests/acls/acl.sh.in | 37 +++++---- tests/alarm_repetition/alarm.sh.in | 23 +++--- tests/profile/benchmark-line-parsing.c | 5 -- tests/stress.sh | 16 ++-- .../system_cpu.conf.alarm_foreach | 8 ++ .../system_cpu.conf.alarm_foreach_sp | 8 ++ .../system_cpu.conf.template_alarm | 26 +++++++ .../system_cpu.conf.template_foreach | 8 ++ .../system_cpu.conf.template_foreach_sp | 8 ++ .../system_cpu.conf.unique_alarm | 26 +++++++ tests/template_dimension/template_dim.sh.in | 88 ++++++++++++++++++++++ tests/urls/request.sh.in | 78 ++++++++++--------- 13 files changed, 263 insertions(+), 71 deletions(-) create mode 100644 tests/template_dimension/system_cpu.conf.alarm_foreach create mode 100644 tests/template_dimension/system_cpu.conf.alarm_foreach_sp create mode 100644 tests/template_dimension/system_cpu.conf.template_alarm create mode 100644 tests/template_dimension/system_cpu.conf.template_foreach create mode 100644 tests/template_dimension/system_cpu.conf.template_foreach_sp create mode 100644 tests/template_dimension/system_cpu.conf.unique_alarm create mode 100644 tests/template_dimension/template_dim.sh.in (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 179b04864..c549cbd47 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,6 +8,7 @@ CLEANFILES = \ acls/acl.sh \ urls/request.sh \ alarm_repetition/alarm.sh \ + template_dimension/template_dim.sh \ $(NULL) include $(top_srcdir)/build/subst.inc @@ -28,6 +29,7 @@ dist_noinst_DATA = \ acls/acl.sh.in \ urls/request.sh.in \ alarm_repetition/alarm.sh.in \ + template_dimension/template_dim.sh.in \ $(NULL) dist_plugins_SCRIPTS = \ @@ -35,6 +37,7 @@ dist_plugins_SCRIPTS = \ acls/acl.sh \ urls/request.sh \ alarm_repetition/alarm.sh \ + template_dimension/template_dim.sh \ $(NULL) dist_noinst_SCRIPTS = \ diff --git a/tests/acls/acl.sh.in b/tests/acls/acl.sh.in index 772d66408..9ac404c07 100644 --- a/tests/acls/acl.sh.in +++ b/tests/acls/acl.sh.in @@ -8,6 +8,7 @@ NETDATA_VARLIB_DIR="/var/lib/netdata" RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[0;43m' +NOCOLOR='\033[0m' #change the previous acl file and with a new #and store it on a new file @@ -15,6 +16,8 @@ change_file(){ sed "s/$1/$2/g" netdata.cfg > "$4" } +NETDATAPID="" + change_ssl_file(){ KEYROW="ssl key = $3/key.pem" CERTROW="ssl certificate = $3/cert.pem" @@ -35,24 +38,24 @@ run_acl_tests() { TOT=$(grep -c "HTTP/1.1 301" log_*.txt | cut -d: -f2| grep -c 1) if [ "$TOT" -ne "$4" ]; then - echo -e "${RED}I got a wrong number of redirects($TOT) when SSL is activated, It was expected $4" + echo -e "${RED}I got a wrong number of redirects($TOT) when SSL is activated, It was expected $4 ${NOCOLOR}" rm log_* netdata.conf.test* netdata.txt health.csv index.html badge.csv tmp* key.pem cert.pem info.txt - killall netdata + kill $NETDATAPID exit 1 elif [ "$TOT" -eq "$4" ] && [ "$4" -ne "0" ]; then - echo -e "${YELLOW}I got the correct number of redirects($4) when SSL is activated and I try to access with HTTP." + echo -e "${YELLOW}I got the correct number of redirects($4) when SSL is activated and I try to access with HTTP. ${NOCOLOR}" return fi TOT=$(grep -c "HTTP/1.1 200 OK" log_* | cut -d: -f2| grep -c 1) if [ "$TOT" -ne "$3" ]; then - echo -e "${RED}I got a wrong number of \"200 OK\" from the queries, it was expected $3." - killall netdata + echo -e "${RED}I got a wrong number of \"200 OK\" from the queries, it was expected $3. ${NOCOLOR}" + kill $NETDATAPID rm log_* netdata.conf.test* netdata.txt health.csv index.html badge.csv tmp* key.pem cert.pem info.txt exit 1 fi - echo -e "${GREEN}ACLs were applied correctly" + echo -e "${GREEN}ACLs were applied correctly ${NOCOLOR}" } CONF=$(grep "bind" netdata.cfg) @@ -69,12 +72,14 @@ else fi change_file "$CONF" " bind to = *" "$CWD" "netdata.conf.test0" -netdata -c "netdata.conf.test0" +netdata -c "netdata.conf.test0" -D & +NETDATAPID=$! run_acl_tests $TOKEN "$BASICURL:19999" 5 0 -killall netdata +kill $NETDATAPID change_ssl_file "$CONF" " bind to = *=dashboard|registry|badges|management|netdata.conf *:20000=dashboard|registry|badges|management *:20001=dashboard|registry|netdata.conf^SSL=optional *:20002=dashboard|registry" "$CWD" "netdata.conf.test1" -netdata -c "netdata.conf.test1" +netdata -c "netdata.conf.test1" -D & +NETDATAPID=$! run_acl_tests $TOKEN "$BASICURL:19999" 5 5 run_acl_tests $TOKEN "$BASICURLS:19999" 5 0 @@ -86,10 +91,11 @@ run_acl_tests $TOKEN "$BASICURLS:20001" 4 0 run_acl_tests $TOKEN "$BASICURL:20002" 3 5 run_acl_tests $TOKEN "$BASICURLS:20002" 3 0 -killall netdata +kill $NETDATAPID change_ssl_file "$CONF" " bind to = *=dashboard|registry|badges|management|netdata.conf *:20000=dashboard|registry|badges|management *:20001=dashboard|registry|netdata.conf^SSL=force *:20002=dashboard|registry" "$CWD" "netdata.conf.test2" -netdata -c "netdata.conf.test2" +netdata -c "netdata.conf.test2" -D & +NETDATAPID=$! run_acl_tests $TOKEN "$BASICURL:19999" 5 5 run_acl_tests $TOKEN "$BASICURLS:19999" 5 0 @@ -101,10 +107,11 @@ run_acl_tests $TOKEN "$BASICURLS:20001" 4 0 run_acl_tests $TOKEN "$BASICURL:20002" 3 5 run_acl_tests $TOKEN "$BASICURLS:20002" 3 0 -killall netdata +kill $NETDATAPID change_ssl_file "$CONF" " bind to = *=dashboard|registry|badges|management|netdata.conf *:20000=dashboard|registry|badges|management^SSL=optional *:20001=dashboard|registry|netdata.conf^SSL=force" "$CWD" "netdata.conf.test3" -netdata -c "netdata.conf.test3" +netdata -c "netdata.conf.test3" -D & +NETDATAPID=$! run_acl_tests $TOKEN "$BASICURL:19999" 5 5 run_acl_tests $TOKEN "$BASICURLS:19999" 5 0 @@ -113,7 +120,7 @@ run_acl_tests $TOKEN "$BASICURLS:20000" 4 0 run_acl_tests $TOKEN "$BASICURL:20001" 4 5 run_acl_tests $TOKEN "$BASICURLS:20001" 4 0 -killall netdata +kill $NETDATAPID rm log_* netdata.conf.test* netdata.txt health.csv index.html badge.csv tmp* key.pem cert.pem info.txt -echo "All the tests were successful" +echo "All the tests were successful ${NOCOLOR}" diff --git a/tests/alarm_repetition/alarm.sh.in b/tests/alarm_repetition/alarm.sh.in index 8555e0a3c..09d6aaf46 100644 --- a/tests/alarm_repetition/alarm.sh.in +++ b/tests/alarm_repetition/alarm.sh.in @@ -7,7 +7,8 @@ HEALTHDIR="@configdir_POST@/health.d/" OUTDIR="workdir/" #url to do download -MURL="http://localhost:19999/api/v1/alarms?active" +QUERY="/api/v1/alarms?active" +MURL="http://localhost:19999$QUERY" #error messages RED='\033[0;31m' @@ -35,24 +36,26 @@ 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 alarms" - killall netdata + echo -e "${RED} Error to get the alarms. ${NOCOLOR}" + kill "$5" + rm "$HEALTHDIR/ram.conf" exit 1 fi COUNT=$(grep -w "\"last_repeat\":" "$2" | grep -c "$OPT" "\"0\"") if [ "$COUNT" -eq "0" ]; then - echo -e "${RED} Netdata gave an unexpected result when alarm repetition is $4" - killall netdata + echo -e "${RED} Netdata gave an unexpected result when alarm repetition is $4 ${NOCOLOR}" + killall "$5" + rm "$HEALTHDIR/ram.conf" exit 1 fi - echo -e "${GREEN} I got the expected result" + echo -e "${GREEN} I got the expected result ${NOCOLOR}" } 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" "$3" + netdata_test_download "$OUTDIR/$1.err" "$OUTDIR/$1.out" "$2" "$3" "$4" } process_data() { @@ -61,14 +64,14 @@ process_data() { NETDATAPID=$! echo -e "${NOCOLOR}Sleeping during $SEC seconds to create alarm entries" sleep $SEC - get_the_logs "$1" "$2" "$3" + get_the_logs "$1" "$2" "$3" "$NETDATAPID" kill $NETDATAPID } 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." + echo -e "${RED}Cannot create the output directory, it already exists. The test will overwrite previous results. ${NOCOLOR}" fi change_alarm_file "./0" "ram_without_repetition.conf" "$HEALTHDIR/ram.conf" @@ -81,6 +84,6 @@ cp -a netdata.conf_with_repetition netdata.conf process_data "ram_with" "I" "activated." rm netdata.conf -echo -e "${GREEN} all the tests were sucessful" +echo -e "${GREEN} all the tests were sucessful ${NOCOLOR}" rm "$HEALTHDIR/ram.conf" rm -rf $OUTDIR diff --git a/tests/profile/benchmark-line-parsing.c b/tests/profile/benchmark-line-parsing.c index c07d1d857..1d47cc83a 100644 --- a/tests/profile/benchmark-line-parsing.c +++ b/tests/profile/benchmark-line-parsing.c @@ -643,11 +643,6 @@ void main(void) total_active_file_hash = simple_hash("total_active_file"); total_unevictable_hash = simple_hash("total_unevictable"); - // cache functions - (void)simple_hash2("hello world"); - (void)strcmp("1", "2"); - (void)strtoull("123", NULL, 0); - unsigned long i, c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, c6 = 0, c7; unsigned long max = 1000000; diff --git a/tests/stress.sh b/tests/stress.sh index 9c9393d3b..97cced032 100755 --- a/tests/stress.sh +++ b/tests/stress.sh @@ -1,8 +1,14 @@ #!/bin/bash # SPDX-License-Identifier: GPL-3.0-or-later +if ! hash curl 2>/dev/null +then + 1>&2 echo "'curl' not found on system. Please install 'curl'." + exit 1 +fi + # set the host to connect to -if [ ! -z "$1" ] +if [ -n "$1" ] then host="$1" else @@ -11,17 +17,17 @@ fi echo "using netdata server at: $host" # shellcheck disable=SC2207 disable=SC1117 -charts=($(curl "$host/netdata.conf" 2>/dev/null | grep "^\[" | cut -d '[' -f 2 | cut -d ']' -f 1 | grep -v ^global$ | grep -v "^plugin" | sort -u)) +charts=($(curl -k "$host/netdata.conf" 2>/dev/null | grep "^\[" | cut -d '[' -f 2 | cut -d ']' -f 1 | grep -v ^global$ | grep -v "^plugin" | sort -u)) if [ "${#charts[@]}" -eq 0 ] then echo "Cannot download charts from server: $host" exit 1 fi -update_every="$(curl "$host/netdata.conf" 2>/dev/null | grep "update every = " | head -n 1 | cut -d '=' -f 2)" +update_every="$(curl -k "$host/netdata.conf" 2>/dev/null | grep "update every = " | head -n 1 | cut -d '=' -f 2)" [ $(( update_every + 1 - 1)) -eq 0 ] && update_every=1 -entries="$(curl "$host/netdata.conf" 2>/dev/null | grep "history = " | head -n 1 | cut -d '=' -f 2)" +entries="$(curl -k "$host/netdata.conf" 2>/dev/null | grep "history = " | head -n 1 | cut -d '=' -f 2)" [ $(( entries + 1 - 1)) -eq 0 ] && entries=3600 # to compare equal things, set the entries to 3600 max @@ -49,7 +55,7 @@ trap cleanup EXIT while true do - echo "curl --compressed --keepalive-time 120 --header \"Connection: keep-alive\" \\" >"$file" + echo "curl -k --compressed --keepalive-time 120 --header \"Connection: keep-alive\" \\" >"$file" # shellcheck disable=SC2034 for x in {1..100} do diff --git a/tests/template_dimension/system_cpu.conf.alarm_foreach b/tests/template_dimension/system_cpu.conf.alarm_foreach new file mode 100644 index 000000000..21a8cbb72 --- /dev/null +++ b/tests/template_dimension/system_cpu.conf.alarm_foreach @@ -0,0 +1,8 @@ + alarm: dev_dim_template + on: system.cpu + os: linux +lookup: sum -3s at 0 every 3 percentage foreach system,user,nice + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 diff --git a/tests/template_dimension/system_cpu.conf.alarm_foreach_sp b/tests/template_dimension/system_cpu.conf.alarm_foreach_sp new file mode 100644 index 000000000..fdd19e813 --- /dev/null +++ b/tests/template_dimension/system_cpu.conf.alarm_foreach_sp @@ -0,0 +1,8 @@ + alarm: dev_dim_template + on: system.cpu + os: linux +lookup: sum -3s at 0 every 3 percentage foreach * + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 diff --git a/tests/template_dimension/system_cpu.conf.template_alarm b/tests/template_dimension/system_cpu.conf.template_alarm new file mode 100644 index 000000000..2bd12a101 --- /dev/null +++ b/tests/template_dimension/system_cpu.conf.template_alarm @@ -0,0 +1,26 @@ +template: dev_dim_template_system + on: system.cpu + os: linux + lookup: sum -3s at 0 every 3 percentage of system + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 + +template: dev_dim_template_user + on: system.cpu + os: linux + lookup: sum -3s at 0 every 3 percentage of user + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 + +template: dev_dim_template_nice + on: system.cpu + os: linux + lookup: sum -3s at 0 every 3 percentage of nice + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 diff --git a/tests/template_dimension/system_cpu.conf.template_foreach b/tests/template_dimension/system_cpu.conf.template_foreach new file mode 100644 index 000000000..c75c15b2a --- /dev/null +++ b/tests/template_dimension/system_cpu.conf.template_foreach @@ -0,0 +1,8 @@ +template: dev_dim_template + on: system.cpu + os: linux + lookup: sum -3s at 0 every 3 percentage foreach system,user,nice + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 diff --git a/tests/template_dimension/system_cpu.conf.template_foreach_sp b/tests/template_dimension/system_cpu.conf.template_foreach_sp new file mode 100644 index 000000000..f50a832c9 --- /dev/null +++ b/tests/template_dimension/system_cpu.conf.template_foreach_sp @@ -0,0 +1,8 @@ + template: dev_dim_template + on: system.cpu + os: linux + lookup: sum -3s at 0 every 3 percentage foreach * + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 diff --git a/tests/template_dimension/system_cpu.conf.unique_alarm b/tests/template_dimension/system_cpu.conf.unique_alarm new file mode 100644 index 000000000..0f38b6e12 --- /dev/null +++ b/tests/template_dimension/system_cpu.conf.unique_alarm @@ -0,0 +1,26 @@ + alarm: dev_dim_template_system + on: system.cpu + os: linux +lookup: sum -3s at 0 every 3 percentage of system + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 + + alarm: dev_dim_template_user + on: system.cpu + os: linux +lookup: sum -3s at 0 every 3 percentage of user + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 + + alarm: dev_dim_template_nice + on: system.cpu + os: linux +lookup: sum -3s at 0 every 3 percentage of nice + units: % + every: 1s + warn: $this > 1 + crit: $this > 4 diff --git a/tests/template_dimension/template_dim.sh.in b/tests/template_dimension/template_dim.sh.in new file mode 100644 index 000000000..88978fd84 --- /dev/null +++ b/tests/template_dimension/template_dim.sh.in @@ -0,0 +1,88 @@ +#!/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 sucessful ${NOCOLOR}" diff --git a/tests/urls/request.sh.in b/tests/urls/request.sh.in index 6cbe77384..ebdfc094c 100644 --- a/tests/urls/request.sh.in +++ b/tests/urls/request.sh.in @@ -18,6 +18,9 @@ OUTDIR="tests" OUTEDIR="encoded_tests" OUTOPTDIR="options" ERRDIR="etests" +NOCOLOR='\033[0' +RED='\033[0;31m' +GREEN='\033[0;32m' ################################################################################################ #### #### @@ -27,7 +30,7 @@ ERRDIR="etests" # Print error message and close script netdata_print_error(){ - echo "Closing due error \"$1\" code \"$2\"" + echo "${RED} Closing due error \"$1\" code \"$2\" ${NOCOLOR}" exit 1 } @@ -200,36 +203,40 @@ netdata_download_allmetrics() { } -################################################################################################ +#################################################### #### #### -#### MAIN ROUTINE #### +#### MAIN ROUTINE #### #### #### -################################################################################################ +#################################################### MURL="http://127.0.0.1:19999" +if [ -n "$1" ]; then + MURL="$1" +fi + netdata_create_directory $OUTDIR netdata_create_directory $OUTEDIR netdata_create_directory $OUTOPTDIR netdata_create_directory $ERRDIR -wget --no-check-certificate --execute="robots = off" --mirror --convert-links --no-parent $MURL +wget --no-check-certificate --execute="robots = off" --mirror --convert-links --no-parent "$MURL" TEST=$? if [ $TEST -ne "0" ] ; then echo "Cannot connect to Netdata" exit 1 fi -netdata_download_various $MURL "netdata.conf" "netdata.conf" +netdata_download_various "$MURL" "netdata.conf" "netdata.conf" -netdata_download_various_with_options $MURL "netdata.conf" "netdata.conf" +netdata_download_various_with_options "$MURL" "netdata.conf" "netdata.conf" -netdata_wrong_request_various $MURL "api/v15/info?this%20could%20not%20be%20here" "err_version" +netdata_wrong_request_various "$MURL" "api/v15/info?this%20could%20not%20be%20here" "err_version" -netdata_wrong_request_various $MURL "api/v1/\(*@&$\!$%%5E\)\!$*%&\)\!$*%%5E*\!%5E%\!%5E$%\!%5E%\(\!*%5E*%5E%\(*@&$%5E%\(\!%5E#*&\!^#$*&\!^%\)@\($%^\)\!*&^\(\!*&^#$&#$\)\!$%^\)\!$*%&\)#$\!^#*$^\!\(*#^#\)\!%^\!\)$*%&\!\(*&$\!^#$*&^\!*#^$\!*^\)%\(\!*&$%\)\(\!&#$\!^*#&$^\!*^%\)\!$%\)\!\(&#$\!^#*&^$" "err_version2" +netdata_wrong_request_various "$MURL" "api/v1/\(*@&$\!$%%5E\)\!$*%&\)\!$*%%5E*\!%5E%\!%5E$%\!%5E%\(\!*%5E*%5E%\(*@&$%5E%\(\!%5E#*&\!^#$*&\!^%\)@\($%^\)\!*&^\(\!*&^#$&#$\)\!$%^\)\!$*%&\)#$\!^#*$^\!\(*#^#\)\!%^\!\)$*%&\!\(*&$\!^#$*&^\!*#^$\!*^\)%\(\!*&$%\)\(\!&#$\!^*#&$^\!*^%\)\!$%\)\!\(&#$\!^#*&^$" "err_version2" -netdata_download_various $MURL "api/v1/info" "info" -netdata_download_various_with_options $MURL "api/v1/info" "info" -netdata_download_various $MURL "api/v1/info?this%20could%20not%20be%20here" "err_info" +netdata_download_various "$MURL" "api/v1/info" "info" +netdata_download_various_with_options "$MURL" "api/v1/info" "info" +netdata_download_various "$MURL" "api/v1/info?this%20could%20not%20be%20here" "err_info" netdata_print_header "Getting all the netdata charts" CHARTS=$( netdata_download_charts "$MURL" "api/v1/charts" ) @@ -244,58 +251,57 @@ elif [ ${#CHARTS[@]} -ne ${#WCHARTS2[@]} ]; then exit 3; fi -netdata_wrong_request_various $MURL "api/v1/chart" "err_chart_without_chart" -netdata_wrong_request_various $MURL "api/v1/chart?_=234231424242" "err_chart_arg" +netdata_wrong_request_various "$MURL" "api/v1/chart" "err_chart_without_chart" +netdata_wrong_request_various "$MURL" "api/v1/chart?_=234231424242" "err_chart_arg" -netdata_download_various $MURL "api/v1/chart?chart=cpu.cpu0_interrupts&_=234231424242" "chart_cpu_with_more_args" -netdata_download_various_with_options $MURL "api/v1/chart?chart=cpu.cpu0_interrupts&_=234231424242" "chart_cpu_with_more_args" +netdata_download_various "$MURL" "api/v1/chart?chart=cpu.cpu0_interrupts&_=234231424242" "chart_cpu_with_more_args" +netdata_download_various_with_options "$MURL" "api/v1/chart?chart=cpu.cpu0_interrupts&_=234231424242" "chart_cpu_with_more_args" -netdata_download_various $MURL "api/v1/chart%3Fchart=cpu.cpu0_interrupts&_=234231424242" "chart_cpu_with_more_args_encoded" -netdata_download_various_with_options $MURL "api/v1/chart%3Fchart=cpu.cpu0_interrupts&_=234231424242" "chart_cpu_with_more_args_encoded" -netdata_download_various $MURL "api/v1/chart%3Fchart=cpu.cpu0_interrupts%26_=234231424242" "chart_cpu_with_more_args_encoded2" -netdata_download_various $MURL "api/v1/chart%3Fchart%3Dcpu.cpu0_interrupts%26_%3D234231424242" "chart_cpu_with_more_args_encoded3" +netdata_download_various "$MURL" "api/v1/chart%3Fchart=cpu.cpu0_interrupts&_=234231424242" "chart_cpu_with_more_args_encoded" +netdata_download_various_with_options "$MURL" "api/v1/chart%3Fchart=cpu.cpu0_interrupts&_=234231424242" "chart_cpu_with_more_args_encoded" +netdata_download_various "$MURL" "api/v1/chart%3Fchart=cpu.cpu0_interrupts%26_=234231424242" "chart_cpu_with_more_args_encoded2" +netdata_download_various "$MURL" "api/v1/chart%3Fchart%3Dcpu.cpu0_interrupts%26_%3D234231424242" "chart_cpu_with_more_args_encoded3" netdata_create_directory "$OUTDIR/chart" for I in $CHARTS ; do NAME=${I//\"/} - netdata_download_various $MURL "api/v1/chart?chart=$NAME" "chart/$NAME" + netdata_download_various "$MURL" "api/v1/chart?chart=$NAME" "chart/$NAME" done -netdata_wrong_request_various $MURL "api/v1/alarm_variables" "err_alarm_variables_without_chart" -netdata_wrong_request_various $MURL "api/v1/alarm_variables?_=234231424242" "err_alarm_variables_arg" -netdata_download_various $MURL "api/v1/alarm_variables?chart=cpu.cpu0_interrupts&_=234231424242" "alarm_cpu_with_more_args" +netdata_wrong_request_various "$MURL" "api/v1/alarm_variables" "err_alarm_variables_without_chart" +netdata_wrong_request_various "$MURL" "api/v1/alarm_variables?_=234231424242" "err_alarm_variables_arg" +netdata_download_various "$MURL" "api/v1/alarm_variables?chart=cpu.cpu0_interrupts&_=234231424242" "alarm_cpu_with_more_args" netdata_create_directory "$OUTDIR/alarm_variables" for I in $CHARTS ; do NAME=${I//\"/} - netdata_download_various $MURL "api/v1/alarm_variables?chart=$NAME" "alarm_variables/$NAME" + netdata_download_various "$MURL" "api/v1/alarm_variables?chart=$NAME" "alarm_variables/$NAME" done netdata_create_directory "$OUTDIR/badge" netdata_create_directory "$OUTEDIR/badge" for I in $CHARTS ; do - netdata_download_chart $MURL "api/v1/badge.svg?chart" "$I" "badge" + netdata_download_chart "$MURL" "api/v1/badge.svg?chart" "$I" "badge" done netdata_create_directory "$OUTDIR/allmetrics" -netdata_download_allmetrics $MURL "allmetrics" +netdata_download_allmetrics "$MURL" "allmetrics" -netdata_download_various $MURL "api/v1/alarms?all" "alarms_all" -netdata_download_various $MURL "api/v1/alarms?active" "alarms_active" -netdata_download_various $MURL "api/v1/alarms" "alarms_nothing" +netdata_download_various "$MURL" "api/v1/alarms?all" "alarms_all" +netdata_download_various "$MURL" "api/v1/alarms?active" "alarms_active" +netdata_download_various "$MURL" "api/v1/alarms" "alarms_nothing" -netdata_download_various $MURL "api/v1/alarm_log?after" "alarm_without" -netdata_download_various $MURL "api/v1/alarm_log" "alarm_nothing" -netdata_download_various $MURL "api/v1/alarm_log?after&_=$PT" "alarm_log" +netdata_download_various "$MURL" "api/v1/alarm_log?after" "alarm_without" +netdata_download_various "$MURL" "api/v1/alarm_log" "alarm_nothing" +netdata_download_various "$MURL" "api/v1/alarm_log?after&_=$PT" "alarm_log" netdata_create_directory "$OUTDIR/data" netdata_create_directory "$OUTEDIR/data" for I in $CHARTS ; do - netdata_download_chart $MURL "api/v1/data?chart" "$I" "data" + netdata_download_chart "$MURL" "api/v1/data?chart" "$I" "data" break; done -WHITE='\033[0;37m' -echo -e "${WHITE}ALL the URLS got 200 as answer!" +echo -e "${GREEN}ALL the URLS got 200 as answer! ${NOCOLOR}" exit 0 -- cgit v1.2.3