From 48d854c8ca0f8a716ae9932b8eff796273ca8365 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 16 Dec 2023 16:14:19 +0100 Subject: [PATCH] revert name --- proxy.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/proxy.go b/proxy.go index 3c19fc1..f5fe4ae 100644 --- a/proxy.go +++ b/proxy.go @@ -26,7 +26,6 @@ var ( //shellyAuthUser = flagset.String("shellyplug-auth-username", "", "Shellyplug authentication username (also via SHELLYPLUG_AUTH_USERNAME)") //shellyAuthPass = flagset.String("shellyplug-auth-password", "", "Shellyplug authentication username (also via SHELLYPLUG_AUTH_PASSWORD)") exporterPort = flagset.Int("exporter-port", 5000, "Exporter port (also via EXPORTER_PORT)") - exporterName = flagset.String("exporter-name", "shelly_plug", "Exporter name (also via EXPORTER_NAME)") // additional flags _ = flagset.String("config", "", "Path to config file (ini format)") @@ -160,8 +159,7 @@ func (s *ShellyStatus) Fetch() { func GetMetrics(c *gin.Context) { switch ss.Version { case 1: - c.String(http.StatusOK, `shellyplug_name %s -# HELP shellyplug_power Current power drawn in watts + c.String(http.StatusOK, `# HELP shellyplug_power Current power drawn in watts # TYPE shellyplug_power gauge shellyplug_power %.2f # HELP shellyplug_overpower Overpower drawn in watts/minute @@ -176,10 +174,9 @@ shellyplug_temperature %.2f # HELP shellyplug_uptime Plug uptime in seconds # TYPE shellyplug_uptime gauge shellyplug_uptime %d -`, *exporterName, ss.Status1.Meters[0].Counters[0], float32(0), 0, ss.Status1.Temperature, ss.Status1.Uptime) +`, ss.Status1.Meters[0].Counters[0], float32(0), 0, ss.Status1.Temperature, ss.Status1.Uptime) case 2: - c.String(http.StatusOK, `shellyplug_name %s -# HELP shellyplug_power Current power drawn in watts + c.String(http.StatusOK, `# HELP shellyplug_power Current power drawn in watts # TYPE shellyplug_power gauge shellyplug_power %.2f # HELP shellyplug_overpower Overpower drawn in watts/minute @@ -194,10 +191,9 @@ shellyplug_temperature %.2f # HELP shellyplug_uptime Plug uptime in seconds # TYPE shellyplug_uptime gauge shellyplug_uptime %d -`, *exporterName, ss.Status2.Switch.Power, float32(0), 0, ss.Status2.Switch.Temperature.Celsius, ss.Status2.Sys.Uptime) +`, ss.Status2.Switch.Power, float32(0), 0, ss.Status2.Switch.Temperature.Celsius, ss.Status2.Sys.Uptime) default: - c.String(http.StatusOK, `shellyplug_name %s -# HELP shellyplug_power Current power drawn in watts + c.String(http.StatusOK, `# HELP shellyplug_power Current power drawn in watts # TYPE shellyplug_power gauge shellyplug_power %.2f # HELP shellyplug_overpower Overpower drawn in watts/minute @@ -212,7 +208,7 @@ shellyplug_temperature %.2f # HELP shellyplug_uptime Plug uptime in seconds # TYPE shellyplug_uptime gauge shellyplug_uptime %d -`, *exporterName, float32(0), float32(0), 0, float32(0), 0) +`, float32(0), float32(0), 0, float32(0), 0) } }