scripts: monitor more processes

Monitor podman and cipd to see the relationship with system load.

BUG=None
TEST=Ran unit test.

Change-Id: I6f44abac48807e52171cbe7190359ed1b63190c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4190783
Reviewed-by: Sergey Fetisov <sfetisov@google.com>
Tested-by: Congbin Guo <guocb@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
Commit-Queue: Sergey Fetisov <sfetisov@google.com>
Auto-Submit: Congbin Guo <guocb@chromium.org>
diff --git a/scripts/sysmon/proc_metrics.py b/scripts/sysmon/proc_metrics.py
index 7fb0acc..01b0e67 100644
--- a/scripts/sysmon/proc_metrics.py
+++ b/scripts/sysmon/proc_metrics.py
@@ -39,6 +39,7 @@
                 "cache-downloader",
                 test_func=partial(_is_process_name, "downloader"),
             ),
+            _ProcessMetric("cipd", test_func=partial(_is_process_name, "cipd")),
             _ProcessMetric(
                 "common-tls", test_func=partial(_is_process_name, "common-tls")
             ),
@@ -71,6 +72,10 @@
             _ProcessMetric(
                 "lxc-start", test_func=partial(_is_process_name, "lxc-start")
             ),
+            _ProcessMetric(
+                "podman-pull", test_func=partial(_is_podman, "pull")
+            ),
+            _ProcessMetric("podman-run", test_func=partial(_is_podman, "run")),
             _ProcessMetric("sshd", test_func=partial(_is_process_name, "sshd")),
             _ProcessMetric("swarming_bot", test_func=_is_swarming_bot),
             _ProcessMetric(
@@ -204,3 +209,15 @@
         and cmdline[0].split("/")[-1] == "cloud_sql_proxy"
         and cmdline[2] == "-instances=google.com:chromeos-lab:us-central1:tko"
     )
+
+
+def _is_podman(subcmd, proc):
+    """Return whiter proc is a podman process.
+
+    A podman pull process is like
+    'podman pull image:tag'
+    A podman run process is like
+    'podman run --option ... image:tag'
+    """
+    cmdline = proc.cmdline()
+    return proc.name() == "podman" and cmdline[1] == subcmd