Skip to content

Latest commit

 

History

History
142 lines (110 loc) · 8.57 KB

CLAUDE.md

File metadata and controls

142 lines (110 loc) · 8.57 KB

node_exporter (CloudLinux fork)

This repository is CloudLinux's fork of the upstream prometheus/node_exporter. It is packaged as cl-node-exporter (RPM) and cl-node-exporter (deb) and is consumed internally by the cl_plus telemetry stack. Upstream master is merged in periodically; all CloudLinux-specific changes live on top of the upstream history.

Current upstream base: v1.13.1 (0192dd89), merged in CLOS-9230. Update this line with every upstream sync.

What the fork adds

The fork is deliberately small. Out of the box upstream, plus:

  1. A unix-socket transport for /metrics (--web.socket-path, --web.socket-permissions), hooked into upstream's exporter-toolkit bootstrap startup through the metrics handler factory.
  2. CloudLinux packaging recipes (node_exporter.spec, debian/).
  3. A versioned tests subpackage at /opt/node_exporter_tests/, run by QA's rpm_tests/p_cl-node-exporter in the Build System RPM tests.
  4. A /usr/share/cloudlinux/cl-node-exporter version file, read by Sentry for package-version tagging.
  5. A Makefile change that runs test-e2e twice (TCP + unix-socket) so the fork-local feature is exercised by make in GitHub Actions and locally (the RPM/deb builds run make test, not test-e2e).

Everything else in this repo — collectors, metric semantics, command-line flags, build targets — is upstream and should be understood by reading upstream documentation, not by treating this repo as authoritative.

Design Specifications

This project maintains design specs for the features where business rules, invariants, and CloudLinux-specific decisions are not obvious from source code. Check the index below before starting work — read any spec that relates to your task. If your changes affect behavior described in a spec, update the spec in the same commit.

  • Unix Socket Listener — --web.socket-path, --web.socket-permissions, unix domain socket, cl_plus scraping, socket cleanup, SIGTERM shutdown, e2e -s flag, node_exporter.go main
  • CloudLinux Packaging — cl-node-exporter RPM, deb, node_exporter.spec, debian/rules, /usr/share/cloudlinux/cl_plus/, version file, Sentry tagging, tests subpackage, pinned Go toolchain, amd64-only

