- CheckMates
- :
- Products
- :
- Quantum
- :
- Management
- :
- Re: SmartConsole Result parsing
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SmartConsole Result parsing
Is there a way to parse out or filter your results in the SmartConsole CLI like something comparable to grep?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The SmartConsole CLI can be directly accessed from within SmartConsole by clicking the icon on the bottom left corner or from the Gaia CLI shell (clish), where you need to login as a management user first.
SmartConsole -> Management CLI:
To access the Management CLI In Gaia's CLI shell (clish) type:
mgmt login
or
mgmt login user myname
After that you remain in the familiar Gaia shell, but now you can use the management APIs.
Example:
> mgmt login user
Enter password: ******
> show interfaces
eth0
eth0.3
lo
> mgmt add host name myHost12 ip-address 3.3.3.3
> mgmt publish
message "OK"
number-of-published-changes 1
>
- The syntax is identical to the commands that you run in the SmartConsole GUI.
- All management commands start with the word "mgmt".
Neither Gaia clish not the Management CLI (SmartConsole CLI ) feature any result filters, such as grep, at the moment.
However, you can access these CLI's from Gaia's expert mode and filter results via grep there.
Example:
[Expert@Management:0]# clish -c "mgmt login user USERNAME password PASSWORD"
[Expert@Management:0]# clish -c "mgmt show-version" | grep edition
os-edition: "64-bit"
Related article: sk98877
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From the expert mode, yes:
[Expert@GW8010:0]# cplic print | grep 419AQF2
11 | 419AQF2 | 13Sep2018 | CPSB-ASPM-DEMO
[Expert@GW8010:0]#
From clish, not really.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The SmartConsole CLI can be directly accessed from within SmartConsole by clicking the icon on the bottom left corner or from the Gaia CLI shell (clish), where you need to login as a management user first.
SmartConsole -> Management CLI:
To access the Management CLI In Gaia's CLI shell (clish) type:
mgmt login
or
mgmt login user myname
After that you remain in the familiar Gaia shell, but now you can use the management APIs.
Example:
> mgmt login user
Enter password: ******
> show interfaces
eth0
eth0.3
lo
> mgmt add host name myHost12 ip-address 3.3.3.3
> mgmt publish
message "OK"
number-of-published-changes 1
>
- The syntax is identical to the commands that you run in the SmartConsole GUI.
- All management commands start with the word "mgmt".
Neither Gaia clish not the Management CLI (SmartConsole CLI ) feature any result filters, such as grep, at the moment.
However, you can access these CLI's from Gaia's expert mode and filter results via grep there.
Example:
[Expert@Management:0]# clish -c "mgmt login user USERNAME password PASSWORD"
[Expert@Management:0]# clish -c "mgmt show-version" | grep edition
os-edition: "64-bit"
Related article: sk98877
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Danny,
When I am trying to execute clish -c "mgmt xxx", I am getting database lock errors:
SMS8010> lock database override
CLICMD0201 Config lock is already turned on.
SMS8010> expert
Enter expert password:
Warning! All configurations should be done through clish
You are in expert mode now.
[Expert@SMS8010:0]# clish -c "mgmt login user admin password FakePWD"
CLINFR0771 Config lock is owned by admin. Use the command 'lock database override' to acquire the lock.
[Expert@SMS8010:0]# clish -c "mgmt login user admin"
CLINFR0771 Config lock is owned by admin. Use the command 'lock database override' to acquire the lock.
Enter password:
[Expert@SMS8010:0]# clish -c "mgmt show-version"
CLINFR0771 Config lock is owned by admin. Use the command 'lock database override' to acquire the lock.
MGMT9205 You are not logged in to management server, in order to log-in you will need to run "mgmt login user [user name]"
[Expert@SMS8010:0]#
CLI is the only active session.
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I go into SmartConsole CLI From the Icon and try and type mgmt login it tells me message: "Requested API command: [Mgmt] not found". What I would like to be able to do is do a show_group and parse out just the member names without displaying out the rest of the Information. I can do it from the mgmt_cli when I ssh directly into the management station with this command "mgmt_cli show-group name "Group Name" --root true --format json | $CPDIR/jq/jq ".members[].name"
but would like to do the from the SmartConsole CLI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you are in the SmartConsole CLI, you do not need to login as you are already logged in.
As far as I know, you cannot pipe output from the SmartConsole CLI to another Unix shell command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, please notice that the beginning of the API syntax differs if it runs from within SmartConsole CLI, Gaia clish, expert mode mgmt_cli or via web services.
API execution mode | Prefix for commands | Example | Supports login / publish? | Can grep results? |
---|---|---|---|---|
SmartConsole CLI | no prefix. | add host name "New Host 1" ip-address "192.0.2.1" | No, because it runs on the session that was already logged in. Publish is only supported via GUI button in this case. | No |
Gaia clish | mgmt | mgmt add host name "New Host 1" ip-address "192.0.2.1" | Yes | Yes |
Expert mode mgmt_cli | mgmt_cli | mgmt_cli add host name "New Host 1" ip-address "192.0.2.1" | Yes | Yes |
Web services | sending an HTTP POST request. Notice the command name has all hyphens and no spaces unlike the others | POST {{server}}/add-host Content-Type: application/json X-chkp-sid: {{session}} { "name" : "New Host 1", "ip-address" : "192.0.2.1" } | Yes | Not directly |
