Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Agent_Smith
Contributor
Jump to solution

Export Group objects to CSV

We are using Smart1 Cloud for management and don't have access to CLI. Also the CLI we have access to though the console doesn't accept -r commands.

 

We need to export a list of objects per group. A scheduled report would be desired however if manual that's better than nothing. I tried in object explorer to export a list of the objects but it only exports the group title. Seems dumb. Is there a way to export the objects?

0 Kudos
1 Solution

Accepted Solutions
PhoneBoy
Admin
Admin

You don't need CLI access to Smart-1 Cloud to do what is described in this thread.
You just have to do it a little differently as mgmt_cli -r true can only be executed directly on the management station in expert mode.
-r true is a shortcut for the following commands:

  • mgmt_cli -m localhost login > sid.txt
  • mgmt_cli -m localhost -s sid.txt ...
  • mgmt_cli -m localhost -s sid.txt publish
  • mgmt_cli -m logout

You can execute similar commands from one of your gateways in expert mode (cannot be done via clish):

  • mgmt_cli -m mgmt-ip login > sid.txt
  • mgmt_cli -m mgmt-ip -s sid.txt show-group name 'RFC 1918 Addresses' --format json | jq '.members[] | [.name, ."ipv4-address", .subnet4, ."mask-length4" ] | @csv' -r
  • mgmt_cli -m mgmt-ip -s sid.txt logout

The mgmt-ip can be obtained from SmartConsole.
Authenticate with your SmartConsole credentials (make sure the user in question has API permissions).
Refer to the online help for mgmt_cli for additional options (just type the command with no arguments).

View solution in original post

0 Kudos
8 Replies
PhoneBoy
Admin
Admin

You don't need CLI access to Smart-1 Cloud to do what is described in this thread.
You just have to do it a little differently as mgmt_cli -r true can only be executed directly on the management station in expert mode.
-r true is a shortcut for the following commands:

  • mgmt_cli -m localhost login > sid.txt
  • mgmt_cli -m localhost -s sid.txt ...
  • mgmt_cli -m localhost -s sid.txt publish
  • mgmt_cli -m logout

You can execute similar commands from one of your gateways in expert mode (cannot be done via clish):

  • mgmt_cli -m mgmt-ip login > sid.txt
  • mgmt_cli -m mgmt-ip -s sid.txt show-group name 'RFC 1918 Addresses' --format json | jq '.members[] | [.name, ."ipv4-address", .subnet4, ."mask-length4" ] | @csv' -r
  • mgmt_cli -m mgmt-ip -s sid.txt logout

The mgmt-ip can be obtained from SmartConsole.
Authenticate with your SmartConsole credentials (make sure the user in question has API permissions).
Refer to the online help for mgmt_cli for additional options (just type the command with no arguments).

0 Kudos
Agent_Smith
Contributor

"-m" is not supported within SmartConsole's CLI window. This is a cloud manager so there's not an IP.

0 Kudos
PhoneBoy
Admin
Admin

As I stated in my response, these commands should be executed from one of your gateways.
The SmartConsole CLI cannot be used for this purpose.

0 Kudos
Agent_Smith
Contributor

This is the gateway response

MGMT9206 You are not logged in to management server, in order to log-in you will need to run "mgmt login user [user name] ip [ip address]"

0 Kudos
PhoneBoy
Admin
Admin

The commands I highlighted need to be run in expert mode (will update my answer above).
clish has a rough equivalent to mgmt_cli (called mgmt).
However, to get the precise output you're looking for, the output of this command must be "piped" through another tool called jq.
jq is not available in clish.
Further, you cannot use pipes and redirects from clish, which is required in this case.

0 Kudos
Agent_Smith
Contributor

So its not possible in the GUI to get a simple copy and paste list of objects in a group?

0 Kudos
PhoneBoy
Admin
Admin

Can you choose an "export" option in SmartConsole that will provide you the details of a group? No, there is not a way to do that currently.

You can get data from SmartConsole CLI, e.g. show group name "Corporate LANs" --format json
However, it won't be in CSV format.
JSON can be parsed offline with jq or similar similar to what I provided in my initial answer.
SmartConsole CLI does not provide access to jq or any other output parsing mechanisms. 

Further, depending on the size and contents of the group, additional commands may be required to obtain all the data you're interested in.
This is because API commands return a limited number of results by default, though the additional results can be requested with additional calls using limit and/or offset parameters.

0 Kudos
meigen
Explorer

Hey PhoneBoy,

Can you tell me what the key is to export the comments for each entry in the network object?

I can't seem to find it or figure it out.

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events