Skip to content

Cockpit Module

Alain Martini edited this page Oct 17, 2026 · 1 revision

Cockpit Module

Cockpit is the web console of AlmaLinux, Rocky Linux, RHEL, Fedora, Debian and Ubuntu servers (https://<server>:9090). WebPulse adds a Web analytics entry to its menu with the same dashboard as the cPanel and WHM plugins: the overview, every tab, the server view, CSV export and the printable report.

There is no web server, port or password of WebPulse's own: Cockpit logs you in with your Linux account and runs webpulse for you through its process bridge.

Install

Cockpit 266 or later (AlmaLinux/RHEL 9 and 10, Debian 12, Ubuntu 22.04 and later have it):

dnf install -y cockpit && systemctl enable --now cockpit.socket    # or: apt install -y cockpit

Then either a standalone installation, which adds the module whenever Cockpit is present (Standalone Install):

curl -fsSL https://raw.githubusercontent.com/inalto/webpulse/main/install.sh | bash -s -- --standalone

or the module alone, on an existing installation (also on a cPanel server that runs Cockpit):

/usr/local/webpulse/install.sh --update --cockpit

The installer writes /usr/share/cockpit/webpulse/manifest.json and index.html (generated by webpulse page --cockpit). Cockpit picks the module up without a restart: reload the browser tab. install.sh --update regenerates the page, install.sh --uninstall removes the directory.

Who sees what

Every request of the page runs /usr/local/webpulse/bin/webpulse cgi --cockpit --api with Cockpit's superuser: "try":

  • Administrative access on (the lock button in Cockpit's top bar; your account must be allowed to use sudo, e.g. a member of wheel): the process runs as root, which is the administrator view: every site, the Server view (accounts, settings, jobs, GeoIP, updates) and switching collection on and off.
  • Limited access (administrative access off, or a user without sudo): the process runs as the logged-in Linux user, who sees the sites they own, the owner column of webpulse sites (set with SuexecUserGroup, the owner of the document root, or "owner" in config.json). The statistics files are 0640 root:<owner>, so the operating system enforces it; another user sees "No domains". On a cPanel server the Linux user is the cPanel account of the same name.

The REMOTE_USER environment variable is ignored; the principal is always the process's effective uid. Cockpit reloads the page when administrative access changes (reload it yourself if it does not).

How it works

index.html contains the dashboard (ui/*.js, ui/app.css) and a small adapter (ui/cockpit.js) that replaces HTTP with cockpit.spawn: the query string, method and body of each API call become the CGI environment (REQUEST_METHOD, QUERY_STRING, CONTENT_LENGTH, HTTP_X_WEBPULSE_REQUEST) and the standard input of webpulse cgi --cockpit --api, and its CGI reply (Status:, headers, JSON) is handed back to the dashboard. At start the adapter asks a=whoami (principal and version, see the API reference) and a=domains.

Inside Cockpit:

  • Dark mode follows Cockpit's style (Cockpit » your user menu » Style), else the system preference.
  • CSV downloads are produced in the browser (a Blob) instead of opening a URL.
  • Download PDF opens the report in the module's own frame and calls the browser's print dialog for that frame only; "Back to dashboard" returns. Save as PDF in the dialog.

manifest.json allows the page's inline scripts and styles (content-security-policy); Cockpit adds its own defaults for everything else.

Troubleshooting

  • No "Web analytics" entry: check /usr/share/cockpit/webpulse/manifest.json exists, reload the page (Cockpit caches the menu per login: log out and in again).
  • "Web analytics could not start" with "… was not found": the page runs the binary named in it (/usr/local/webpulse/bin/webpulse); re-run install.sh --update --cockpit after moving it.
  • A user sees no domains: webpulse sites shows the owner of each site; the statistics directory /var/webpulse/data/<owner>/ must have the group of that user (created by collect when the group exists). Sites without an owner belong to local and are visible with administrative access only.
  • Browser console: Cockpit's window.debugging = "spawn" logs every spawned command.

See also

Clone this wiki locally