Giter Site home page Giter Site logo

node-red-contrib-prometheus-exporter's Issues

Metric name has already been registered

The prometheus out node works fine after I click deploy the first time with a new metric name, and the metric shows up on the /metrics page.

But if I click on deploy a second time it will give me two errors in the debug panel:

  1. "Error: A metric with the name metric_name has already been registered."
  2. "Missing metric configuration"

And the nodered /metrics page becomes blank.

Allow metric name to be set via environment variable

At the moment, the Metric Name (and description) are statically settable only.
It would be great to have the possibility to use ENV variable, eg. similar to what is done with MQTT IN and OUT nodes.
I understand it can't be totally dynamic (through msg.payload.something). However, as ENV variables are initialized at runtime it would be a good solution. IMHO.
Thanks for the node anyway :)

Cannot set property of non object

I am having problems with this node:
[{"id":"cc08c4d980616d50","type":"rpi-gpio in","z":"4e4990f3.d4ada","name":"Digi1","pin":"33","intype":"tri","debounce":"250","read":true,"x":190,"y":560,"wires":[["eac0b39954ba4df6","4b48f8c4ecf91f7a","7642286748afd7c9"]]},{"id":"eac0b39954ba4df6","type":"debug","z":"4e4990f3.d4ada","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":350,"y":540,"wires":[]},{"id":"4b48f8c4ecf91f7a","type":"influxdb out","z":"4e4990f3.d4ada","influxdb":"b87cafc6.11924","name":"Digi1-Influx","measurement":"Digi1","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":350,"y":580,"wires":[]},{"id":"7642286748afd7c9","type":"change","z":"4e4990f3.d4ada","name":"prom-exporter-digi1","rules":[{"t":"set","p":"payload.val","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"payload.op","pt":"msg","to":"set","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":560,"wires":[["d6a1c7879f44da0b"]]},{"id":"d6a1c7879f44da0b","type":"prometheus-exporter","z":"4e4990f3.d4ada","name":"","metric":"8ae66ae189b4f751","x":810,"y":560,"wires":[]},{"id":"b87cafc6.11924","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"datastorage","name":"","usetls":false,"tls":"","influxdbVersion":"1.x","url":"http://localhost:8086","rejectUnauthorized":true},{"id":"8ae66ae189b4f751","type":"prometheus-metric-config","name":"raspberrypi_digi1","help":"Digi 1","labels":"","mtype":"counter"}]

The errors are generated on status change of the pin. I have a node detecting if the GPIO is high or low and posting a 0/1 output. However, every time the status change, errors are generated. I did try in both configurations gauge and counter but I always get the same type of error.
I have other 5 nodes working properly in the same flow but this one is giving me troubles and I do not understand why.

Schermata 2021-08-29 alle 15 51 19

Schermata 2021-08-29 alle 15 50 52

Feature Request: Add possibility to delete/clear a metric

Hi,
for certain reasons we need to "delete" specific exposed metrics.
So it would be nice if you can add a "del" operation.

This operation should remove the currently exposed metric (minding the given labels) from the /metrics endpoint.
So that Prometheus doesn't retrieve a value.

example:
{ "op": "del", "labels": { "tag_1": "computer_123" } }

No data in metrics

I can't seem to get any output to my Node-RED metrics page.

I've setup a single counter output setup, fed by a Inject node (firing every second) through a Template node:
[{"id":"271e5e391962b383","type":"inject","z":"cae39ee2.e2c898","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":340,"y":200,"wires":[["b74cf7ca73e55ee4"]]},{"id":"b74cf7ca73e55ee4","type":"template","z":"cae39ee2.e2c898","name":"","field":"payload","fieldType":"msg","format":"json","syntax":"plain","template":"{\n \"op\": \"inc\"\n}","output":"str","x":560,"y":100,"wires":[["ea8507f4388b7b5f","106518794a79dd30"]]},{"id":"ea8507f4388b7b5f","type":"prometheus-exporter","z":"cae39ee2.e2c898","name":"metric_temp-BK","metric":"f7b80ed39105d802","x":740,"y":100,"wires":[]},{"id":"f7b80ed39105d802","type":"prometheus-metric-config","name":"temp-BK","help":"Boil kettle temperaure","labels":"","mtype":"counter"}]

Am I missing something?
The SERVERIP:1880/metrics page is simply blank.

Everything is running directly on metal - no docker, iptables or anything else set.

Program versions:
node-red-contrib-prometheus-exporter v1.0.5

Prometheus version:
prometheus, version 2.29.1 (branch: HEAD, revision: dcb07e8eac34b5ea37cd229545000b857f1c1637)
build user: root@9f54ccae6d42
build date: 20210811-14:38:07
go version: go1.16.7
platform: linux/arm

node_exporter, version 1.2.2 (branch: HEAD, revision: 26645363b486e12be40af7ce4fc91e731a33104e)
build user: root@1c3411405b8f
build date: 20210806-13:43:27
go version: go1.16.7
platform: linux/arm

Node-RED version: v2.0.5
Node.js version: v14.17.3
Linux 5.10.52+ arm LE

Running on RPi Zero W
Linux raspberrypi 5.10.52+ #1441 Tue Aug 3 18:08:18 BST 2021 armv6l GNU/Linux

/metrics returns a 404

Hi,

I've installed the exporter on my Node-red instance living inside an Home Assistant OS.
I can setup the prometheus out node and I can access the Node-red instance directly (not wrapped inside the Home Assistant gui) by accessing it via the port 1880.

When I try to access the metrics by going to http://my_server_ip:1880/metrics, I get a 404.
All I did is setup the prometheus out node with data coming from an inject node, am I missing anything?

Thank you very much in advance!

Add examples

Example flows should be added to the examples section of the node.

Issue with how the configuration node applies styles

The style rules applied to the config dialog are applied not just to the Prometheus configuration but to all nodes.

The fix is relatively easy and would prevent the Prometheus node from interfering with CSS rules applied to other nodes.

For example the ones we have been developing.

See my PR

Error on new deployment

The following error is logged in the NodeRED debug console on complete deployment:

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Registry'
    |     property '_metrics' -> object with constructor 'Object'
    |     property 'MY_METRIC' -> object with constructor 'Gauge'
    |     property 'registers' -> object with constructor 'Array'
    --- index 0 closes the circle

Labels are not optional in configuration

Hi,

leaving the labels empty in the configuration lead to this error:

27 Mar 18:40:18 - [error] [prometheus-metric-config:c33c5a05.e101f8] TypeError: Cannot read property 'length' of undefined

Having at least 1 label fix this issue, while labels should be optional.

A PR will follow.
Kind regards,

Changing label values for gauges

I'm looking for a feature where if the label changes, that the previous metric is deleted. And a new one with the new label value is created. I understand that the current behavior is also favorable for some scenarios. For counters this would make sense not for gauges.

Current behavior:
Let's say you set a metric with label A to 100. If you now change the label to B you get two lines.

metric{label="A"} 100
metric{label="B"} 100

Wanted behavior:
Let's say you set a metric with label A to 100. If you now change the label to B you get one line.

metric{label="B"} 100

This way if you do sum(metric) you always get 100, instead of 200 with the previous method.
However this should not always be the case. You can have some labels that do this, some that don't
Let's say you have two power meters that have a tarrif. If the tarrif changes, you don't want extra lines, however you do want two lines, one for each meter.

power{meter="1", tariff="B"} 100
power{meter="2", tariff="A"} 50

Now if you do sum by (tariff) (power) you get A=50, B=100

If there was some way to delete a metric, or do a label update without creating a new line, this would be possible.
Or perhaps you could configure which labels are changeable and which labels branch out the metric.

In counter have a set value option

Would be handy to have a set value option in the counter like guage. The source I'm using (Total kWh in a energy meter) so I just need to set the value not increase it by a certain amount.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.