mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
collectd: add curl uci config
Signed-off-by: Florian Eckert <fe@dev.tdt.de> (cherry-picked for 19.07) Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
This commit is contained in:
committed by
Hannu Nyman
parent
53e546854a
commit
df7d418c97
@@ -44,6 +44,35 @@ process_exec_sections() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process_curl() {
|
||||||
|
printf "<Plugin curl>\n" >> "$COLLECTD_CONF"
|
||||||
|
config_foreach process_curl_page curl_page
|
||||||
|
printf "</Plugin>\n\n" >> "$COLLECTD_CONF"
|
||||||
|
}
|
||||||
|
|
||||||
|
process_curl_page() {
|
||||||
|
local cfg="$1"
|
||||||
|
|
||||||
|
local name url
|
||||||
|
|
||||||
|
config_get name "$cfg" name
|
||||||
|
[ -z "$name" ] && {
|
||||||
|
$LOG notice "No name option in config $cfg defined"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
config_get url "$cfg" url
|
||||||
|
[ -z "$url" ] && {
|
||||||
|
$LOG notice "No URL option in config $cfg defined"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
printf "\\t<Page \"%s\">\n" "${name}" >> "$COLLECTD_CONF"
|
||||||
|
printf "\\t\\tURL \"%s\"\n" "${url}" >> "$COLLECTD_CONF"
|
||||||
|
printf "\\t\\tMeasureResponseTime true\n" >> "$COLLECTD_CONF"
|
||||||
|
printf "\\t</Page>\n" >> "$COLLECTD_CONF"
|
||||||
|
}
|
||||||
|
|
||||||
CONFIG_LIST=""
|
CONFIG_LIST=""
|
||||||
add_list_option() {
|
add_list_option() {
|
||||||
local value="$1"
|
local value="$1"
|
||||||
@@ -139,6 +168,10 @@ process_plugins() {
|
|||||||
CONFIG_STRING=""
|
CONFIG_STRING=""
|
||||||
process_exec
|
process_exec
|
||||||
;;
|
;;
|
||||||
|
curl)
|
||||||
|
CONFIG_STRING=""
|
||||||
|
process_curl
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
CONFIG_STRING=""
|
CONFIG_STRING=""
|
||||||
process_generic "$cfg" "\\t" "/usr/share/collectd/plugin/$cfg.json"
|
process_generic "$cfg" "\\t" "/usr/share/collectd/plugin/$cfg.json"
|
||||||
|
|||||||
@@ -30,6 +30,13 @@ config globals 'globals'
|
|||||||
# option StoreRates '0'
|
# option StoreRates '0'
|
||||||
# option DataDir '/tmp'
|
# option DataDir '/tmp'
|
||||||
|
|
||||||
|
#config plugin 'curl'
|
||||||
|
# option enable '0'
|
||||||
|
|
||||||
|
#config curl_page
|
||||||
|
# option name 'test'
|
||||||
|
# option url 'http://finance.google.com/finance?q=NYSE%3AAMD%22'
|
||||||
|
|
||||||
#config plugin 'df'
|
#config plugin 'df'
|
||||||
# option enable '0'
|
# option enable '0'
|
||||||
# list Device '/dev/mtdblock/4'
|
# list Device '/dev/mtdblock/4'
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user