-
Notifications
You must be signed in to change notification settings - Fork 57
Update chapter on metric-utility #3322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8435d7b
Update chapter on metric-utility
ianf77 9e467c9
Update chapter on metrics-utility
ianf77 0abc9e2
Update chapter on metric-utility
ianf77 b30edfc
Update chapter on metrics-utility
ianf77 9d7dfc4
Update chapter on metrics-utilities
ianf77 7a8c1c9
Update chapter on metrics-utility
ianf77 e8b45a9
Update chapter on metrics-utility
ianf77 7f39301
Update chapter on metrics-utility
ianf77 a3a8fab
Update chapter on metrics-utility
ianf77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
downstream/modules/platform/proc-configure-a-config-map.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| [id="proc-configure-a-config-map"] | ||
|
|
||
| = Create a ConfigMap in the OpenShift UI YAML view | ||
|
|
||
| . From the navigation panel, select ConfigMaps, and then click the Create ConfigMap button. | ||
ianf77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| On the next screen, select the YAML view tab. | ||
| In the YAML field, enter the following parameters with the appropriate variables set: | ||
| + | ||
| ---- | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: automationcontroller-metrics-utility-configmap | ||
| data: | ||
| METRICS_UTILITY_SHIP_TARGET: directory | ||
| METRICS_UTILITY_SHIP_PATH: /metrics-utility | ||
| METRICS_UTILITY_REPORT_TYPE: CCSP | ||
| METRICS_UTILITY_PRICE_PER_NODE: '11' # in USD | ||
| METRICS_UTILITY_REPORT_SKU: MCT3752MO | ||
| METRICS_UTILITY_REPORT_SKU_DESCRIPTION: "EX: Red Hat Ansible Automation Platform, Full Support (1 Managed Node, Dedicated, Monthly)" | ||
| METRICS_UTILITY_REPORT_H1_HEADING: "CCSP Reporting <Company>: ANSIBLE Consumption" | ||
| METRICS_UTILITY_REPORT_COMPANY_NAME: "Company Name" | ||
| METRICS_UTILITY_REPORT_EMAIL: "[email protected]" | ||
| METRICS_UTILITY_REPORT_RHN_LOGIN: "test_login" | ||
| METRICS_UTILITY_REPORT_COMPANY_BUSINESS_LEADER: "BUSINESS LEADER" | ||
| METRICS_UTILITY_REPORT_COMPANY_PROCUREMENT_LEADER: "PROCUREMENT LEADER" | ||
| ---- | ||
| + | ||
| . Click btn:[Create]. | ||
| . To verify that the ConfigMap was created and the `metric utility` is installed, select ConfigMap from the navigation panel and look for your ConfigMap in the list. | ||
ianf77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| [id="proc-deploy-controller"] | ||
|
|
||
| = Deploy {ControllerName} | ||
|
|
||
| Deploy {ControllerName} and specify variables for how often `metrics-utility` gathers usage information and generates a report. | ||
|
|
||
| . From the navigation panel, select *Installed Operators*. | ||
| . Select {PlatformNameShort}. | ||
| . In the Operator details, select the {ControllerName} tab. | ||
| . Click btn:[Create automation controller]. | ||
| . Select the YAML view option. | ||
| The YAML now shows the default parameters for {ControllerName}. | ||
| The relevant parameters for `metrics-utility` are the following: | ||
| + | ||
| [cols="50%,50%",options="header"] | ||
| |==== | ||
| | *Parameter* | *Variable* | ||
| | *`metrics_utility_enabled`* | True. | ||
| | *`metrics_utility_cronjob_gather_schedule`* | @hourly or @daily. | ||
| | *`metrics_utility_cronjob_report_schedule`* | @daily or @monthly. | ||
| |==== | ||
| + | ||
| . Find the `metrics_utility_enabled` parameter and change the variable to true. | ||
| . Find the `metrics_utility_cronjob_gather_schedule` parameter and enter a variable for how often the utility should gather usage information (for example, `@hourly` or `@daily`). | ||
| . Find the `metrics_utility_cronjob_report_schedule` parameter and enter a variable for how often the utility generates a report (for example, `@daily` or `@monthly`). | ||
| . Click btn:[Create]. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| [id="ref-ccsp"] | ||
|
|
||
| = CCSP | ||
|
|
||
| `CCSP` is the original report format. It does not include many of the customization of CCSPv2, and it is intended to be used only for the CCSP partner program. | ||
|
|
||
| == Optional collectors for `gather` command | ||
|
|
||
| You can use the following optional collectors for the `gather` command: | ||
|
|
||
| * *main_jobhostsummary` | ||
| ** If present by default, this incrementally collects the `main_jobhostsummary` table from the automation controller database, containing information about jobs runs and managed nodes automated. | ||
ianf77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * `main_host` | ||
| ** This collects daily snapshots of the `main_host` table from the automation controller database and has managed nodes/hosts present across automation controller inventories, | ||
ianf77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * `main_jobevent` | ||
| ** This incrementally collects the `main_jobevent` table from the automation controller database and contains information about which modules, roles, and ansible collections are being used. | ||
ianf77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * main_indirectmanagednodeaudit | ||
| ** This incrementally collects the `main_indirectmanagednodeaudit` table from the automation controller database and contains information about indirectly managed nodes, | ||
|
|
||
| ---- | ||
| # Example with all optional collectors | ||
| export METRICS_UTILITY_OPTIONAL_COLLECTORS="main_host,main_jobevent,main_indirectmanagednodeaudit" | ||
| ---- | ||
|
|
||
| == Optional sheets for `build_report` command | ||
|
|
||
| You may use the following optional sheets for the `build_report` command: | ||
|
|
||
| * `ccsp_summary` | ||
| ** This is a landing page specifically for partners under the CCSP program. It shows managed node usage by each automation controller organization. | ||
| ** This report takes additional parameters to customize the summary page. For more information, see the following example: | ||
|
|
||
| ---- | ||
| export METRICS_UTILITY_PRICE_PER_NODE=11.55 # in USD | ||
| export METRICS_UTILITY_REPORT_SKU=MCT3752MO | ||
| export METRICS_UTILITY_REPORT_SKU_DESCRIPTION="EX: Red Hat Ansible Automation Platform, Full Support (1 Managed Node, Dedicated, Monthly)" | ||
| export METRICS_UTILITY_REPORT_H1_HEADING="CCSP Reporting <Company>: ANSIBLE Consumption" | ||
| export METRICS_UTILITY_REPORT_COMPANY_NAME="Company Name" | ||
| export METRICS_UTILITY_REPORT_EMAIL="[email protected]" | ||
| export METRICS_UTILITY_REPORT_RHN_LOGIN="test_login" | ||
| export METRICS_UTILITY_REPORT_COMPANY_BUSINESS_LEADER="BUSINESS LEADER" | ||
| export METRICS_UTILITY_REPORT_COMPANY_PROCUREMENT_LEADER="PROCUREMENT LEADER" | ||
| ---- | ||
|
|
||
| * managed_nodes` | ||
| ** This is a deduplicated list of managed nodes automated by automation controller. | ||
ianf77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * `indirectly_managed_nodes` | ||
| ** This is a deduplicated list of indirect managed nodes automated by automation controller. | ||
| * `inventory_scope` | ||
| ** This is a deduplicated list of managed nodes present across all inventories of automation controller. | ||
| * `usage_by_collections` | ||
| ** This is a list of Ansible collections used in automation controller job runs. | ||
| * `usage_by_roles` | ||
| ** This is a list of roles used in automation controller job runs. | ||
| *`usage_by_modules` | ||
| ** This is a list of modules used in automation controller job runs. | ||
|
|
||
| ---- | ||
| # Example with all optional sheets | ||
| export METRICS_UTILITY_OPTIONAL_CCSP_REPORT_SHEETS='ccsp_summary,managed_nodes,indirectly_managed_nodes,inventory_scope,usage_by_collections,usage_by_roles,usage_by_modules' | ||
| ---- | ||
|
|
||
| == Selecting a date range for your CCSP report | ||
|
|
||
| The default behavior of this report is to build a report for the previous month. The following examples describe how to override this default behavior to select a specific date range for your report: | ||
|
|
||
| ---- | ||
| # Builds report for a previous month | ||
| metrics-utility build_report | ||
| # Build report for a specific month | ||
| metrics-utility build_report --month=2025-03 | ||
| # Build report for a specific month overriding an existing report | ||
| metrics-utility build_report --month=2025-03 --force | ||
| ---- | ||
133 changes: 133 additions & 0 deletions
133
downstream/modules/platform/ref-configuring-metrics-utility.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| :_newdoc-version: 2.18.3 | ||
| :_template-generated: 2024-07-15 | ||
|
|
||
| :_mod-docs-content-type: REFERENCE | ||
|
|
||
| [id="ref-configuring-metrics-utility_{context}"] | ||
| = Configuring metrics-utility | ||
|
|
||
| == On {RHEL} | ||
|
|
||
| .Prerequisites | ||
|
|
||
| * An active {PlatformName} subscription | ||
| * An existing installation of {PlatformName} on {RHEL} | ||
|
|
||
| `metrics-utility` is included with {PlatformName}, so you do not need a separate installation. The following commands gather the relevant data and generate a link:https://connect.redhat.com/en/programs/certified-cloud-service-provider[CCSP] report containing your usage metrics. | ||
| You can configure these commands as cron jobs to ensure they run at the beginning of every month. See link:https://www.redhat.com/en/blog/linux-cron-command[How to schedule jobs using the Linux 'cron' utility] for more on configuring using the cron syntax. | ||
|
|
||
| .Procedure | ||
| . In the `cron` file, set the correct variables to ensure `metrics-utility` gathers the relevant data. To open the cron file for editing, run: | ||
| + | ||
| `crontab -e` | ||
|
|
||
| . Specify the following variables to indicate where the report is deposited in your file system: | ||
| + | ||
| ---- | ||
| export METRICS_UTILITY_SHIP_TARGET=directory | ||
| export METRICS_UTILITY_SHIP_PATH=/awx_devel/awx-dev/metrics-utility/shipped_data/billing | ||
| ---- | ||
| . Set these variables to generate a report: | ||
| + | ||
| ---- | ||
| export METRICS_UTILITY_REPORT_TYPE=CCSP | ||
| export METRICS_UTILITY_PRICE_PER_NODE=11.55 # in USD | ||
| export METRICS_UTILITY_REPORT_SKU=MCT3752MO | ||
| export METRICS_UTILITY_REPORT_SKU_DESCRIPTION="EX: Red Hat Ansible Automation Platform, Full Support (1 Managed Node, Dedicated, Monthly)" | ||
| export METRICS_UTILITY_REPORT_H1_HEADING="CCSP Reporting <Company>: ANSIBLE Consumption" | ||
| export METRICS_UTILITY_REPORT_COMPANY_NAME="Company Name" | ||
| export METRICS_UTILITY_REPORT_EMAIL="[email protected]" | ||
| export METRICS_UTILITY_REPORT_RHN_LOGIN="test_login" | ||
| export METRICS_UTILITY_REPORT_COMPANY_BUSINESS_LEADER="BUSINESS LEADER" | ||
| export METRICS_UTILITY_REPORT_COMPANY_PROCUREMENT_LEADER="PROCUREMENT LEADER" | ||
| ---- | ||
|
|
||
| . Run the following command to gather and store the data in the provided `SHIP_PATH` directory: | ||
| + | ||
| `metrics-utility gather_automation_controller_billing_data --ship --until=10m` | ||
|
|
||
| . To configure the run schedule, add the following parameters to the end of the file and specify how often you want `metrics-utility` to gather information and build a report using link:https://www.redhat.com/en/blog/linux-cron-command[cron syntax]. | ||
| In the following example, the `gather` command is configured to run every hour at 00 minutes. The `build_report` command is configured to run every second day of each month at 4:00 AM. | ||
| + | ||
| ---- | ||
| 0 */1 * * * metrics-utility gather_automation_controller_billing_data --ship --until=10m | ||
| 0 4 2 * * metrics-utility build_report | ||
| ---- | ||
|
|
||
| . Save and close the file. | ||
| . To verify that you saved your changes, run: | ||
| + | ||
| `crontab -l` | ||
|
|
||
| . You can also check the logs to ensure that data is being collected. Run: | ||
| + | ||
| `cat /var/log/cron` | ||
|
|
||
| . The following is an example of the output. Note that time and date might vary depending on how your configure the run schedule: | ||
| + | ||
| ---- | ||
| May 8 09:45:03 ip-10-0-6-24 CROND[51623]: (root) CMDOUT (No billing data for month: 2024-04) | ||
| May 8 09:45:03 ip-10-0-6-24 CROND[51623]: (root) CMDEND (metrics-utility build_report) | ||
| May 8 09:45:19 ip-10-0-6-24 crontab[51619]: (root) END EDIT (root) | ||
| May 8 09:45:34 ip-10-0-6-24 crontab[51659]: (root) BEGIN EDIT (root) | ||
| May 8 09:46:01 ip-10-0-6-24 CROND[51688]: (root) CMD (metrics-utility gather_automation_controller_billing_data --ship --until=10m) | ||
| May 8 09:46:03 ip-10-0-6-24 CROND[51669]: (root) CMDOUT (/tmp/9e3f86ee-c92e-4b05-8217-72c496e6ffd9-2024-05-08-093402+0000-2024-05-08-093602+0000-0.tar.gz) | ||
| May 8 09:46:03 ip-10-0-6-24 CROND[51669]: (root) CMDEND (metrics-utility gather_automation_controller_billing_data --ship --until=10m) | ||
| May 8 09:46:26 ip-10-0-6-24 crontab[51659]: (root) END EDIT (root) | ||
| ---- | ||
|
|
||
| . Run the following command to build a report for the previous month: | ||
| + | ||
| `metrics-utility build_report` | ||
|
|
||
| . The generated report will have the default name `CCSP-<YEAR>-<MONTH>.xlsx` and is located in the ship path that you specified in step 2. | ||
ianf77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| == On {OCPShort} from the {PlatformNameShort} operator | ||
|
|
||
| `metrics-utility` is included in the {OCPShort} image beginning with version 4.12. | ||
| If your system does not have `metrics-utility` installed, update your OpenShift image to the latest version. | ||
| Follow the steps below to configure the run schedule for metrics-utility on {OCPShort} using the {PlatformName} Operator. | ||
ianf77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| . Prerequisites: | ||
|
|
||
| * A running OpenShift cluster | ||
| * An operator-based installation of {PlatformNameShort} on {OCPShort}. | ||
| + | ||
| [Note] | ||
| ==== | ||
| `metrics-utility` runs as indicated by the parameters you set in the configuration file. | ||
| The utility cannot be run manually on {OCPShort}. | ||
| ==== | ||
|
|
||
| == Create a ConfigMap in the OpenShift UI YAML view | ||
|
|
||
| .Procedure | ||
| . From the navigation panel, select menu::ConfigMaps[]. | ||
| . Click btn:[Create ConfigMap]. | ||
| . On the next screen, select the YAML view tab. | ||
ianf77 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| . In the YAML field, enter the following parameters with the appropriate variables set: | ||
| + | ||
| ---- | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: automationcontroller-metrics-utility-configmap | ||
| data: | ||
| METRICS_UTILITY_SHIP_TARGET: directory | ||
| METRICS_UTILITY_SHIP_PATH: /metrics-utility | ||
| METRICS_UTILITY_REPORT_TYPE: CCSP | ||
| METRICS_UTILITY_PRICE_PER_NODE: '11' # in USD | ||
| METRICS_UTILITY_REPORT_SKU: MCT3752MO | ||
| METRICS_UTILITY_REPORT_SKU_DESCRIPTION: "EX: Red Hat Ansible Automation Platform, Full Support (1 Managed Node, Dedicated, Monthly)" | ||
| METRICS_UTILITY_REPORT_H1_HEADING: "CCSP Reporting <Company>: ANSIBLE Consumption" | ||
| METRICS_UTILITY_REPORT_COMPANY_NAME: "Company Name" | ||
| METRICS_UTILITY_REPORT_EMAIL: "[email protected]" | ||
| METRICS_UTILITY_REPORT_RHN_LOGIN: "test_login" | ||
| METRICS_UTILITY_REPORT_COMPANY_BUSINESS_LEADER: "BUSINESS LEADER" | ||
| METRICS_UTILITY_REPORT_COMPANY_PROCUREMENT_LEADER: "PROCUREMENT LEADER" | ||
| ---- | ||
|
|
||
| . Click btn:[Create]. | ||
|
|
||
| . To verify that the ConfigMap was created and `metric utility` is installed, select menu::ConfigMap[] from the navigation panel and look for your ConfigMap in the list. | ||
ianf77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.