From ece3f87065ea6c19e7510aed80a3b5fa2f72c54c Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Sat, 14 May 2022 16:26:52 +0800 Subject: [PATCH] rename plugin http_response --- agent/agent.go | 2 +- .../http_response.toml} | 10 +++++----- .../{httpresponse => http_response}/README.md | 0 .../alerts.json | 2 +- inputs/http_response/dashboard.json | 19 +++++++++++++++++++ .../http_response.go} | 4 ++-- inputs/{httpresponse => http_response}/tls.go | 2 +- inputs/httpresponse/dashboard.json | 19 ------------------- 8 files changed, 29 insertions(+), 29 deletions(-) rename conf/{input.httpresponse/httpresponse.toml => input.http_response/http_response.toml} (93%) rename inputs/{httpresponse => http_response}/README.md (100%) rename inputs/{httpresponse => http_response}/alerts.json (91%) create mode 100644 inputs/http_response/dashboard.json rename inputs/{httpresponse/httpresponse.go => http_response/http_response.go} (99%) rename inputs/{httpresponse => http_response}/tls.go (93%) delete mode 100644 inputs/httpresponse/dashboard.json diff --git a/agent/agent.go b/agent/agent.go index e7f0e81..1d6a317 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -18,7 +18,7 @@ import ( _ "flashcat.cloud/categraf/inputs/disk" _ "flashcat.cloud/categraf/inputs/diskio" _ "flashcat.cloud/categraf/inputs/exec" - _ "flashcat.cloud/categraf/inputs/httpresponse" + _ "flashcat.cloud/categraf/inputs/http_response" _ "flashcat.cloud/categraf/inputs/kernel" _ "flashcat.cloud/categraf/inputs/kernelvmstat" _ "flashcat.cloud/categraf/inputs/linuxsysctlfs" diff --git a/conf/input.httpresponse/httpresponse.toml b/conf/input.http_response/http_response.toml similarity index 93% rename from conf/input.httpresponse/httpresponse.toml rename to conf/input.http_response/http_response.toml index 30c1eb5..2d24d35 100644 --- a/conf/input.httpresponse/httpresponse.toml +++ b/conf/input.http_response/http_response.toml @@ -1,11 +1,11 @@ # # collect interval # interval = 15 -# [[instances]] -# targets = [ -# "http://localhost", -# "https://www.baidu.com" -# ] +[[instances]] +targets = [ + "http://localhost", + "https://www.baidu.com" +] # # append some labels for series # labels = { region="cloud", product="n9e" } diff --git a/inputs/httpresponse/README.md b/inputs/http_response/README.md similarity index 100% rename from inputs/httpresponse/README.md rename to inputs/http_response/README.md diff --git a/inputs/httpresponse/alerts.json b/inputs/http_response/alerts.json similarity index 91% rename from inputs/httpresponse/alerts.json rename to inputs/http_response/alerts.json index 847c459..3908400 100644 --- a/inputs/httpresponse/alerts.json +++ b/inputs/http_response/alerts.json @@ -5,7 +5,7 @@ "severity": 2, "disabled": 0, "prom_for_duration": 60, - "prom_ql": "httpresponse_result_code != 0", + "prom_ql": "http_response_result_code != 0", "prom_eval_interval": 15, "enable_stime": "00:00", "enable_etime": "23:59", diff --git a/inputs/http_response/dashboard.json b/inputs/http_response/dashboard.json new file mode 100644 index 0000000..a77b0fb --- /dev/null +++ b/inputs/http_response/dashboard.json @@ -0,0 +1,19 @@ +[ + { + "name": "HTTP探测", + "tags": "", + "configs": "", + "chart_groups": [ + { + "name": "Default chart group", + "weight": 0, + "charts": [ + { + "configs": "{\"targets\":[{\"refId\":\"A\",\"expr\":\"max(http_response_result_code) by (target)\",\"legend\":\"UP?\"},{\"expr\":\"max(http_response_response_code) by (target)\",\"refId\":\"B\",\"legend\":\"status code\"},{\"expr\":\"max(http_response_response_time) by (target)\",\"refId\":\"C\",\"legend\":\"latency(s)\"},{\"expr\":\"max(http_response_cert_expire_timestamp) by (target) - time()\",\"refId\":\"D\",\"legend\":\"cert expire\"}],\"name\":\"URL Details\",\"custom\":{\"showHeader\":true,\"calc\":\"lastNotNull\",\"displayMode\":\"labelValuesToRows\",\"aggrDimension\":\"target\"},\"options\":{\"valueMappings\":[],\"standardOptions\":{}},\"overrides\":[{\"properties\":{\"valueMappings\":[{\"type\":\"special\",\"match\":{\"special\":0},\"result\":{\"text\":\"UP\",\"color\":\"#417505\"}},{\"type\":\"range\",\"match\":{\"special\":1,\"from\":1},\"result\":{\"text\":\"DOWN\",\"color\":\"#e90f0f\"}}],\"standardOptions\":{}},\"matcher\":{\"value\":\"A\"}},{\"type\":\"special\",\"matcher\":{\"value\":\"D\"},\"properties\":{\"standardOptions\":{\"util\":\"humantimeSeconds\"}}}],\"version\":\"2.0.0\",\"type\":\"table\",\"layout\":{\"h\":4,\"w\":24,\"x\":0,\"y\":0,\"i\":\"0\"}}", + "weight": 0 + } + ] + } + ] + } +] \ No newline at end of file diff --git a/inputs/httpresponse/httpresponse.go b/inputs/http_response/http_response.go similarity index 99% rename from inputs/httpresponse/httpresponse.go rename to inputs/http_response/http_response.go index 294e39a..9681e11 100644 --- a/inputs/httpresponse/httpresponse.go +++ b/inputs/http_response/http_response.go @@ -1,4 +1,4 @@ -package httpresponse +package http_response import ( "errors" @@ -24,7 +24,7 @@ import ( ) const ( - inputName = "httpresponse" + inputName = "http_response" Success uint64 = 0 ConnectionFailed uint64 = 1 diff --git a/inputs/httpresponse/tls.go b/inputs/http_response/tls.go similarity index 93% rename from inputs/httpresponse/tls.go rename to inputs/http_response/tls.go index 3f26551..ed49287 100644 --- a/inputs/httpresponse/tls.go +++ b/inputs/http_response/tls.go @@ -1,4 +1,4 @@ -package httpresponse +package http_response import ( "crypto/tls" diff --git a/inputs/httpresponse/dashboard.json b/inputs/httpresponse/dashboard.json deleted file mode 100644 index 379b2a0..0000000 --- a/inputs/httpresponse/dashboard.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "name": "HTTP探测", - "tags": "", - "configs": "", - "chart_groups": [ - { - "name": "Default chart group", - "weight": 0, - "charts": [ - { - "configs": "{\"targets\":[{\"refId\":\"A\",\"expr\":\"max(httpresponse_result_code) by (target)\",\"legend\":\"UP?\"},{\"expr\":\"max(httpresponse_response_code) by (target)\",\"refId\":\"B\",\"legend\":\"status code\"},{\"expr\":\"max(httpresponse_response_time) by (target)\",\"refId\":\"C\",\"legend\":\"latency(s)\"},{\"expr\":\"max(httpresponse_cert_expire_timestamp) by (target) - time()\",\"refId\":\"D\",\"legend\":\"cert expire\"}],\"name\":\"URL Details\",\"custom\":{\"showHeader\":true,\"calc\":\"lastNotNull\",\"displayMode\":\"labelValuesToRows\",\"aggrDimension\":\"target\"},\"options\":{\"valueMappings\":[],\"standardOptions\":{}},\"overrides\":[{\"properties\":{\"valueMappings\":[{\"type\":\"special\",\"match\":{\"special\":0},\"result\":{\"text\":\"UP\",\"color\":\"#417505\"}},{\"type\":\"range\",\"match\":{\"special\":1,\"from\":1},\"result\":{\"text\":\"DOWN\",\"color\":\"#e90f0f\"}}],\"standardOptions\":{}},\"matcher\":{\"value\":\"A\"}},{\"type\":\"special\",\"matcher\":{\"value\":\"D\"},\"properties\":{\"standardOptions\":{\"util\":\"humantimeSeconds\"}}}],\"version\":\"2.0.0\",\"type\":\"table\",\"layout\":{\"h\":4,\"w\":24,\"x\":0,\"y\":0,\"i\":\"0\"}}", - "weight": 0 - } - ] - } - ] - } -] \ No newline at end of file