### Install Gnocchi Go SDK Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/client.rst Install the open-source Go SDK for Gnocchi using go get. This package is provided by the Gophercloud project. ```bash go get github.com/gophercloud/utils/gnocchi ``` -------------------------------- ### Install Gnocchi from Source with Optional Drivers Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/install.rst Install Gnocchi from source with specific driver support, such as PostgreSQL and Ceph. ```bash pip install -e .[postgresql,ceph,ceph_recommended_lib] ``` -------------------------------- ### Install Gnocchi from Source Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/install.rst Install Gnocchi from its source code using pip's editable install option. ```bash pip install -e . ``` -------------------------------- ### Create Ceph Pool and User Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/install.rst Example commands to create a Ceph pool named 'metrics' and a client user for Gnocchi. ```bash ceph osd pool create metrics 8 8 ceph auth get-or-create client.gnocchi mon "allow r" osd "allow rwx pool=metrics" ``` -------------------------------- ### Install Gnocchi Python Client Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/client.rst Install the official Python client for Gnocchi using pip. This provides the 'gnocchi' command-line tool. ```bash pip install gnocchiclient ``` -------------------------------- ### Install Gnocchi with Optional Drivers Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/install.rst Install Gnocchi using pip, specifying extra variants for drivers like PostgreSQL, Ceph, and Keystone. ```bash pip install gnocchi[postgresql,ceph,keystone] ``` -------------------------------- ### Install Gnocchi Grafana Plugin Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/grafana.rst Use the grafana-cli tool to install the Gnocchi data source plugin for Grafana. This is the first step for integrating Gnocchi with Grafana. ```bash sudo grafana-cli plugins install gnocchixyz-gnocchi-datasource ``` -------------------------------- ### Apache mod_wsgi Configuration for Gnocchi API Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/operating.rst Example Apache httpd configuration using mod_wsgi to serve the Gnocchi API. This setup allows for scaling by defining multiple processes and threads. ```apache WSGIDaemonProcess gnocchi user=gnocchi processes=4 threads=32 display-name=%{GROUP} WSGIProcessGroup gnocchi WSGIScriptAlias / /usr/local/bin/gnocchi-api WSGIPassAuthorization On WSGIApplicationGroup %{GLOBAL} Require all granted ``` -------------------------------- ### Install collectd-gnocchi Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/collectd.rst Install the collectd-gnocchi plugin using pip. This is the first step to enable Collectd to send data to Gnocchi. ```bash pip install collectd-gnocchi ``` -------------------------------- ### Upgrade Gnocchi Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/operating.rst Run gnocchi-upgrade to re-initialize the different drivers when clearing Gnocchi data and starting fresh. ```bash gnocchi-upgrade ``` -------------------------------- ### Install gnocchi-nagios Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/nagios.rst Install the gnocchi-nagios service using pip. This package is required to enable Nagios/Icinga support. ```bash pip install gnocchi-nagios ``` -------------------------------- ### Run Gnocchi API and Metric Daemon Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/operating.rst Basic command to start the Gnocchi HTTP server and metric daemon. These services can be run as background daemons. ```bash gnocchi-api gnocchi-metricd ``` -------------------------------- ### Install Gnocchi with AMQP 1.0 Flavor Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/amqp1d.rst To enable amqp1d support in Gnocchi, install it with the 'amqp1' flavor. This ensures all necessary dependencies for AMQP 1.0 communication are included. ```bash pip install -e .[postgresql,file,amqp1] ``` -------------------------------- ### uWSGI Configuration for Gnocchi API Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/operating.rst A base uWSGI configuration file for deploying the Gnocchi API. Adjust paths and process/thread counts based on your installation and system resources. ```ini [uwsgi] http = localhost:8041 # Set the correct path depending on your installation wsgi-file = /usr/local/bin/gnocchi-api master = true die-on-term = true threads = 32 # Adjust based on the number of CPU processes = 32 enabled-threads = true thunder-lock = true plugins = python buffer-size = 65535 lazy-apps = true add-header = Connection: close ``` -------------------------------- ### Configure Collectd AMQP 1.0 Write Plugin Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/collectd.rst Configure the Collectd AMQP 1.0 write plugin to send data. This setup specifies the transport details and the address for the data. ```collectd Host "localhost" Port "5672" Address "collectd" Format JSON ``` -------------------------------- ### Prometheus Remote Write Configuration Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/prometheus.rst Configure Prometheus to send metrics to Gnocchi's /v1/prometheus/write endpoint. Ensure Gnocchi is installed with the 'prometheus' flavor. ```yaml remote_write: - url: "http://localhost:8041/v1/prometheus/write" basic_auth: username: "admin" password: "whatever" ``` -------------------------------- ### Gnocchi Configuration Sample Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/install.rst This is a sample configuration file for Gnocchi, outlining various settings for indexer, storage, and other parameters. ```ini [DEFAULT] # The SQLAlchemy connection string for the database. # The default is sqlite:///:memory: which is not suitable for production. # For production, use a database like PostgreSQL or MySQL. # Example for PostgreSQL: postgresql://user:password@host:port/database # Example for MySQL: mysql://user:password@host:port/database # sql_connection = sqlite:///:memory: # The SQLAlchemy connection string for the database. # The default is sqlite:///:memory: which is not suitable for production. # For production, use a database like PostgreSQL or MySQL. # Example for PostgreSQL: postgresql://user:password@host:port/database # Example for MySQL: mysql://user:password@host:port/database sql_connection = sqlite:///:memory: [storage] # The storage driver to use. Supported values are: # - "file" (default) # - "swift" # - "rbd" # - "ceph" # - "sqlalchemy" # driver = file [storage/file] # The directory where metrics will be stored. # This option is only used when the "file" driver is selected. # The directory must exist and be writable by the Gnocchi API process. # Note: This option is deprecated and will be removed in a future release. # Use "gnocchi.storage.file.base_dir" instead. # base_dir = /var/lib/gnocchi/storage [storage/file] # The directory where metrics will be stored. # This option is only used when the "file" driver is selected. # The directory must exist and be writable by the Gnocchi API process. base_dir = /var/lib/gnocchi/storage [storage/swift] # The Swift container to use for storing metrics. # container = gnocchi [storage/rbd] # The RBD pool to use for storing metrics. # pool = gnocchi [storage/ceph] # The Ceph pool to use for storing metrics. # pool = gnocchi [storage/sqlalchemy] # The SQLAlchemy connection string for the database. # The default is sqlite:///:memory: which is not suitable for production. # For production, use a database like PostgreSQL or MySQL. # Example for PostgreSQL: postgresql://user:password@host:port/database # Example for MySQL: mysql://user:password@host:port/database # sql_connection = sqlite:///:memory: [indexer] # The indexer driver to use. Supported values are: # - "file" (default) # - "sqlalchemy" # driver = file [indexer/file] # The directory where index data will be stored. # This option is only used when the "file" driver is selected. # The directory must exist and be writable by the Gnocchi API process. # Note: This option is deprecated and will be removed in a future release. # Use "gnocchi.indexer.file.base_dir" instead. # base_dir = /var/lib/gnocchi/index [indexer/file] # The directory where index data will be stored. # This option is only used when the "file" driver is selected. # The directory must exist and be writable by the Gnocchi API process. base_dir = /var/lib/gnocchi/index [indexer/sqlalchemy] # The SQLAlchemy connection string for the database. # The default is sqlite:///:memory: which is not suitable for production. # For production, use a database like PostgreSQL or MySQL. # Example for PostgreSQL: postgresql://user:password@host:port/database # Example for MySQL: mysql://user:password@host:port/database # sql_connection = sqlite:///:memory: [api] # The host and port to bind the API server to. # host = 0.0.0.0 # port = 8041 # The authentication mode to use. Supported values are: # - "basic" (default) # - "keystone" # - "remoteuser" # auth_mode = basic [api/keystone] # The Keystone authentication options. # The following options are required: # - auth_url # - username # - password # - project_name # - user_domain_name # - project_domain_name # auth_url = http://localhost:5000/ # username = gnocchi # password = password # project_name = service # user_domain_name = Default # project_domain_name = Default [api/remoteuser] # The header name to use for the REMOTE_USER environment variable. # header_name = REMOTE_USER [metricd] # The host and port to bind the metricd server to. # host = 0.0.0.0 # port = 8042 [statsd] # The host and port to bind the statsd server to. # host = 0.0.0.0 # port = 8125 ``` -------------------------------- ### Launch Gnocchi API with uWSGI Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/operating.rst Command to launch the Gnocchi API using a uWSGI configuration file. Ensure the configuration file is saved to the specified path. ```bash uwsgi /etc/gnocchi/uwsgi.ini ``` -------------------------------- ### Run tox tests with Python 3.9, PostgreSQL, and file storage Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/contributing.rst Execute tests using tox with specific Python version, indexer, and storage backend configurations. Ensure tox and virtualenv are up-to-date. ```bash tox -e py39-postgresql-file ``` -------------------------------- ### Configure Gnocchi AMQP 1.0 Daemon Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/collectd.rst Configure the gnocchi.conf file to specify the AMQP 1.0 URL for the gnocchi-amqp1d daemon. This connects Gnocchi to the Collectd data stream. ```ini [amqp1d] url = localhost:5672/u/collectd/telemetry ``` -------------------------------- ### Generate Gnocchi Configuration File Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/install.rst Generate a default Gnocchi configuration file by redirecting the output of gnocchi-config-generator. ```bash gnocchi-config-generator > /path/to/gnocchi.conf ``` -------------------------------- ### Run tox tests with Python 3.9, MySQL, and Ceph storage Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/contributing.rst Execute tests using tox with specific Python version, indexer, and storage backend configurations. Ensure tox and virtualenv are up-to-date. ```bash tox -e py39-mysql-ceph ``` -------------------------------- ### Run tox tests within a Docker container Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/contributing.rst Execute tests using tox inside a Docker container to replicate CI environment. Requires a user with UID 1001 and GID 1001, and at least 4 GB of RAM. ```bash docker run -v $(pwd):/github/workspace gnocchixyz/ci-tools:latest tox ``` -------------------------------- ### Telegraf Configuration for Gnocchi InfluxDB Endpoint Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/influxdb.rst This configuration allows Telegraf to send metrics to Gnocchi's InfluxDB compatible API. It specifies the Gnocchi API URL and sets a custom HTTP header to map the 'host' tag to the Gnocchi resource ID. ```TOML [[outputs.influxdb]] urls = ["http://admin:localhost:8041/v1/influxdb"] http_headers = {"X-Gnocchi-InfluxDB-Tag-Resource-ID" = "host"} ``` -------------------------------- ### Configure CORS Middleware in Gnocchi Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/grafana.rst Enable Cross-Origin Resource Sharing (CORS) in Gnocchi's configuration file to allow requests from Grafana. This is required for direct mode operation. ```ini [cors] allowed_origin = http://grafana.fqdn ``` -------------------------------- ### Check Gnocchi Status Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/operating.rst Use the gnocchi status command to check the backlog of measures to process. This is also available via the /v1/status HTTP API endpoint. ```bash gnocchi status ``` -------------------------------- ### Change Gnocchi Sack Size Source: https://github.com/gnocchixyz/gnocchi/blob/master/doc/source/operating.rst Use this command to change the sack size of Gnocchi. This operation is only possible if the backlog is empty. ```bash gnocchi-change-sack-size ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.