Skip to content

Commit

Permalink
Craigs-MacBook-Pro.local
Browse files Browse the repository at this point in the history
  • Loading branch information
craigcomstock committed Feb 28, 2024
1 parent f2338ba commit 8d4cdf4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker_inventory.cf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ bundle agent docker_inventory
"docker" string => execresult("command -v docker", useshell);

have_docker::
"status_list" slist => { "created", "restarting", "running", "removing", "pause", "exited", "dead" };
"status_count[${status_list}]" int => int(execresult(`${docker} ps -a --filter "status=${status_list}" --format "{{.Names}}" | wc -l`, "useshell", "stdout")),
"status_list" slist => { "Created", "Restarting", "Running", "Removing", "Pause", "Exited", "Dead" };
"status_count[${status_list}]" int => int(execresult(`${docker} ps -a --filter "status=\$(echo ${status_list} | tr '[:upper:]' '[:lower:]')" --format "{{.Names}}" | wc -l`, "useshell", "stdout")),
meta => { "inventory", "attribute_name=Containers - ${status_list} count" };
"running_string" string => execresult(`${docker} ps -a --filter "status=running" --format "{{.Names}}"`, "noshell", "stdout");
"running_names" slist => splitstring("${running_string}", "\n", "inf"),
Expand Down

0 comments on commit 8d4cdf4

Please sign in to comment.