Working on this fork

  • Before changing CloudLinux-specific code (unix socket, RPM/deb recipes, /usr/share/cloudlinux/* layout): read the relevant design spec first, and update it in the same commit as your code change.
  • Before changing upstream-owned files (anything under collector/, node_exporter.go outside the unix-socket block, Makefile targets not listed above): prefer forwarding the change upstream. Fork-local diffs make the next upstream sync harder.
  • Upstream syncs: history from upstream is merged periodically (see commits tagged Sync ... with upstream). When resolving conflicts, preserve every CloudLinux-specific invariant listed in the design specs; if upstream has reimplemented something equivalent (e.g. unix socket support), prefer deleting the fork-local copy and documenting the change.

AGENTS.md is upstream's agent guide (collector rules, build/test commands, fixtures, toolchain); it applies to this fork as well.

Repository and CI

The code lives on GitHub: https://github.com/cloudlinux/node_exporter (default branch master, no branch protection; PRs are reviewed there and merged with a merge commit). Commit titles start with the Jira key: CLOS-1234: <what changed>.

  • GitHub Actions (workflows inherited from upstream, on PRs and pushes to master): CI (Go tests, ARM make test-e2e, node-mixin, promu crossbuild, docker image), golangci-lint, bsd (e2e on the BSDs, Solaris and Darwin), GitHub Actions Security (zizmor), govulncheck (also daily on schedule).
  • Build System (CLBS) builds the RPM/deb from a PR (git_change ref shown as node_exporter#<PR>), a branch or a tag. Its RPM tests stage installs cl-node-exporter-tests and runs QA's rpm_tests/p_cl-node-exporter (e2e over TCP and the unix socket on CL7-CL10; Ubuntu runs only the common integrity checks).
  • GitLab CI test pipelines started by CLBS: cmt-end-server (https://gitlab.corp.cloudlinux.com/clos/monitoring/centralized-management, ci/cmt-end-server.yml: the QA cl-end-server-tools suite, whose edition ships cl-node-exporter) and cl-node-exporter-check (pipelines/node-exporter-upstream-checker.yml in clos/ci-tools/gitlab-ci: alerts Slack and fails when upstream VERSION differs from this fork's). Both run for the daily CLPRO nightly build (clpro-nightly schedule of clos/ci-tools/gitlab-ci, node_exporter@master); cmt-end-server is the job to attach to a verification build. There are no Jenkins jobs.
  • Releases: the PR carrying the change bumps the version and changelog in node_exporter.spec and debian/changelog; after the merge, tag master as cl-node-exporter-<version>-<release> (e.g. cl-node-exporter-1.2.2-1), build the tag in CLBS with cmt-end-server and release it through the CLR process.

AI Workspace Required

Both the local-test and Build System workflows below assume you are inside an AI Workspace VM at /root/ai-workspace/. They depend on:

  • the workspace's CloudLinux OS toolchain and any project-specific runtime (Python venv, Node, Docker, …) — needed by the local-build and unit-test targets;
  • the workspace's mcp-cli-wrapper.sh and provisioned Build System token — needed by the BS payload helper.

Outside an AI Workspace these commands will not work as documented. Spin up a workspace via cl-aiworkspaces first.

Local Tests

Run from the repo root (/root/ai-workspace/node_exporter/):

Command What it does
make build Build the node_exporter binary
make test Run the upstream Go unit-test suite
make test-e2e Run the e2e harness (downloads collector fixtures on first run)
make checkmetrics && make checkrules Validate metric and rule schemas

Integration/e2e tests live in this repo: the harness end-to-end-test.sh (run via make test-e2e, twice: over TCP and over the unix socket) plus the collector/ fixtures. They are shipped as the versioned tests subpackage to /opt/node_exporter_tests/ and run by QA's rpm_tests/p_cl-node-exporter in the Build System RPM tests.

Build System

This repo ships as an RPM/DEB package: node_exporter. Builds are created through the CloudLinux Build System API via the /build-create skill — the skill assembles the build payload and submits it to the Build System. The tables below are the project-specific overrides on top of that generic flow.

Parameters

The /build-create skill fills most fields automatically; the table records what should end up in the final payload for a node_exporter-only build.

Field Value
BS project name node_exporter
build_type_id 5ac2787bdf7e526d4a5f0259 (CloudLinux OS packages)
build_platforms CL7, CL8, CL9, CL10, ubuntu22_04_ext
build_flavors alt-php-els (id 68b1ad89aa0264b2618434c8)
target_channel beta
build_ref.name Branch (or tag) to build. Taken from the current git checkout in the workspace — confirm you are on the intended branch (your feature branch, not master) before creating the build.
build_ref.type git_branch, git_tag, or git_change for a GitHub PR.
testing.qa_ref (per project) and top-level qa_ref Branch checked out in the QA repo for the RPM tests stage and the QA-based GitLab CI pipelines. Defaults both to "master" regardless of build_ref.name — override to your feature branch if the QA side has matching changes.

Test jobs

The /build-create skill generates the workspace-wide plan covering every project in the workspace. For a node_exporter-only build, filter projects[] down to node_exporter. Keep jenkins_jobs[] empty: the Build System's project default still lists the Jenkins Web-monitoring-tool job, which does not test this package. build-plan.py does not fill gitlab_ci_jobs[]; add this entry by hand:

Build System name _id What it runs
cmt-end-server 6a3c5588c9769a88083c81ff centralized-management ci/cmt-end-server.yml (TRIGGER_KIND=cmt-end-server), QA cl-end-server-tools suite

The RPM tests (rpm_tests/p_cl-node-exporter) need no job entry: the Build System runs them after the build unless testing is skipped.