AnsweredAssumed Answered

What is the easiest way to get the number of objects for a specific type, e.g. hosts

Question asked by Eric Beasley Employee on Jul 21, 2017
Latest reply on Jul 30, 2017 by ofirsea040d26-f1f2-3b12-9fc6-5c89debaf56c

What is the easiest way to get the number of objects for a specific type, e.g. hosts?

 

Especially if there are more than the current limit maximum value of 500?

 

I don't see easy commands like "get number of objects" or something like "show <objects> total"

 

This is what I found might work:

 

[Expert@X:0]# mgmt_cli login > id.txt

[Expert@X:0]# mgmt_cli show groups --format json -s id.txt | $CPDIR/jq/jq ".total"
171

 

And generating a variable would look like this:

 

[Expert@X:0]# total_groups=$(mgmt_cli show groups --format json -s id.txt | $CPDIR/jq/jq ".total")
[Expert@X:0]# echo "$total_groups"
171

 

Am I missing something here?

Outcomes