// Everything that depends on the operating system of the monitored machines: how to start a shell, the // collector script with its parser (MetricsEngine::process), and the control commands. Linux and Windows // editions differ only in Platform.cpp. #pragma once #include #include struct Def { QString key, label, unit; }; // rule metric / action catalogue struct Cmd { QString label, cmd; bool danger = false, confirm = true, button = true; }; // cmd: %1 = pid or quoted name namespace P { extern const char *const prioLabel, *const kernelPrefix, *const sshHint, *const cleanup; // cleanup: default disk cleanup command extern const bool sudo, posixCpu; // "sudo -n" exists; CPU time has I/O wait + steal extern const int interval, normalPrio; // default sample interval (s); priority value of an ordinary process QStringList shell(int interval = 0); // argv of a shell that runs a script from stdin (interval > 0: collector arguments) QByteArray collector(int interval); // stdin for the collector QByteArray wrap(const QString &cmd, bool sudo); // stdin for a one-shot command QString quote(QString s); // shell quoting QString command(const QString &action, const QString &arg); // kill_pid | renice | restart_service | restart_failed | drop_caches QString serviceLogs(const QString &unit, int lines); QString power(bool reboot); bool isProtected(int pid, int ppid, double rss, const QString &name); // never killed automatically, no leak / runaway findings const QVector &ruleActions(); // unit = argument hint ("" = none) const QVector &procActions(), &priorities(), &serviceActions(), &diagnostics(), &systemActions(); }