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 Sep 28, 2023
1 parent 01027bd commit 0b93e12
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docker_inventory.cf
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
bundle agent docker_inventory
{
vars:
"docker" string => "/usr/local/bin/docker";
any::
"docker" string => "/usr/local/bin/docker";
have_docker::
"status_list" slist => { "created", "exited", "dead" };
"status_count[${status_list}]" int => int(execresult(`${docker} ps -a --filter "status=${status_list}" --format "{{.Names}}" | wc -l`, "useshell", "stdout")),
meta => { "inventory", "attribute_name=Docker ${status_list} Count" };
classes:
"have_docker" expression => fileexists("${docker}"),
scope => "namespace",
meta => { "inventory", "attribute_name=Docker Installed" };
# alt: tag with report

reports:
have_docker::
"docker containers ${status_list}: ${status_count[${status_list}]}";
any::
"hi from ${this.bundle}";
}
Expand Down

0 comments on commit 0b93e12

Please sign in to comment.