diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init index b8c0f368d..05e21e109 100644 --- a/utils/collectd/files/collectd.init +++ b/utils/collectd/files/collectd.init @@ -78,6 +78,52 @@ process_curl_page() { printf "\\t\n" >> "$COLLECTD_CONF" } +process_write_http() { + printf "\n" >> "$COLLECTD_CONF" + config_foreach process_write_http_node write_http_node + printf "\n\n" >> "$COLLECTD_CONF" +} + +process_write_http_node() { + local cfg="$1" + + local name URL Format User Password Timeout BufferSize + + 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 + } + config_get Format "$cfg" Format + config_get User "$cfg" User + config_get Password "$cfg" Password + config_get Timeout "$cfg" Timeout + config_get BufferSize "$cfg" BufferSize + printf "\\t\n" "${name}" >> "$COLLECTD_CONF" + printf "\\t\\tURL \"%s\"\n" "${URL}" >> "$COLLECTD_CONF" + [ -z "$Format" ] || { + printf "\\t\\tFormat \"%s\"\n" "${Format}" >> "$COLLECTD_CONF" + } + [ -z "$User" ] || { + printf "\\t\\tUser \"%s\"\n" "${User}" >> "$COLLECTD_CONF" + } + [ -z "$Password" ] || { + printf "\\t\\tPassword \"%s\"\n" "${Password}" >> "$COLLECTD_CONF" + } + [ -z "$Timeout" ] || { + printf "\\t\\tTimeout \%s\n" "${Timeout}" >> "$COLLECTD_CONF" + } + [ -z "$BufferSize" ] || { + printf "\\t\\tBufferSize \%s\n" "${BufferSize}" >> "$COLLECTD_CONF" + } + printf "\\t\n" >> "$COLLECTD_CONF" +} + process_network() { local cfg="$1" @@ -277,6 +323,10 @@ process_plugins() { CONFIG_STRING="" process_iptables ;; + write_http) + CONFIG_STRING="" + process_write_http + ;; *) CONFIG_STRING="" process_generic "$cfg" "\\t" "/usr/share/collectd/plugin/$cfg.json" diff --git a/utils/collectd/files/collectd.uci b/utils/collectd/files/collectd.uci index a716e93f0..091dd9ae9 100644 --- a/utils/collectd/files/collectd.uci +++ b/utils/collectd/files/collectd.uci @@ -213,3 +213,10 @@ config globals 'globals' #config plugin 'vmem' # option enable '0' # option Verbose '0' +# +#config plugin 'write_http' +# option enable '0' +# +#config write_http_node +# option name 'foo' +# option URL 'http://example.org/post-collectd' diff --git a/utils/collectd/files/usr/share/collectd/plugin/write_http.json b/utils/collectd/files/usr/share/collectd/plugin/write_http.json new file mode 100644 index 000000000..2c63c0851 --- /dev/null +++ b/utils/collectd/files/usr/share/collectd/plugin/write_http.json @@ -0,0 +1,2 @@ +{ +}