Count the number of Salt minions matched

saltstack

Is there a simple way to count the number of minions returned by a match, for example:

salt -C 'G@ec2_roles:test' match.count

Best Answer

You can add --summary to any salt call like:

salt -C 'G@ec2_roles:test' --summary

The you will get an report at the end of the execution which tells you how many minions were targeted:

-------------------------------------------
Summary
-------------------------------------------
# of minions targeted: 528
# of minions returned: 501
# of minions that did not return: 27
# of minions with errors: 0
-------------------------------------------