Output of control commands using the JSON format [Документация VAS Experts]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:dpi:dpi_components:platform:subscriber_management:subsman_json:start [2020/01/22 11:19] edrudichgmailcomen:dpi:dpi_components:platform:subscriber_management:subsman_json:start [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====== 11 Output of control commands using the JSON format ====== 
-{{indexmenu_n>11}} 
  
-Output in JSON format is provided to simplify the parsing of command output when integrating with external platforms and WEB. 
-To do that you should specify an additional option: 
-<code>--outformat json</code> 
- 
-For the convenience of working with json, we recommend installing the jq utility: 
-<code>yum install epel-release 
-yum-config-manager --disable epel 
-yum --enablerepo epel install jq</code> 
- 
-**Examples** 
- 
-Formatted output of the result of the command 
-<code>fdpi_ctrl list all profile --policing --outformat json|jq .</code> 
- 
-View usage statistics for different policing profiles 
-<code>fdpi_ctrl list all --policing --outformat json|jq '.lpolicings[].description.name'|sort|uniq -c</code> 
- 
-or the same in json format by jq 
-<code>fdpi_ctrl list all --policing --outformat json|jq  '[{ name: .lpolicings[].description.name, login: .login }] | group_by(.name) | .[] | { name: .[0].name, count: . | length}'</code> 
- 
-For later use, you can turn this into a bash function 
-<code>function fdpi_policing_stat() { fdpi_ctrl list all --policing --outformat json|jq  '[{ name: .lpolicings[].description.name, login: .login }] | group_by(.name) | .[] | { name: .[0].name, count: . | length}'; }</code> 
- 
-and then just call this function from the command line 
-<code>fdpi_policing_stat</code> 
- 
-For regular use of functions you can save them in a .bash_profile file.