Skip to content

Commit

Permalink
fixup case of status list items
Browse files Browse the repository at this point in the history
  • Loading branch information
craigcomstock committed Feb 28, 2024
1 parent 8d4cdf4 commit 1c8c262
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docker_inventory.cf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ bundle agent docker_inventory

have_docker::
"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")),
"status_count[${status_list}]" int => int(execresult(`echo ${status_list} | tr '[:upper:]' '[:lower:]' | xargs -i{} ${docker} ps -a --filter "status="{} --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 1c8c262

Please sign in to comment.