[Bug]: Runing netdata plugin from nested directory uses wrong config dir
rhoriguchi opened this issue · 1 comments
rhoriguchi commented
Bug description
When running netdata plugin from /nix/store/65d3bnd96b0s5jynnxbrj5py3f44k4b3-netdata-1.45.0/libexec/netdata/plugins.d/go.d.plugin
it causes the config location to be wrong.
> sudo -u netdata /nix/store/65d3bnd96b0s5jynnxbrj5py3f44k4b3-netdata-1.45.0/libexec/netdata/plugins.d/go.d.plugin -d -m windows
DBG godplugin/main.go:145 plugin: name=go.d, version=1.45.0.0 component=agent
DBG godplugin/main.go:147 current user: name=netdata, uid=991 component=agent
INF godplugin/main.go:151 env HTTP_PROXY '', HTTPS_PROXY '' component=agent
INF agent/agent.go:145 instance is started component=agent
INF agent/setup.go:23 loading config file component=agent
DBG agent/setup.go:31 looking for 'go.d.conf' in [/nix/store/etc/netdata /nix/store/usr/lib/netdata/conf.d] component=agent
WRN agent/setup.go:35 couldn't find config, will use defaults component=agent
INF agent/agent.go:149 using config: enabled 'true', default_run 'true', max_procs '0' component=agent
INF agent/setup.go:50 loading modules component=agent
INF agent/setup.go:73 enabled/registered modules: 1/77 component=agent
INF agent/setup.go:79 building discovery config component=agent
DBG agent/setup.go:114 looking for 'wmi.conf' in [/nix/store/etc/netdata/go.d /nix/store/usr/lib/netdata/conf.d/go.d] component=agent
DBG agent/setup.go:126 looking for 'windows.conf' in [/nix/store/etc/netdata/go.d /nix/store/usr/lib/netdata/conf.d/go.d] component=agent
INF agent/setup.go:139 couldn't find 'windows' module config, will use default config component=agent
INF agent/setup.go:147 dummy/read/watch paths: 1/0/0 component=agent
INF discovery/manager.go:116 registered discoverers: [dummy discovery service discovery] component="discovery manager"
DBG agent/setup.go:165 looking for 'vnodes/' in [/nix/store/etc/netdata /nix/store/usr/lib/netdata/conf.d] component=agent
INF discovery/manager.go:61 instance is started component="discovery manager"
INF sd/sd.go:66 instance is started component="service discovery"
INF functions/manager.go:50 instance is started component="functions manager"
INF jobmgr/manager.go:87 instance is started component="job manager"
INF dummy/discovery.go:45 instance is started component=discovery discoverer=dummy
DBG functions/ext.go:15 registering function 'config' component="functions manager"
INF dummy/discovery.go:46 instance is stopped component=discovery discoverer=dummy
CONFIG go.d:collector:windows create accepted template /collectors/jobs internal 'internal' 'add schema enable disable test' 0x0000 0x0000
DBG jobmgr/manager.go:122 received configs: 1/+1/-0 ('internal') component="job manager"
CONFIG go.d:collector:windows:windows create accepted job /collectors/jobs stock 'internal' 'schema get enable disable update restart test' 0x0000 0x0000
DBG jobmgr/manager.go:293 creating windows[windows] job, config: map[__provider__:dummy __source__:internal __source_type__:stock autodetection_retry:0 module:windows name:windows priority:70000 update_every:5] component="job manager"
ERR windows/windows.go:123 config validation: 'url' is not set collector=windows job=windows
ERR module/job.go:231 init failed collector=windows job=windows
CONFIG go.d:collector:windows:windows delete
^CINF agent/agent.go:113 received interrupt signal (2). Terminating... component=agent
INF functions/manager.go:51 instance is stopped component="functions manager"
INF discovery/manager.go:62 instance is stopped component="discovery manager"
INF jobmgr/manager.go:88 instance is stopped component="job manager"
INF agent/agent.go:146 instance is stopped component=agent
Expected behavior
Also search /etc/netdata
.
Steps to reproduce
- Copy netdata binary directory to some none default location e. g.
dir="$(mktemp -d)/some/random/directory"
mkdir -p "$dir"
echo "$dir"
- Run any plugin that requires config files
Installation method
other
System info
> uname -a; grep -HvE "^#|URL" /etc/*release
/etc/lsb-release:DISTRIB_CODENAME=uakari
/etc/lsb-release:DISTRIB_DESCRIPTION="NixOS 24.05 (Uakari)"
/etc/lsb-release:DISTRIB_ID=nixos
/etc/lsb-release:DISTRIB_RELEASE="24.05"
/etc/lsb-release:LSB_VERSION="24.05 (Uakari)"
/etc/os-release:ANSI_COLOR="1;34"
/etc/os-release:BUILD_ID="24.05.20240509.f1010e0"
/etc/os-release:ID=nixos
/etc/os-release:IMAGE_ID=""
/etc/os-release:IMAGE_VERSION=""
/etc/os-release:LOGO="nix-snowflake"
/etc/os-release:NAME=NixOS
/etc/os-release:PRETTY_NAME="NixOS 24.05 (Uakari)"
/etc/os-release:VERSION="24.05 (Uakari)"
/etc/os-release:VERSION_CODENAME=uakari
/etc/os-release:VERSION_ID="24.05"
Netdata build info
> /nix/store/65d3bnd96b0s5jynnxbrj5py3f44k4b3-netdata-1.45.0/bin/netdata -W buildinfo
Packaging:
Netdata Version ____________________________________________ : v1.45.0
Installation Type __________________________________________ : unknown
Package Architecture _______________________________________ : unknown
Package Distro _____________________________________________ : unknown
Configure Options __________________________________________ : dummy-configure-command
Default Directories:
User Configurations ________________________________________ : /etc/netdata
Stock Configurations _______________________________________ : /nix/store/65d3bnd96b0s5jynnxbrj5py3f44k4b3-netdata-1.45.0/share/netdata/conf.d
Ephemeral Databases (metrics data, metadata) _______________ : /var/cache/netdata
Permanent Databases ________________________________________ : /var/lib/netdata
Plugins ____________________________________________________ : /nix/store/65d3bnd96b0s5jynnxbrj5py3f44k4b3-netdata-1.45.0/libexec/netdata/plugins.d
Static Web Files ___________________________________________ : /nix/store/65d3bnd96b0s5jynnxbrj5py3f44k4b3-netdata-1.45.0/share/netdata/web
Log Files __________________________________________________ : /var/log/netdata
Lock Files _________________________________________________ : /var/lib/netdata/lock
Home _______________________________________________________ : /var/lib/netdata
Operating System:
Kernel _____________________________________________________ : Linux
Kernel Version _____________________________________________ : 6.8.9
Operating System ___________________________________________ : NixOS
Operating System ID ________________________________________ : nixos
Operating System ID Like ___________________________________ : unknown
Operating System Version ___________________________________ : 24.05 (Uakari)
Operating System Version ID ________________________________ : none
Detection __________________________________________________ : /etc/os-release
Hardware:
CPU Cores __________________________________________________ : 16
CPU Frequency ______________________________________________ : 4463000000
RAM Bytes __________________________________________________ : 32984788992
Disk Capacity ______________________________________________ : 1024209543168
CPU Architecture ___________________________________________ : x86_64
Virtualization Technology __________________________________ : none
Virtualization Detection ___________________________________ : systemd-detect-virt
Container:
Container __________________________________________________ : none
Container Detection ________________________________________ : systemd-detect-virt
Container Orchestrator _____________________________________ : none
Container Operating System _________________________________ : none
Container Operating System ID ______________________________ : none
Container Operating System ID Like _________________________ : none
Container Operating System Version _________________________ : none
Container Operating System Version ID ______________________ : none
Container Operating System Detection _______________________ : none
Features:
Built For __________________________________________________ : Linux
Netdata Cloud ______________________________________________ : NO (unavailable)
Health (trigger alerts and send notifications) _____________ : YES
Streaming (stream metrics to parent Netdata servers) _______ : YES
Back-filling (of higher database tiers) ____________________ : YES
Replication (fill the gaps of parent Netdata servers) ______ : YES
Streaming and Replication Compression ______________________ : YES (zstd lz4 gzip brotli)
Contexts (index all active and archived metrics) ___________ : YES
Tiering (multiple dbs with different metrics resolution) ___ : YES (5)
Machine Learning ___________________________________________ : YES
Database Engines:
dbengine ___________________________________________________ : YES
alloc ______________________________________________________ : YES
ram ________________________________________________________ : YES
none _______________________________________________________ : YES
Connectivity Capabilities:
ACLK (Agent-Cloud Link: MQTT over WebSockets over TLS) _____ : NO
static (Netdata internal web server) _______________________ : YES
h2o (web server) ___________________________________________ : YES
WebRTC (experimental) ______________________________________ : NO
Native HTTPS (TLS Support) _________________________________ : YES
TLS Host Verification ______________________________________ : YES
Libraries:
LZ4 (extremely fast lossless compression algorithm) ________ : YES
ZSTD (fast, lossless compression algorithm) ________________ : YES
zlib (lossless data-compression library) ___________________ : YES
Brotli (generic-purpose lossless compression algorithm) ____ : YES
protobuf (platform-neutral data serialization protocol) ____ : NO
OpenSSL (cryptography) _____________________________________ : YES
libdatachannel (stand-alone WebRTC data channels) __________ : NO
JSON-C (lightweight JSON manipulation) _____________________ : YES
libcap (Linux capabilities system operations) ______________ : YES
libcrypto (cryptographic functions) ________________________ : YES
libyaml (library for parsing and emitting YAML) ____________ : YES
Plugins:
apps (monitor processes) ___________________________________ : YES
cgroups (monitor containers and VMs) _______________________ : YES
cgroup-network (associate interfaces to CGROUPS) ___________ : YES
proc (monitor Linux systems) _______________________________ : YES
tc (monitor Linux network QoS) _____________________________ : YES
diskspace (monitor Linux mount points) _____________________ : YES
freebsd (monitor FreeBSD systems) __________________________ : NO
macos (monitor MacOS systems) ______________________________ : NO
statsd (collect custom application metrics) ________________ : YES
timex (check system clock synchronization) _________________ : YES
idlejitter (check system latency and jitter) _______________ : YES
bash (support shell data collection jobs - charts.d) _______ : YES
debugfs (kernel debugging metrics) _________________________ : YES
cups (monitor printers and print jobs) _____________________ : NO
ebpf (monitor system calls) ________________________________ : NO
freeipmi (monitor enterprise server H/W) ___________________ : YES
nfacct (gather netfilter accounting) _______________________ : YES
perf (collect kernel performance events) ___________________ : YES
slabinfo (monitor kernel object caching) ___________________ : YES
Xen ________________________________________________________ : NO
Xen VBD Error Tracking _____________________________________ : NO
Logs Management ____________________________________________ : YES
Exporters:
AWS Kinesis ________________________________________________ : NO
GCP PubSub _________________________________________________ : NO
MongoDB ____________________________________________________ : NO
Prometheus (OpenMetrics) Exporter __________________________ : YES
Prometheus Remote Write ____________________________________ : NO
Graphite ___________________________________________________ : YES
Graphite HTTP / HTTPS ______________________________________ : YES
JSON _______________________________________________________ : YES
JSON HTTP / HTTPS __________________________________________ : YES
OpenTSDB ___________________________________________________ : YES
OpenTSDB HTTP / HTTPS ______________________________________ : YES
All Metrics API ____________________________________________ : YES
Shell (use metrics in shell scripts) _______________________ : YES
Debug/Developer Features:
Trace All Netdata Allocations (with charts) ________________ : NO
Developer Mode (more runtime checks, slower) _______________ : NO
Additional info
netdata/src/go/collectors/go.d.plugin/cmd/godplugin/main.go
Lines 48 to 56 in d42b9c6
netdata/src/go/collectors/go.d.plugin/cmd/godplugin/main.go
Lines 73 to 81 in d42b9c6
ilyam8 commented
@rhoriguchi hey. This is expected behavior, so it's more of a feature request than a bug. Implemented in #17661.