cancel
Showing results for 
Search instead for 
Did you mean: 
Create a Post
Highlighted
Employee+
Employee+

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

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?

Tags (3)
1 Reply
Employee+
Employee+

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

what about something like that:
# show objects order.1.ASC "name" type "host" --format json | $CPDIR/jq/jq ".total"

My env:
I have 1K hosts , I run the command and got:
1000


using show-objects with filter option
https://sc1.checkpoint.com/documents/latest/APIs/index.html#gui-cli/show-objects~v1.1

0 Kudos