Use the Cloud Pak for Data Platform API to view
the number of users that are using Cognos
Dashboards
licenses.
Before you begin
You must be running Linux® with
bash, curl, and jq installed.
You must have curl set up properly with an SSL certificate.
For more information about installing jq, see Installing the jq JSON
command-line utility.
About this task
Your Cloud Pak for Data license limits the number of
users who can create dashboards to a maximum of five users and the number of users who can view
dashboards to 20 users. To make sure that you do not exceed these limits, use the Cloud Pak for Data Platform API to view the number of users with
Create dashboards and View dashboards permissions.
If you exceed these limits, you must purchase a Cognos license:
- For more Create dashboards permissions, purchase the Cognos
Analytics User Cloud Pak for Data Subscription license.
- For more View dashboards permissions, purchase the Cognos
Analytics Viewer Cloud Pak for Data Subscription license.
Procedure
- Set the required environment variables.
- Set the CPD_CLUSTER_HOST environment variable to your Cloud Pak for Data cluster hostname.
export CPD_CLUSTER_HOST=<cpd_cluster_host>
- Set the USERNAME environment variable to your Cloud Pak for Data username.
export USERNAME=<username>
- Set the PASSWORD environment variable to your Cloud Pak for Data user password.
export PASSWORD=<password>
- Generate an authorization token and assign this token to the
AUTHORIZATION_TOKEN variable.
- If you enabled LDAP or IAM authentication, see Generating an authorization token or API key and follow the instructions for
when LDAP or IAM is enabled to get the authorization token. The resulting authorization token is in
the token field of the response.
Set the
AUTHORIZATION_TOKEN environment variable to this authorization token without the
quotation
marks.
export AUTHORIZATION_TOKEN=<authorization_token_from_response>
- If you do not have LDAP or IAM enabled, generate an authorization token and assign it to the
AUTHORIZATION_TOKEN environment variable by using the following
command:
export AUTHORIZATION_TOKEN=$(curl -L "$CPD_CLUSTER_HOST/icp4d-api/v1/authorize" \
-H 'Content-Type: application/json' \
-d '{ \
"username": "'"$USERNAME"'", \
"password": "'"$PASSWORD"'" \
}' | jq -r .token)
- Display the number of users with the Create dashboards
permission.
Run the following command to display the number of users with the Create
dashboards permission:
echo -e "\n\n\n>>>>> USERS WITH CREATE DASHBOARDS PERMISSION: \
`curl -L "https://$CPD_CLUSTER_HOST/usermgmt/v1/usermgmt/users?permissions=create_dashboard" \
-H "Authorization: Bearer $AUTHORIZATION_TOKEN" | jq -r '.[] | .uid ' | wc -l` <<<<<\n\n\n"
>>>>> USERS WITH CREATE DASHBOARDS PERMISSION: 5 <<<<<
- Display the number of users with the View dashboards
permission.
Run the following command to display the number of users with the View
dashboards permission:
echo -e "\n\n\n>>>>> USERS WITH VIEW DASHBOARDS PERMISSION: \
`curl -L "https://$CPD_CLUSTER_HOST/usermgmt/v1/usermgmt/users?permissions=view_dashboard" \
-H "Authorization: Bearer $AUTHORIZATION_TOKEN" | jq -r '.[] | .uid ' | wc -l` <<<<<\n\n\n\"
>>>>> USERS WITH CREATE DASHBOARDS PERMISSION: 20 <<<<<