Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

[Bug]: ebpf.plugin runs the wrong action for most command-line options; --unittest never runs the unit tests

Ouverte Adaptée aux débutants
#24,062 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
78/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
c, linux

Piste de recherche

Lisez src/collectors/ebpf.plugin/ebpf.c, en particulier ebpf_parse_args(), ainsi que src/collectors/ebpf.plugin/ebpf_apps.h et la définition de long_options[]. Exécutez ebpf.plugin --help, --global et --unittest pour reproduire le dispatch décalé, puis vérifiez que chaque option documentée sélectionne l’action prévue et que --unittest se termine avec le résultat du test unitaire.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug needs triage
Bug description

ebpf.plugin picks the action for a long option by the option's position in long_options[] (switch (option_index) in ebpf_parse_args(), src/collectors/ebpf.plugin/ebpf.c). That only works while the array lines up with enum ebpf_main_index (src/collectors/ebpf.plugin/ebpf_apps.h).

#15214 (commit 929b19f48, first released in v1.41.0) added EBPF_MODULE_FUNCTION_IDX to the enum without a matching entry in long_options[]. Since then, every option from --all onwards runs the action of the option after it:

Option What it actually does
--all nothing (there's no case for EBPF_MODULE_FUNCTION_IDX)
--version enables all charts and starts collecting (the --all action)
--help prints the version and exits
--global prints the help and exits
--return disables per-application and cgroup charts (the --global action)
--legacy selects return mode
--core selects legacy mode
--unittest selects CO-RE and starts collecting, so the unit tests never run

An unrecognized option is affected too. It leaves option_index at its previous value (0 at startup), so it's treated as --process.

⚠️ Impact:

  • ebpf.plugin --unittest hasn't run its unit tests since v1.41.0, so any regression they'd catch has gone unnoticed.
  • Running the plugin by hand with options does something other than what --help documents. --version and --unittest even start the collector.
  • Normal operation isn't affected: netdata starts the plugin with only the update-frequency argument.

The table is from master @ 4464a9ed7. v2.11.1 has the same shift, with the modules later moved to ebpf-go.plugin still in its option list.

Expected behavior

Every option does what ebpf.plugin --help documents. --unittest runs the unit tests and exits with their result.

Steps to reproduce

Both commands below exit immediately.

  1. sudo /usr/libexec/netdata/plugins.d/ebpf.plugin --help prints the version (ebpf.plugin v2.11.1) instead of the help text.
  2. sudo /usr/libexec/netdata/plugins.d/ebpf.plugin --global prints the help text instead of disabling the per-application and cgroup charts.
Installation method

kickstart.sh

System info
Linux <hostname> 7.0.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Aug  1 04:26:38 UTC 2026 x86_64 GNU/Linux
/etc/lsb-release:DISTRIB_ID=Ubuntu
/etc/lsb-release:DISTRIB_RELEASE=26.04
/etc/lsb-release:DISTRIB_CODENAME=resolute
/etc/lsb-release:DISTRIB_DESCRIPTION="Ubuntu 26.04.1 LTS"
/etc/os-release:PRETTY_NAME="Ubuntu 26.04.1 LTS"
/etc/os-release:NAME="Ubuntu"
/etc/os-release:VERSION_ID="26.04"
/etc/os-release:VERSION="26.04.1 LTS (Resolute Raccoon)"
/etc/os-release:VERSION_CODENAME=resolute
/etc/os-release:ID=ubuntu
/etc/os-release:ID_LIKE=debian
/etc/os-release:UBUNTU_CODENAME=resolute
/etc/os-release:LOGO=ubuntu-logo
Netdata build info
Packaging:
    Netdata Version ____________________________________________ : v2.11.1
    Installation Type __________________________________________ : binpkg-deb
    Package Architecture _______________________________________ : x86_64
    Package Distro _____________________________________________ : ubuntu 26.04
    Configure Options __________________________________________ : cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_STANDARD=11 -DCMAKE_CXX_STANDARD=17 -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=' -fexceptions -fno-omit-frame-pointer -funwind-tables -fasynchronous-unwind-tables' -DCMAKE_CXX_FLAGS='  -fexceptions -fno-omit-frame-pointer -funwind-tables -fasynchronous-unwind-tables' -DCMAKE_COMPILE_DEFINITIONS='_GNU_SOURCE' -DCMAKE_EXE_LINKER_FLAGS=' -fexceptions -rdynamic' -DCMAKE_SHARED_LINKER_FLAGS=''
Default Directories:
    User Configurations ________________________________________ : /etc/netdata
    Stock Configurations _______________________________________ : /usr/lib/netdata/conf.d
    Stock Data Files ___________________________________________ : /usr/share/netdata
    Ephemeral Databases (metrics data, metadata) _______________ : /var/cache/netdata
    Permanent Databases ________________________________________ : /var/lib/netdata
    Plugins ____________________________________________________ : /usr/libexec/netdata/plugins.d
    Static Web Files ___________________________________________ : /usr/share/netdata/web
    Log Files __________________________________________________ : /var/log/netdata
    Lock Files _________________________________________________ : /var/lib/netdata/lock
    Home _______________________________________________________ : /var/lib/netdata
Operating System:
    Kernel _____________________________________________________ : Linux
    Kernel Version _____________________________________________ : 7.0.0-31-generic
    Operating System ___________________________________________ : Ubuntu
    Operating System ID ________________________________________ : ubuntu
    Operating System ID Like ___________________________________ : debian
    Operating System Version ___________________________________ : 26.04.1 LTS (Resolute Raccoon)
    Operating System Version ID ________________________________ : 26.04
    Detection __________________________________________________ : /etc/os-release
Hardware:
    CPU Cores __________________________________________________ : 4
    CPU Frequency ______________________________________________ : 2400000000
    RAM Bytes __________________________________________________ : 16178053120
    Disk Capacity ______________________________________________ : 137438953472
    CPU Architecture ___________________________________________ : x86_64
    Virtualization Technology __________________________________ : vmware
    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 ______________________________________________ : YES
    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
    Memory Allocator ___________________________________________ : system
Database Engines:
    sqlite _____________________________________________________ : 3.53.4
    dbengine (compression) _____________________________________ : YES (zstd lz4)
    alloc ______________________________________________________ : YES
    ram ________________________________________________________ : YES
    none _______________________________________________________ : YES
Connectivity Capabilities:
    ACLK (Agent-Cloud Link: MQTT over WebSockets over TLS) _____ : YES
    static (Netdata internal 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) ____ : YES (system)
    OpenSSL (cryptography) _____________________________________ : YES
    libdatachannel (stand-alone WebRTC data channels) __________ : NO
    JSON-C (lightweight JSON manipulation) _____________________ : YES
    libcap (Linux capabilities system operations) ______________ : NO
    libcrypto (cryptographic functions) ________________________ : YES
    libyaml (library for parsing and emitting YAML) ____________ : YES
    libmnl (library for working with netfilter) ________________ : YES
    stacktraces (library for getting stack traces) _____________ : libbacktrace (mmap, threads, data)
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
    macos-logs (monitor macOS unified logs) ____________________ : NO
    windows (monitor Windows 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) _____________________ : YES
    ebpf (monitor system calls) ________________________________ : YES
    freeipmi (monitor enterprise server H/W) ___________________ : YES
    network-viewer (monitor TCP/UDP IPv4/6 sockets) ____________ : YES
    systemd-journal (monitor journal logs) _____________________ : YES
    windows-events (monitor Windows events) ____________________ : NO
    nfacct (gather netfilter accounting) _______________________ : YES
    perf (collect kernel performance events) ___________________ : YES
    slabinfo (monitor kernel object caching) ___________________ : YES
    Xen ________________________________________________________ : YES
    Xen VBD Error Tracking _____________________________________ : NO
Exporters:
    AWS Kinesis ________________________________________________ : NO
    GCP PubSub _________________________________________________ : NO
    MongoDB ____________________________________________________ : NO
    Prometheus (OpenMetrics) Exporter __________________________ : YES
    Prometheus Remote Write ____________________________________ : YES
    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
Runtime Information:
    Profile ____________________________________________________ : standalone
    Stream Parent (accept data from Children) __________________ : NO
    Stream Child (send data to a Parent) _______________________ : NO
    Total System Memory ________________________________________ : 16178053120
    Available System Memory ____________________________________ : 3741184000
Additional info

Found while adding a regression test to --unittest for another ebpf.plugin bug.

Langage dominant
Go
Étoiles
80.6k
Forks
6.6k
Merge moyen
15 h 8 min
PR mergées (30 j)
303

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de netdata/netdata

Toutes les issues de netdata/netdata

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.