1

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
c4urself
  • 5,270
  • 3
  • 25
  • 39

2 Answers2

5

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
-------------------------------------------
zwobot
  • 66
  • 1
0

You could change the output format and run it through wc:

salt -C 'G@ec2_roles:test' test.ping --out=txt | wc -l
Dan Garthwaite
  • 2,922
  • 18
  • 29