Drop superfluous and overly pedantic typecasting for values that fit
within 32 bits or where type comparison is already hinted.
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
Ensure identical factory function name across arch-specific files so
that the common init() function in zfs.go works.
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
Avoid Linux-specific code scattered in two places by moving it to the
already-existing zfs_linux.go.
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
We already support reading from multiple directories though only using globs. Now we can specify them outright.
Example use case is exporting both static info on a RO FS generated during image building and traditional uses of textfiles (e.g. for R/W service metrics files) without scripting a file copy.
* keep flag name for compatibility
* clarify flag help text
* add test case (replicating the glob one)
Signed-off-by: eduarrrd <eduarrrd@users.noreply.github.com>
node_exporter has reasonable defaults so it is able to start without explicit config.
Such a setup is common in /usr/-only images where /etc/ is an empty tmpfs upon boot.
Signed-off-by: Nils K <24257556+septatrix@users.noreply.github.com>
This PR adds a `exclude[]` URL parameter to exclude specific enabled collectors.
Compared to `collect[]` parameter, the `exclude[]` parameter results in a filtered list which equals enabled collectors minus excluded ones.
Signed-off-by: Siavash Safi <git@hosted.run>
In order to reduce cardinality of the interrupts collector add
filtering options
* Add include/exclude regexp filter flags.
* Add boolean flag to include zero values, enabled by default.
Signed-off-by: Ben Kochie <superq@gmail.com>
* collector/zfs: Prevent `procfs` integer underflow
Prevent integer underflow when parsing the `procfs` file as it used a
`ParseUint` to parse signed values.
Fixes: #2766
---------
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
* ref!: convert linux meminfo implementation to use procfs lib
Part of #2957
Prometheus' procfs lib supports collecting memory info and we're using a
new enough version of the lib that has it available, so this converts
the meminfo collector for Linux to use data from procfs lib instead. The
bits I've touched for darwin/openbsd/netbsd are with intent to preserve
the original struct implementation/backwards compatibility.
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
* fix: meminfo debug log unsupported value
Fixes:
```
ts=2024-06-11T19:04:55.591Z caller=meminfo.go:44 level=debug collector=meminfo msg="Set node_mem" memInfo="unsupported value type"
```
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
* fix: don't coerce nil Meminfo entries to 0, leave out if nil
Nil entries in procfs.Meminfo fields indicate that the value isn't
present on the system. Coercing those nil values to `0` introduces new
metrics on systems that should not be present and can break some
queries.
Addresses PR feedback:
https://github.com/prometheus/node_exporter/pull/3049#discussion_r1637581536https://github.com/prometheus/node_exporter/pull/3049#discussion_r1637584482
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
---------
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
Automatically add a uid to each dashboard.
This prevents changing URLs when restarting a grafana pod and
re-importing the dashboards via ConfigMaps.
Signed-off-by: Stefan Andres <sandres@anaconda.com>
* Add include and exclude filter for sensors in hwmon collector
Fixes#2242
This commit adds two new flags (`collector.hwmon.sensor-include` and `collector.hwmon.sensor-exclude`) to the `hwmon` collector to allow inclusion or exclusion of specific sensors.
Some devices export nonsensical values for certain sensors. Here is an example:
```
node_hwmon_temp_celsius{chip="platform_nct6775_656",sensor="temp13"} 49.75
node_hwmon_temp_celsius{chip="platform_nct6775_656",sensor="temp15"} 3.892313987e+06
node_hwmon_temp_celsius{chip="platform_nct6775_656",sensor="temp16"} 3.892313987e+06
```
As a user I would like to only exclude these sensors, not necessarily the complete device (as is currently possible with the `--collector.hwmon.chip-exclude` flag) as other sensor values might be sensical or desired.
The new option filters based both on device name and sensor name, separated by a semicolon. For example, to exclude the two sensors above, the following regex can be used:
~~~
--collector.hwmon.sensor-exclude="platform_nct6775_656;temp1[5,6]"
~~~
---------
Signed-off-by: Simon Krenger <skrenger@redhat.com>
Running "go test" in the collector directory, without the fixtures
available, results in multiple panics, including `SIGSEGV`. Most of
these are due to incorrect error handling. This cleans them up.
Signed-off-by: Benny Siegert <bsiegert@gmail.com>