From 9d674594792ad9f4f1c95b98a95c15e6e213e7fe Mon Sep 17 00:00:00 2001 From: JMARyA Date: Thu, 12 Dec 2024 08:54:48 +0100 Subject: [PATCH] add node exporter --- technology/applications/Applications.md | 1 + .../applications/utilities/node-exporter.md | 178 ++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 technology/applications/utilities/node-exporter.md diff --git a/technology/applications/Applications.md b/technology/applications/Applications.md index e384cdc..17c6488 100644 --- a/technology/applications/Applications.md +++ b/technology/applications/Applications.md @@ -118,6 +118,7 @@ rev: 2024-07-14 - [Wildcard](utilities/Wildcard.md) - [Textpieces](utilities/Textpieces.md) - [ImHex](utilities/ImHex.md) +- [Node Exporter](utilities/node-exporter.md) # Mobile - [Aegis](./utilities/Aegis.md) diff --git a/technology/applications/utilities/node-exporter.md b/technology/applications/utilities/node-exporter.md new file mode 100644 index 0000000..84a6975 --- /dev/null +++ b/technology/applications/utilities/node-exporter.md @@ -0,0 +1,178 @@ +--- +obj: application +repo: https://github.com/prometheus/node_exporter +rev: 2024-12-12 +--- + +# Prometheus Node Exporter +Prometheus exporter for hardware and OS metrics exposed by *NIX kernels, written in Go with pluggable metric collectors. + +A Dashboard to use with Node Exporter and Grafana can be found [here](https://grafana.com/grafana/dashboards/1860-node-exporter-full/). + +## Usage +The node_exporter listens on HTTP port 9100 by default. + +### Docker +The `node_exporter` is designed to monitor the host system. Deploying in containers requires extra care in order to avoid monitoring the container itself. + +For situations where containerized deployment is needed, some extra flags must be used to allow the `node_exporter` access to the host namespaces. + +Be aware that any non-root mount points you want to monitor will need to be bind-mounted into the container. + +If you start container for host monitoring, specify `path.rootfs` argument. This argument must match path in bind-mount of host root. The `node_exporter` will use `path.rootfs` as prefix to access host filesystem. + +```yml +--- +version: '3.8' + +services: + node_exporter: + image: quay.io/prometheus/node-exporter:latest + container_name: node_exporter + command: + - '--path.rootfs=/host' + network_mode: host + pid: host + restart: unless-stopped + volumes: + - '/:/host:ro,rslave' +``` + +On some systems, the timex collector requires an additional Docker flag, `--cap-add=SYS_TIME`, in order to access the required syscalls. + +### Prometheus +Configure Prometheus to scrape the exposed node exporter: + +```yml +global: + scrape_interval: 15s + +scrape_configs: +- job_name: node + static_configs: + - targets: ['localhost:9100'] +``` + +## Configuration +Node Exporter can be configured using CLI arguments. + +### Options + +| **Option** | **Description** | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- | +| `--path.procfs="/proc"` | procfs mountpoint. | +| `--path.sysfs="/sys"` | sysfs mountpoint. | +| `--path.rootfs="/"` | rootfs mountpoint. | +| `--path.udev.data="/run/udev/data"` | udev data path. | +| `--collector.runit.servicedir="/etc/service"` | Path to runit service directory. | +| `--collector.supervisord.url="http://localhost:9001/RPC2"` | XML RPC endpoint. | +| `--collector.sysctl.include=COLLECTOR.SYSCTL.INCLUDE ...` | Select sysctl metrics to include. | +| `--collector.sysctl.include-info=COLLECTOR.SYSCTL.INCLUDE-INFO ...` | Select sysctl metrics to include as info metrics. | +| `--collector.systemd.unit-include=".+"` | Regexp of systemd units to include. Units must both match include and not match exclude to be included. | +| `--collector.systemd.unit-exclude=".+\\.(automount|device|mount|scope|slice|target)"` | Regexp of systemd units to exclude. Units must both match include and not match exclude to be included. | +| `--collector.systemd.enable-task-metrics` | Enables service unit tasks metrics `unit_tasks_current` and `unit_tasks_max`. | +| `--collector.systemd.enable-restarts-metrics` | Enables service unit metric `service_restart_total`. | +| `--collector.systemd.enable-start-time-metrics` | Enables service unit metric `unit_start_time_seconds`. | +| `--collector.tapestats.ignored-devices="^$"` | Regexp of devices to ignore for tapestats. | +| `--collector.textfile.directory="/var/lib/prometheus/node-exporter"` | Directory to read text files with metrics from. | +| `--collector.vmstat.fields="^(oom_kill|pgpg|pswp|pg.*fault).*"` | Regexp of fields to return for vmstat collector. | +| `--collector.arp` | Enable the arp collector (default: enabled). | +| `--collector.bcache` | Enable the bcache collector (default: enabled). | +| `--collector.bonding` | Enable the bonding collector (default: enabled). | +| `--collector.btrfs` | Enable the btrfs collector (default: enabled). | +| `--collector.buddyinfo` | Enable the buddyinfo collector (default: disabled). | +| `--collector.cgroups` | Enable the cgroups collector (default: disabled). | +| `--collector.conntrack` | Enable the conntrack collector (default: enabled). | +| `--collector.cpu` | Enable the cpu collector (default: enabled). | +| `--collector.cpufreq` | Enable the cpufreq collector (default: enabled). | +| `--collector.diskstats` | Enable the diskstats collector (default: enabled). | +| `--collector.dmi` | Enable the dmi collector (default: enabled). | +| `--collector.drbd` | Enable the drbd collector (default: disabled). | +| `--collector.drm` | Enable the drm collector (default: disabled). | +| `--collector.edac` | Enable the edac collector (default: enabled). | +| `--collector.entropy` | Enable the entropy collector (default: enabled). | +| `--collector.ethtool` | Enable the ethtool collector (default: disabled). | +| `--collector.fibrechannel` | Enable the fibrechannel collector (default: enabled). | +| `--collector.filefd` | Enable the filefd collector (default: enabled). | +| `--collector.filesystem` | Enable the filesystem collector (default: enabled). | +| `--collector.hwmon` | Enable the hwmon collector (default: enabled). | +| `--collector.infiniband` | Enable the infiniband collector (default: enabled). | +| `--collector.interrupts` | Enable the interrupts collector (default: disabled). | +| `--collector.ipvs` | Enable the ipvs collector (default: enabled). | +| `--collector.ksmd` | Enable the ksmd collector (default: disabled). | +| `--collector.lnstat` | Enable the lnstat collector (default: disabled). | +| `--collector.loadavg` | Enable the loadavg collector (default: enabled). | +| `--collector.logind` | Enable the logind collector (default: disabled). | +| `--collector.mdadm` | Enable the mdadm collector (default: enabled). | +| `--collector.meminfo` | Enable the meminfo collector (default: enabled). | +| `--collector.meminfo_numa` | Enable the meminfo_numa collector (default: disabled). | +| `--collector.mountstats` | Enable the mountstats collector (default: disabled). | +| `--collector.netclass` | Enable the netclass collector (default: enabled). | +| `--collector.netdev` | Enable the netdev collector (default: enabled). | +| `--collector.netstat` | Enable the netstat collector (default: enabled). | +| `--collector.network_route` | Enable the network_route collector (default: disabled). | +| `--collector.nfs` | Enable the nfs collector (default: enabled). | +| `--collector.nfsd` | Enable the nfsd collector (default: enabled). | +| `--collector.ntp` | Enable the ntp collector (default: disabled). | +| `--collector.nvme` | Enable the nvme collector (default: enabled). | +| `--collector.os` | Enable the os collector (default: enabled). | +| `--collector.perf` | Enable the perf collector (default: disabled). | +| `--collector.powersupplyclass` | Enable the powersupplyclass collector (default: enabled). | +| `--collector.pressure` | Enable the pressure collector (default: enabled). | +| `--collector.processes` | Enable the processes collector (default: disabled). | +| `--collector.qdisc` | Enable the qdisc collector (default: disabled). | +| `--collector.rapl` | Enable the rapl collector (default: enabled). | +| `--collector.runit` | Enable the runit collector (default: disabled). | +| `--collector.schedstat` | Enable the schedstat collector (default: enabled). | +| `--collector.selinux` | Enable the selinux collector (default: enabled). | +| `--collector.slabinfo` | Enable the slabinfo collector (default: disabled). | +| `--collector.sockstat` | Enable the sockstat collector (default: enabled). | +| `--collector.softnet` | Enable the softnet collector (default: enabled). | +| `--collector.stat` | Enable the stat collector (default: enabled). | +| `--collector.supervisord` | Enable the supervisord collector (default: disabled). | +| `--collector.sysctl` | Enable the sysctl collector (default: disabled). | +| `--collector.systemd` | Enable the systemd collector (default: enabled). | +| `--collector.tapestats` | Enable the tapestats collector (default: enabled). | +| `--collector.tcpstat` | Enable the tcpstat collector (default: disabled). | +| `--collector.textfile` | Enable the textfile collector (default: enabled). | +| `--collector.thermal_zone` | Enable the thermal_zone collector (default: enabled). | +| `--collector.time` | Enable the time collector (default: enabled). | +| `--collector.timex` | Enable the timex collector (default: enabled). | +| `--collector.udp_queues` | Enable the udp_queues collector (default: enabled). | +| `--collector.uname` | Enable the uname collector (default: enabled). | +| `--collector.vmstat` | Enable the vmstat collector (default: enabled). | +| `--collector.wifi` | Enable the wifi collector (default: disabled). | +| `--collector.xfs` | Enable the xfs collector (default: enabled). | +| `--collector.zfs` | Enable the zfs collector (default: enabled). | +| `--collector.zoneinfo` | Enable the zoneinfo collector (default: disabled). | +| `--web.telemetry-path="/metrics"` | Path under which to expose metrics. | +| `--web.disable-exporter-metrics` | Exclude metrics about the exporter itself (`promhttp_*`, `process_*`, `go_*`). | +| `--web.max-requests=40` | Maximum number of parallel scrape requests. Use 0 to disable. | +| `--collector.disable-defaults` | Set all collectors to disabled by default. | +| `--runtime.gomaxprocs=1` | The target number of CPUs Go will run on (`GOMAXPROCS`). | +| `--web.systemd-socket` | Use systemd socket activation listeners instead of port listeners (Linux only). | +| `--web.listen-address=:9100 ...` | Addresses on which to expose metrics and web interface. Repeatable for multiple addresses. | +| `--web.config.file=""` | [EXPERIMENTAL] Path to configuration file that can enable TLS or authentication. | +| `--log.level=info` | Only log messages with the given severity or above. One of: `[debug, info, warn, error]`. | +| `--log.format=logfmt` | Output format of log messages. One of: `[logfmt, json]`. | + +### Web Configuration +Exporters and services instrumented with the Exporter Toolkit share the same web configuration file format. This is experimental and might change in the future. + +To specify which web configuration file to load, use the `--web.config.file` flag. + +Basic config file: +```yml +# TLS and basic authentication configuration example. +# +# Additionally, a certificate and a key file are needed. +tls_server_config: + cert_file: server.crt + key_file: server.key + +# Usernames and passwords required to connect. +# Passwords are hashed with bcrypt: https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md#about-bcrypt. +basic_auth_users: + alice: $2y$10$mDwo.lAisC94iLAyP81MCesa29IzH37oigHC/42V2pdJlUprsJPze + bob: $2y$10$hLqFl9jSjoAAy95Z/zw8Ye8wkdMBM8c5Bn1ptYqP/AXyV0.oy0S8m +```