### Install gnocchiclient with pip Source: https://gnocchi.osci.io/gnocchiclient/_sources/installation.rst.txt Run this command in your terminal to install the gnocchiclient package. ```shell $ pip install gnocchiclient ``` -------------------------------- ### MetricManager.get Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.metric.html Get an metric. ```APIDOC ## MetricManager.get(metric, resource_id=None) ### Description Get an metric. ### Method get ### Parameters - **metric** (str) - Required - ID or Name of the metric - **resource_id** (str) - Optional - ID of the resource (required to get a metric by name) ``` -------------------------------- ### ResourceManager.get Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.resource.html Gets a resource by type and ID, optionally including history. ```APIDOC ## get ### Description Get a resource. ### Method get ### Parameters - **resource_type** (str) - Required - Type of the resource. - **resource_id** (str) - Required - ID of the resource. - **history** (bool) - Optional - Show the history of the resource. Default: False. ### Request Example ``` { "resource_type": "generic", "resource_id": "resource-id", "history": false } ``` ### Response No response body specified. ``` -------------------------------- ### Basic authentication and client usage Source: https://gnocchi.osci.io/gnocchiclient/_sources/api.rst.txt Shows how to create a Gnocchi client using basic authentication with the GnocchiBasicPlugin and list resources. Requires the gnocchiclient package and a running Gnocchi endpoint. ```python >>> from gnocchiclient import auth >>> from gnocchiclient.v1 import client >>> >>> auth_plugin = auth.GnocchiBasicPlugin(user="admin", >>> endpoint="http://localhost:8041") >>> gnocchi = client.Client(session_options={'auth': auth_plugin}) >>> gnocchi.resource.list("generic") ``` -------------------------------- ### MetricManager.get_measures Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.metric.html Get measurements of a metric. ```APIDOC ## MetricManager.get_measures(metric, start=None, stop=None, aggregation=None, granularity=None, resource_id=None, refresh=False, resample=None, **kwargs) ### Description Get measurements of a metric. ### Method get_measures ### Parameters - **metric** (str) - Required - ID or Name of the metric - **start** (timestamp) - Optional - beginning of the period - **stop** (timestamp) - Optional - end of the period - **aggregation** (str) - Optional - aggregation to retrieve - **granularity** (int) - Optional - granularity to retrieve (in seconds) - **resource_id** (str) - Optional - ID of the resource (required to get a metric by name) - **refresh** (bool) - Optional - force aggregation of all known measures - **resample** (float) - Optional - resample measures to new granularity - **kwargs** - Optional - All other arguments are dedicated to custom aggregation method passed as-is to the Gnocchi. ``` -------------------------------- ### gnocchiclient.osc.make_client(_instance_) Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.osc.html Returns a metrics service client. This function is used to create a client instance for interacting with the Gnocchi metrics service. ```APIDOC ## gnocchiclient.osc.make_client(_instance_) ### Description Returns a metrics service client. This function is used to create a client instance for interacting with the Gnocchi metrics service. ### Parameters - **_instance_** (object) - Required - The instance from which to create the client. ### Returns - **client** (object) - The metrics service client. ``` -------------------------------- ### MetricManager.aggregation Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.metric.html Get measurements of an aggregated metrics. ```APIDOC ## MetricManager.aggregation(metrics, query=None, start=None, stop=None, aggregation=None, reaggregation=None, granularity=None, needed_overlap=None, resource_type='generic', groupby=None, refresh=False, resample=None, fill=None) ### Description Get measurements of an aggregated metrics. ### Method aggregation ### Parameters - **metrics** - Required - IDs of metric or metric name - **query** (dict) - Optional - The query dictionary - **start** (timestamp) - Optional - beginning of the period - **stop** (timestamp) - Optional - end of the period - **aggregation** (str) - Optional - granularity aggregation function to retrieve - **reaggregation** (str) - Optional - groupby aggregation function to retrieve - **granularity** (int) - Optional - granularity to retrieve (in seconds) - **needed_overlap** (float) - Optional - percent of datapoints in each metrics required - **resource_type** (str) - Optional - type of resource for the query - **groupby** (list) - Optional - list of attribute to group by - **refresh** (bool) - Optional - force aggregation of all known measures - **resample** (float) - Optional - resample measures to new granularity - **fill** (float or 'null') - Optional - value to use when backfilling missing datapoints ### Notes See Gnocchi REST API documentation for the format of query dictionary: http://docs.openstack.org/developer/gnocchi/rest.html#searching-for-resources ``` -------------------------------- ### gnocchi resource create command syntax Source: https://gnocchi.osci.io/gnocchiclient/shell.html Creates a resource. Supports output formatting options, resource type, attributes, and metrics. The resource_id is required. ```bash gnocchi resource create [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] [--type RESOURCE_TYPE] [-a ATTRIBUTE] [-m ADD_METRIC] [-n CREATE_METRIC] resource_id ``` -------------------------------- ### gnocchiclient.shell.main Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.shell.html Entry point function for the Gnocchi command-line client. It initializes and runs the shell application. ```APIDOC ## gnocchiclient.shell.main ### Description Entry point function for the Gnocchi command-line client. It initializes and runs the shell application. ### Method Function ### Endpoint `gnocchiclient.shell.main(args=None)` ### Parameters - **args** (list) - Optional - Command-line arguments to parse. If None, uses `sys.argv[1:]`. ### Returns - **int** - Exit code from the application. ### Request Example ```python from gnocchiclient.shell import main rc = main(['--help']) ``` ### Response #### Success Response - **int** - Exit code 0 on success. #### Response Example ``` 0 ``` ``` -------------------------------- ### ResourceManager.history Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.resource.html Gets the history of a resource with optional details, pagination, and sorting. ```APIDOC ## history ### Description Get a resource. ### Method history ### Parameters - **resource_type** (str) - Required - Type of the resource. - **resource_id** (str) - Required - ID of the resource. - **details** (bool) - Optional - Show all attributes of resources. Default: False. - **limit** (int) - Optional - Maximum number of resources to return. - **marker** (str) - Optional - The last item of the previous page; we return the next results after this value. - **sorts** (list of str) - Optional - List of resource attributes to order by. Example: ["user_id:desc-nullslast", "project_id:asc"]. ### Request Example ``` { "resource_type": "generic", "resource_id": "resource-id", "details": false, "limit": 10, "marker": "last-item", "sorts": ["user_id:desc-nullslast"] } ``` ### Response No response body specified. ``` -------------------------------- ### Authentication with keystoneauth1 plugins Source: https://gnocchi.osci.io/gnocchiclient/_sources/api.rst.txt Shows how to create a Gnocchi client using a keystoneauth1 plugin loaded from configuration options. Requires keystoneauth1, oslo_config, and the gnocchiclient package. ```python >>> from keystoneauth1 import loading >>> from oslo_config import cfg >>> from gnocchiclient import auth >>> from gnocchiclient.v1 import client >>> >>> conf = cfg.ConfigOpts() >>> ... >>> auth_plugin = loading.load_auth_from_conf_options(conf, "gnocchi_credentials") >>> gnocchi = client.Client(session_options={'auth': auth_plugin}) >>> gnocchi.resource.list("generic") ``` -------------------------------- ### gnocchi benchmark metric create Source: https://gnocchi.osci.io/gnocchiclient/shell.html Benchmark testing of metric creation. Requires --count for the number of metrics to create. Optionally specify a resource ID, archive policy name, worker count, and --keep to retain created metrics. ```shell gnocchi benchmark metric create [--resource-id RESOURCE_ID] [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] [--archive-policy-name ARCHIVE_POLICY_NAME] [--workers WORKERS] --count COUNT [--keep] ``` -------------------------------- ### ArchivePolicyRuleManager.get(name) Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.archive_policy_rule.html Gets an archive policy rule by name. The name parameter specifies which rule to retrieve. ```APIDOC ## ArchivePolicyRuleManager.get(name) ### Description Get an archive policy rule. ### Method get ### Endpoint v1/archive_policy_rule/ ### Parameters #### Path Parameters - **name** (str) - Required - Name of the archive policy rule. ### Request Example ```json { "name": "example_rule" } ``` ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### MetricManager.create Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.metric.html Create an metric. ```APIDOC ## MetricManager.create(metric=None, refetch_metric=True, name=None, archive_policy_name=None, resource_id=None, unit=None) ### Description Create an metric. ### Method create ### Parameters - **metric** - Optional - (default None) - **refetch_metric** - Optional - (default True) - **name** (str) - Optional - Metric name. - **archive_policy_name** (str) - Optional - Archive policy name. - **resource_id** (str) - Optional - The resource ID to attach the metric to. - **unit** (str) - Optional - The unit of the metric. ``` -------------------------------- ### gnocchi measures batch-resources-metrics command usage Source: https://gnocchi.osci.io/gnocchiclient/shell.html Shows the command-line syntax for batching measurements with optional creation of unknown metrics. Use --create-metrics to create unknown metrics. The file argument is required and can be '-' for stdin. ```bash gnocchi measures batch-resources-metrics [--create-metrics] file ``` -------------------------------- ### ResourceManager.create Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.resource.html Creates a new resource. ```APIDOC ## create ### Description Create a resource. ### Method create ### Parameters - **resource_type** (str) - Required - Type of the resource. - **resource** (dict) - Required - Attribute of the resource. ### Request Example ``` { "resource_type": "generic", "resource": {} } ``` ### Response No response body specified. ``` -------------------------------- ### gnocchi metric create command usage Source: https://gnocchi.osci.io/gnocchiclient/shell.html Shows the command-line usage for creating a metric. Includes options for resource ID, archive policy, unit, and output formatting. Provided by the gnocchiclient plugin. ```bash gnocchi metric create [--resource-id RESOURCE_ID] [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] [--archive-policy-name ARCHIVE_POLICY_NAME] [--unit UNIT] [METRIC_NAME] ``` -------------------------------- ### gnocchi benchmark metric create Source: https://gnocchi.osci.io/gnocchiclient/shell.html Benchmark testing of metric creation. ```APIDOC ## gnocchi benchmark metric create ### Description Do benchmark testing of metric creation. ### Command `gnocchi benchmark metric create` ### Parameters #### Options - **--resource-id, -r** (string) - Optional - ID of the resource. - **-f, --format** (string) - Optional - The output format, defaults to table. Choices: json, shell, table, value, yaml. - **-c, --column** (string) - Optional - Specify the column(s) to include, can be repeated to show multiple columns. - **--noindent** (flag) - Optional - Whether to disable indenting the JSON. - **--prefix** (string) - Optional - Add a prefix to all variable names. - **--max-width** (integer) - Optional - Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence. - **--fit-width** (flag) - Optional - Fit the table to the display width. Implied if --max-width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable. - **--print-empty** (flag) - Optional - Print empty table if there is no data to show. - **--archive-policy-name, -a** (string) - Optional - Name of the archive policy. - **--workers, -w** (integer) - Optional - Number of workers to use. - **--count, -n** (integer) - Required - Number of metrics to create. - **--keep, -k** (flag) - Optional - Keep created metrics. ### Example ``` gnocchi benchmark metric create --count 100 ``` ### Notes This command is provided by the gnocchiclient plugin. ``` -------------------------------- ### gnocchi capabilities list Source: https://gnocchi.osci.io/gnocchiclient/shell.html List capabilities. Supports output formatting options. ```bash gnocchi capabilities list [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] ``` -------------------------------- ### ResourceTypeManager.list() Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.resource_type.html Lists all resource types. ```APIDOC ## ResourceTypeManager.list() ### Description List resource types. ### Method GET ### Endpoint v1/resource_type/ ### Response #### Success Response (200) - **resource_types** (list) - List of resource types #### Response Example { "resource_types": [] } ``` -------------------------------- ### BuildManager.get() Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.build.html Retrieves the Gnocchi build information. ```APIDOC ## BuildManager.get() ### Description Get Gnocchi build information. ### Method GET ### Endpoint Not specified in the source. ### Parameters None ### Request Example None ### Response #### Success Response (200) - **build** (object) - Gnocchi build information. #### Response Example None ``` -------------------------------- ### Create archive policy rule with gnocchi archive-policy-rule create Source: https://gnocchi.osci.io/gnocchiclient/shell.html Creates an archive policy rule. Requires -a for archive policy name, -m for metric pattern, and a rule name. Supports output formatting options like -f, -c, --noindent, --prefix, --max-width, --fit-width, --print-empty. ```shell gnocchi archive-policy-rule create [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] -a ARCHIVE_POLICY_NAME -m METRIC_PATTERN name ``` -------------------------------- ### ResourceManager.list Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.resource.html Lists resources with optional details, history, pagination, and sorting. ```APIDOC ## list ### Description List resources. ### Method list ### Parameters - **resource_type** (str) - Optional - Type of the resource. Default: 'generic'. - **details** (bool) - Optional - Show all attributes of resources. Default: False. - **history** (bool) - Optional - Show the history of resources. Default: False. - **limit** (int) - Optional - Maximum number of resources to return. - **marker** (str) - Optional - The last item of the previous page; we return the next results after this value. - **sorts** (list of str) - Optional - List of resource attributes to order by. Example: ["user_id:desc-nullslast", "project_id:asc"]. ### Request Example ``` { "resource_type": "generic", "details": false, "history": false, "limit": 10, "marker": "last-item", "sorts": ["user_id:desc-nullslast"] } ``` ### Response No response body specified. ``` -------------------------------- ### gnocchi benchmark metric show Source: https://gnocchi.osci.io/gnocchiclient/shell.html Benchmark testing of metric show. Requires --count and at least one metric. Supports output formatting options and worker count. ```bash gnocchi benchmark metric show [--resource-id RESOURCE_ID] [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] [--workers WORKERS] --count COUNT metric [metric ...] ``` -------------------------------- ### gnocchi measures batch-metrics command usage Source: https://gnocchi.osci.io/gnocchiclient/shell.html Shows the command-line syntax for batching measurements from a file or stdin. The file argument is required and can be '-' for stdin. The file format follows the Gnocchi REST API documentation. ```bash gnocchi measures batch-metrics file ``` -------------------------------- ### GnocchiShell.configure_logging Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.shell.html Creates logging handlers for any log output. ```APIDOC ## GnocchiShell.configure_logging ### Description Creates logging handlers for any log output. ### Method Method ### Endpoint `GnocchiShell.configure_logging()` ### Parameters None ### Returns - **None** - This method does not return a value. ### Request Example ```python shell = GnocchiShell() shell.configure_logging() ``` ### Response #### Success Response - **None** - No return value. #### Response Example ``` None ``` ``` -------------------------------- ### gnocchi resource list command syntax Source: https://gnocchi.osci.io/gnocchiclient/shell.html Lists resources. Supports output formatting options and resource filtering options such as --details, --history, --limit, --marker, --sort, and --type. ```bash gnocchi resource list [-f {csv,json,table,value,yaml}] [-c COLUMN] [--quote {all,minimal,none,nonnumeric}] [--noindent] [--max-width ] [--fit-width] [--print-empty] [--sort-column SORT_COLUMN] [--sort-ascending | --sort-descending] [--details] [--history] [--limit ] [--marker ] [--sort ] [--type RESOURCE_TYPE] ``` -------------------------------- ### GnocchiCommandManager.load_commands Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.shell.html Loads all commands from an entrypoint namespace into the command manager. ```APIDOC ## GnocchiCommandManager.load_commands ### Description Loads all commands from an entrypoint namespace into the command manager. ### Method Method ### Endpoint `GnocchiCommandManager.load_commands(namespace)` ### Parameters - **namespace** (str) - Required - The namespace to load commands from. ### Returns - **None** - This method does not return a value. ### Request Example ```python manager = GnocchiCommandManager() manager.load_commands('my.namespace') ``` ### Response #### Success Response - **None** - No return value. #### Response Example ``` None ``` ``` -------------------------------- ### Export basic authentication environment variables Source: https://gnocchi.osci.io/gnocchiclient/_sources/shell.rst.txt Set the required environment variables for basic authentication with Gnocchi. The OS_AUTH_TYPE variable is used globally by all clients supporting Keystone; if other clients are used in the same session, pass --os-auth-plugin gnocchi-basic to the client instead. ```bash export OS_AUTH_TYPE=gnocchi-basic export GNOCCHI_USER= export GNOCCHI_ENDPOINT=http://urlofgnocchi ``` -------------------------------- ### gnocchi resource history command syntax Source: https://gnocchi.osci.io/gnocchiclient/shell.html Shows the history of a resource. Supports output formatting, sorting, pagination, and filtering by resource type. Requires resource_id. ```bash gnocchi resource history [-f {csv,json,table,value,yaml}] [-c COLUMN] [--quote {all,minimal,none,nonnumeric}] [--noindent] [--max-width ] [--fit-width] [--print-empty] [--sort-column SORT_COLUMN] [--sort-ascending | --sort-descending] [--details] [--limit ] [--marker ] [--sort ] [--type RESOURCE_TYPE] resource_id ``` -------------------------------- ### Benchmark adding measures with gnocchi benchmark measures add Source: https://gnocchi.osci.io/gnocchiclient/shell.html Runs benchmark testing for adding measurements to a metric. Requires the metric ID or name and --count/--count for the total number of measures. Optional flags include --resource-id, --workers, --batch, --timestamp-start, --timestamp-end, and --wait. Supports standard output formatting options. Provided by the gnocchiclient plugin. ```bash gnocchi benchmark measures add [--resource-id RESOURCE_ID] [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] [--workers WORKERS] --count COUNT [--batch BATCH] [--timestamp-start TIMESTAMP_START] [--timestamp-end TIMESTAMP_END] [--wait] metric ``` -------------------------------- ### gnocchi benchmark measures add Source: https://gnocchi.osci.io/gnocchiclient/shell.html Do benchmark testing of adding measurements. ```APIDOC ## gnocchi benchmark measures add ### Description Do benchmark testing of adding measurements. ### Method CLI command ### Command `gnocchi benchmark measures add` ### Parameters #### Positional Arguments - **metric** (string) - Required - ID or name of the metric #### Optional Arguments - **--resource-id, -r ** (string) - Optional - ID of the resource - **--workers, -w ** (integer) - Optional - Number of workers to use - **--count, -n ** (integer) - Required - Number of total measures to send - **--batch, -b ** (integer) - Optional - Number of measures to send in each batch - **--timestamp-start, -s ** (string) - Optional - First timestamp to use - **--timestamp-end, -e ** (string) - Optional - Last timestamp to use - **--wait** (boolean) - Optional - Wait for all measures to be processed - **-f, --format ** (string) - Optional - The output format, defaults to table - **-c, --column COLUMN** (string) - Optional - Specify the column(s) to include, can be repeated to show multiple columns - **--noindent** (boolean) - Optional - Whether to disable indenting the JSON - **--prefix ** (string) - Optional - Add a prefix to all variable names - **--max-width ** (integer) - Optional - Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence. - **--fit-width** (boolean) - Optional - Fit the table to the display width. Implied if –max-width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable - **--print-empty** (boolean) - Optional - Print empty table if there is no data to show. ### Example ``` gnocchi benchmark measures add [--resource-id RESOURCE_ID] [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] [--workers WORKERS] --count COUNT [--batch BATCH] [--timestamp-start TIMESTAMP_START] [--timestamp-end TIMESTAMP_END] [--wait] metric ``` ``` -------------------------------- ### gnocchi measures show command usage Source: https://gnocchi.osci.io/gnocchiclient/shell.html Displays the full command-line usage for retrieving measurements of a metric. Supports output formatting, column selection, time range, granularity, and aggregation options. Provided by the gnocchiclient plugin. ```bash gnocchi measures show [-f {csv,json,table,value,yaml}] [-c COLUMN] [--quote {all,minimal,none,nonnumeric}] [--noindent] [--max-width ] [--fit-width] [--print-empty] [--sort-column SORT_COLUMN] [--sort-ascending | --sort-descending] [--utc] [--resource-id RESOURCE_ID] [--aggregation AGGREGATION] [--start START] [--stop STOP] [--granularity GRANULARITY] [--refresh] [--resample RESAMPLE] metric ``` -------------------------------- ### gnocchi measures aggregation command usage Source: https://gnocchi.osci.io/gnocchiclient/shell.html Shows the full command-line syntax for retrieving aggregated measurements. Supports output formatting, metric selection, aggregation functions, time range, granularity, query filters, and resource grouping. Use -m to specify metric IDs or names, --query for resource filtering, and --refresh to force aggregation of all known measures. ```bash gnocchi measures aggregation [-f {csv,json,table,value,yaml}] [-c COLUMN] [--quote {all,minimal,none,nonnumeric}] [--noindent] [--max-width ] [--fit-width] [--print-empty] [--sort-column SORT_COLUMN] [--sort-ascending | --sort-descending] [--utc] -m METRIC [METRIC ...] [--aggregation AGGREGATION] [--reaggregation REAGGREGATION] [--start START] [--stop STOP] [--granularity GRANULARITY] [--needed-overlap NEEDED_OVERLAP] [--query QUERY] [--resource-type RESOURCE_TYPE] [--groupby GROUPBY] [--refresh] [--resample RESAMPLE] [--fill FILL] ``` -------------------------------- ### gnocchiclient.utils.build_pagination_options Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.utils.html Builds pagination options for API requests. ```APIDOC ## gnocchiclient.utils.build_pagination_options ### Description Builds pagination options for API requests. ### Parameters - **details** (bool) - Optional - Whether to include details. - **history** (bool) - Optional - Whether to include history. - **limit** (int) - Optional - Maximum number of items to return. - **marker** (str) - Optional - Marker for pagination. - **sorts** (list) - Optional - Sorting criteria. ``` -------------------------------- ### MetricManager.list Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.metric.html List metrics. ```APIDOC ## MetricManager.list(limit=None, marker=None, sorts=None) ### Description List metrics. ### Method list ### Parameters - **limit** (int) - Optional - maximum number of resources to return - **marker** (str) - Optional - the last item of the previous page; we return the next results after this value. - **sorts** (list of str) - Optional - list of resource attributes to order by. (example ["user_id:desc-nullslast", "project_id:asc"]) ``` -------------------------------- ### gnocchiclient.client.Client Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.client.html The Client class is the main entry point for the gnocchiclient Python API, used to create a client instance for interacting with Gnocchi. ```APIDOC ## gnocchiclient.client.Client ### Description Creates a new Gnocchi client instance. ### Method Constructor ### Signature Client(_version_, *args, **kwargs) ### Parameters - **version** (str) - Required - The API version to use. - **args** - Optional - Additional positional arguments. - **kwargs** - Optional - Additional keyword arguments. ``` -------------------------------- ### Gnocchi command line usage Source: https://gnocchi.osci.io/gnocchiclient/shell.html Shows the general usage of the gnocchi command with all available options. The options include version, verbosity, logging, TLS settings, authentication, and endpoint configuration. ```text gnocchi [--version] [-v | -q] [--log-file LOG_FILE] [--debug] [--gnocchi-api-version GNOCCHI_API_VERSION] [--insecure] [--os-cacert ] [--os-cert ] [--os-key ] [--timeout ] [--collect-timing] [--tls-ciphers ] [--tls-min-version {None,1.2,1.3}] [--os-auth-type ] [--user ] [--endpoint ] ``` -------------------------------- ### AggregatesManager.fetch Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.aggregates.html Documentation for the fetch method of the AggregatesManager class in the gnocchiclient.v1.aggregates module. ```APIDOC ## AggregatesManager.fetch ### Description Get measurements of an aggregated metrics. This method allows you to perform aggregation operations on metrics and retrieve the resulting measurements. ### Method fetch ### Signature fetch(operations, search=None, resource_type='generic', start=None, stop=None, granularity=None, needed_overlap=None, groupby=None, fill=None, details=False, use_history=False) ### Parameters - **operations** (list or str) - Required - operations - **search** (query) - Optional - search query (see Gnocchi REST API documentation for the format of query dictionary) - **resource_type** (str) - Optional - resource type, default is 'generic' - **start** (timestamp) - Optional - beginning of the period - **stop** (timestamp) - Optional - end of the period - **granularity** (int) - Optional - granularity to retrieve (in seconds) - **needed_overlap** (float) - Optional - percent of datapoints in each metrics required - **groupby** (list) - Optional - list of attribute to group by - **fill** (float or 'null') - Optional - value to use when backfilling missing datapoints - **details** (boolean) - Optional - also returns the list of metrics or resources associated to the operations, default is False - **use_history** (boolean) - Optional - indicates if Gnocchi server must include in the response the tag history for resources, default is False ### Notes See Gnocchi REST API documentation for the format of query dictionary: http://docs.openstack.org/developer/gnocchi/rest.html#aggregates ``` -------------------------------- ### CapabilitiesManager.list Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.capabilities.html This snippet documents the `list()` method of the `CapabilitiesManager` class. It lists the capabilities of the Gnocchi API. ```APIDOC ## CapabilitiesManager.list ### Description List capabilities. This method is part of the `CapabilitiesManager` class in the `gnocchiclient.v1.capabilities` module. ### Method list ### Endpoint `v1/capabilities/` ``` -------------------------------- ### ResourceTypeManager.create(resource_type) Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.resource_type.html Creates a new resource type. ```APIDOC ## ResourceTypeManager.create(resource_type) ### Description Create a resource type. ### Method POST ### Endpoint v1/resource_type/ ### Parameters #### Request Body - **resource_type** (dict) - Required - resource type ### Request Example { "resource_type": {} } ### Response #### Success Response (200) - **resource_type** (object) - The created resource type #### Response Example { "resource_type": {} } ``` -------------------------------- ### ArchivePolicyRuleManager.list() Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.archive_policy_rule.html Lists all archive policy rules. This method takes no parameters. ```APIDOC ## ArchivePolicyRuleManager.list() ### Description List archive policy rules. ### Method list ### Endpoint v1/archive_policy_rule/ ### Parameters None ### Request Example No request body. ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### gnocchi resource search command syntax Source: https://gnocchi.osci.io/gnocchiclient/shell.html Searches resources with specified query rules. Requires a 'query' argument to filter resources, e.g., id=90d58eea-70d7-4294-a49a-170dcdf44c3c. Supports the same options as 'resource list'. ```bash gnocchi resource search [-f {csv,json,table,value,yaml}] [-c COLUMN] [--quote {all,minimal,none,nonnumeric}] [--noindent] [--max-width ] [--fit-width] [--print-empty] [--sort-column SORT_COLUMN] [--sort-ascending | --sort-descending] [--details] [--history] [--limit ] [--marker ] [--sort ] [--type RESOURCE_TYPE] query ``` -------------------------------- ### gnocchi benchmark measures show Source: https://gnocchi.osci.io/gnocchiclient/shell.html Benchmark testing of measurements show. Requires --count and a metric ID or name. Supports output formatting, resource ID, aggregation, time range, granularity, refresh, resample, and worker options. ```shell gnocchi benchmark measures show [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] [--sort-column SORT_COLUMN] [--sort-ascending | --sort-descending] [--utc] [--resource-id RESOURCE_ID] [--aggregation AGGREGATION] [--start START] [--stop STOP] [--granularity GRANULARITY] [--refresh] [--resample RESAMPLE] [--workers WORKERS] --count COUNT metric ``` -------------------------------- ### gnocchiclient.utils.get_pagination_options Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.utils.html Extracts pagination options from parsed arguments. ```APIDOC ## gnocchiclient.utils.get_pagination_options ### Description Extracts pagination options from parsed arguments. ### Parameters - **parsed_args** (object) - Required - The parsed arguments. ``` -------------------------------- ### gnocchi server version Source: https://gnocchi.osci.io/gnocchiclient/shell.html Shows the Gnocchi server version. The output format defaults to table. Supports a prefix for variable names. ```shell gnocchi server version [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] ``` -------------------------------- ### gnocchiclient.osc.build_option_parser(_parser_) Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.osc.html Adds global options to the provided parser object. This is used to extend the command-line interface with common options. ```APIDOC ## gnocchiclient.osc.build_option_parser(_parser_) ### Description Adds global options to the parser. This function is used to extend the command-line interface with common options. ### Parameters - **_parser_** (object) - Required - The parser object to which global options will be added. ### Returns None ``` -------------------------------- ### gnocchi benchmark measures show Source: https://gnocchi.osci.io/gnocchiclient/shell.html Benchmark testing of measurements show. ```APIDOC ## gnocchi benchmark measures show ### Description Do benchmark testing of measurements show. ### Command `gnocchi benchmark measures show` ### Parameters #### Path Parameters - **metric** (string) - Required - ID or name of the metric #### Options - **-f, --format** (string) - Optional - The output format, defaults to table. Choices: json, shell, table, value, yaml. - **-c, --column** (string) - Optional - Specify the column(s) to include, can be repeated to show multiple columns. - **--noindent** (flag) - Optional - Whether to disable indenting the JSON. - **--prefix** (string) - Optional - Add a prefix to all variable names. - **--max-width** (integer) - Optional - Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence. - **--fit-width** (flag) - Optional - Fit the table to the display width. Implied if --max-width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable. - **--print-empty** (flag) - Optional - Print empty table if there is no data to show. - **--sort-column** (string) - Optional - Specify the column(s) to sort the data (columns specified first have a priority, non-existing columns are ignored), can be repeated. - **--sort-ascending** (flag) - Optional - Sort the column(s) in ascending order. - **--sort-descending** (flag) - Optional - Sort the column(s) in descending order. - **--utc** (flag) - Optional - Return timestamps as UTC. - **--resource-id, -r** (string) - Optional - ID of the resource. - **--aggregation** (string) - Optional - Aggregation to retrieve. - **--start** (string) - Optional - Beginning of the period. - **--stop** (string) - Optional - End of the period. - **--granularity** (string) - Optional - Granularity to retrieve. - **--refresh** (flag) - Optional - Force aggregation of all known measures. - **--resample** (integer) - Optional - Granularity to resample time-series to (in seconds). - **--workers, -w** (integer) - Optional - Number of workers to use. - **--count, -n** (integer) - Required - Number of total measures to send. ### Example ``` gnocchi benchmark measures show --count 100 metric ``` ### Notes This command is provided by the gnocchiclient plugin. ``` -------------------------------- ### gnocchi resource-type create - Create a resource type Source: https://gnocchi.osci.io/gnocchiclient/shell.html Creates a new resource type with a given name. Use -a/--attribute to define attributes in the format attribute_name:attribute_type:attribute_is_required:attribute_type_option_name=attribute_type_option_value:... Provided by the gnocchiclient plugin. ```shell gnocchi resource-type create [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] [-a ATTRIBUTE] name ``` -------------------------------- ### gnocchi metric create Source: https://gnocchi.osci.io/gnocchiclient/shell.html Creates a new metric using the gnocchi CLI. ```APIDOC ## gnocchi metric create ### Description Create a metric. ### Method CLI ### Command `gnocchi metric create` ### Parameters #### Positional Arguments - **METRIC_NAME** (string) - Optional - Name of the metric. #### Optional Arguments - **--resource-id, -r** (string) - Optional - ID of the resource. - **-f, --format** (string) - Optional - The output format, defaults to table. Choices: json, shell, table, value, yaml. - **-c, --column** (string) - Optional - Specify the column(s) to include, can be repeated to show multiple columns. - **--noindent** (boolean) - Optional - Whether to disable indenting the JSON. - **--prefix** (string) - Optional - Add a prefix to all variable names. - **--max-width** (integer) - Optional - Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence. - **--fit-width** (boolean) - Optional - Fit the table to the display width. Implied if --max-width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable. - **--print-empty** (boolean) - Optional - Print empty table if there is no data to show. - **--archive-policy-name, -a** (string) - Optional - Name of the archive policy. - **--unit, -u** (string) - Optional - Unit of the metric. ### Notes This command is provided by the gnocchiclient plugin. ``` -------------------------------- ### gnocchi resource-type list Source: https://gnocchi.osci.io/gnocchiclient/shell.html Lists resource types. The output format defaults to table. Options include column selection, quoting, JSON indentation, and sorting. ```shell gnocchi resource-type list [-f {csv,json,table,value,yaml}] [-c COLUMN] [--quote {all,minimal,none,nonnumeric}] [--noindent] [--max-width ] [--fit-width] [--print-empty] [--sort-column SORT_COLUMN] [--sort-ascending | --sort-descending] ``` -------------------------------- ### gnocchi archive-policy list - List archive policies Source: https://gnocchi.osci.io/gnocchiclient/shell.html Lists all archive policies. Supports output formatting options such as -f/--format (defaults to table), column selection, quoting, indentation control, and sorting. Provided by the gnocchiclient plugin. ```shell gnocchi archive-policy list [-f {csv,json,table,value,yaml}] [-c COLUMN] [--quote {all,minimal,none,nonnumeric}] [--noindent] [--max-width ] [--fit-width] [--print-empty] [--sort-column SORT_COLUMN] [--sort-ascending | --sort-descending] ``` -------------------------------- ### GnocchiBasicPlugin.get_headers(session, **kwargs) Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.auth.html Fetches authentication headers for a message. This is a generalized replacement for the older get_token method, allowing plugins to specify different or additional authentication headers. ```APIDOC ## GnocchiBasicPlugin.get_headers(session, **kwargs) ### Description Fetches authentication headers for a message. This is a generalized replacement for the older get_token method, allowing plugins to specify different or additional authentication headers. ### Method Method: get_headers ### Parameters - **session** (keystoneauth1.session.Session) - Required - The session object that the auth_plugin belongs to. - **kwargs** - Optional - Additional keyword arguments. ### Returns - **dict** - Headers that are set to authenticate a message or None for failure. Note that an empty dict is a valid, non-failure response. ``` -------------------------------- ### class gnocchiclient.v1.client.Client(_session =None_, _adapter_options =None_, _session_options =None_) Source: https://gnocchi.osci.io/gnocchiclient/api/gnocchiclient.v1.client.html Client for the Gnocchi v1 API. This class is the main interface for users to interact with the Gnocchi v1 API, providing methods to access various resources. ```APIDOC ## class gnocchiclient.v1.client.Client(_session =None_, _adapter_options =None_, _session_options =None_) ### Description Client for the Gnocchi v1 API. This class is the main entry point for users to interact with the Gnocchi v1 API. ### Base Class - `object` ### Constructor Parameters - **session** (keystoneauth1.session.Session, optional) - A keystoneauth1 session. - **adapter_options** (dict, optional) - Options to pass to keystoneauth1.adapter.Adapter. - **session_options** (dict, optional) - Options to pass to keystoneauth1.session.Session. ### Usage ```python from gnocchiclient.v1.client import Client client = Client(session=my_session) ``` ``` -------------------------------- ### gnocchi metric list command usage Source: https://gnocchi.osci.io/gnocchiclient/shell.html Lists metrics. Supports output formatting options and filtering with --limit, --marker, and --sort. Default output format is table. ```shell gnocchi metric list [-f {csv,json,table,value,yaml}] [-c COLUMN] [--quote {all,minimal,none,nonnumeric}] [--noindent] [--max-width ] [--fit-width] [--print-empty] [--sort-column SORT_COLUMN] [--sort-ascending | --sort-descending] [--limit ] [--marker ] [--sort ] ``` -------------------------------- ### Export OpenStack Keystone authentication environment variables Source: https://gnocchi.osci.io/gnocchiclient/_sources/shell.rst.txt Set the environment variables required for Keystone authentication. The command line tool will attempt to reauthenticate for every request using these credentials. ```bash export OS_AUTH_TYPE=password export OS_USERNAME=user export OS_PASSWORD=pass export OS_TENANT_NAME=myproject export OS_AUTH_URL=http://auth.example.com:5000/v2.0 ``` -------------------------------- ### Override reauthentication with token and endpoint environment variables Source: https://gnocchi.osci.io/gnocchiclient/_sources/shell.rst.txt Set environment variables to manually supply an auth token and endpoint, overriding the default reauthentication behavior. This is useful when you want to use a pre-obtained token. ```bash export GNOCCHI_ENDPOINT=http://gnocchi.example.org:8041 export OS_AUTH_PLUGIN=token export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155 ``` -------------------------------- ### gnocchi resource show - Show a resource Source: https://gnocchi.osci.io/gnocchiclient/shell.html Displays a resource identified by its resource_id. Supports output formatting options such as -f/--format, column selection, and JSON indentation control. The --type option specifies the resource type. Provided by the gnocchiclient plugin. ```shell gnocchi resource show [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width ] [--fit-width] [--print-empty] [--type RESOURCE_TYPE] resource_id ```