9.4 KiB
title | description | menu | weight | influxdb/v2.0/tags | related | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Monitor InfluxDB OSS using a template | Monitor your InfluxDB OSS instance using InfluxDB Cloud and a pre-built InfluxDB template. |
|
102 |
|
|
Use InfluxDB Cloud, the InfluxDB Open Source (OSS) Metrics template, and Telegraf to monitor one or more InfluxDB OSS instances.
Do the following:
- Review requirements
- Install the InfluxDB OSS Monitoring template
- Set up InfluxDB OSS for monitoring
- Set up Telegraf
- View the Monitoring dashboard
- (Optional) Alert when metrics stop reporting
- (Optional) Create a notification endpoint and rule
Review requirements
Before you begin, make sure you have access to the following:
- InfluxDB Cloud account (sign up for free here)
- Command line access to a machine running InfluxDB OSS 2.x and permissions to install Telegraf on this machine
- Internet connectivity from the machine running InfluxDB OSS 2.x and Telegraf to InfluxDB Cloud
- Sufficient resource availability to install the template. InfluxDB Cloud Free Plan accounts include resource limits
Install the InfluxDB OSS Monitoring template
The InfluxDB OSS Monitoring template includes a Telegraf configuration that sends InfluxDB OSS metrics to an InfluxDB endpoint and a dashboard that visualizes the metrics.
-
Log into your InfluxDB Cloud account, go to Settings > Templates, and enter the following template URL:
https://raw.githubusercontent.com/influxdata/community-templates/master/influxdb2_oss_metrics/influxdb2_oss_metrics.yml
-
Click Lookup Template, and then click Install Template. InfluxDB Cloud imports the template, which includes the following resources:
- Dashboard
InfluxDB OSS Metrics
- Telegraf configuration
scrape-influxdb-oss-telegraf
- Bucket
oss_metrics
- Check
InfluxDB OSS Deadman
- Labels
influxdb2
andprometheus
- Dashboard
Set up InfluxDB OSS for monitoring
By default, InfluxDB OSS 2.x has a /metrics
endpoint available, which exports Prometheus-style system metrics.
-
Make sure the
/metrics
endpoint is [enabled](/{{< latest "influxdb" >}}/reference/config-options/#metrics-disabled). If you've changed the default settings to disable the/metrics
endpoint, [re-enable these settings](/{{< latest "influxdb" >}}/reference/config-options/#metrics-disabled). -
Navigate to the
/metrics
endpoint of your InfluxDB OSS instance to view the InfluxDB OSS system metrics in your browser:http://localhost:8086/metrics
Or use
curl
to fetch metrics:curl http://localhost:8086/metrics # HELP boltdb_reads_total Total number of boltdb reads # TYPE boltdb_reads_total counter boltdb_reads_total 41 # HELP boltdb_writes_total Total number of boltdb writes # TYPE boltdb_writes_total counter boltdb_writes_total 28 # HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. ...
-
Verify the [Telegraf](/{{< latest "telegraf" >}}/) agent has network access to the
/metrics
endpoint for each monitored InfluxDB OSS instance. -
Add your InfluxDB Cloud account information (URL and organization) to your Telegraf configuration by doing the following:
-
Go to Load Data > Telegraf in your InfluxDB Cloud account, and click InfluxDB Output Plugin.
-
Copy the URL, token, organization, and bucket, close the window, and then click Scrape InfluxDB OSS Metrics.
-
Replace
URL
,token',
organization, and
bucketunder
outputs.influxdb_v2` with your InfluxDB Cloud account information. Alternatively, store this information in your environment variables and include the environment variables in your configuration.{{% note %}} To ensure the InfluxDB OSS monitoring dashboard can display the recorded metrics, set the destination bucket name to
oss_metrics
in yourtelegraf.conf
. {{% /note %}} -
Add the Prometheus input plugin to your
telegraf.conf
. Specify your your InfluxDB OSS URL(s) in theurls
parameter. For example:
{{< keep-url >}}
[[inputs.prometheus]] urls = ["http://localhost:8086/metrics"]
If you're using unique URLs or have security set up for your
/metrics
endpoint, configure those options here and save the updated configuration.For more information about customizing Telegraf, see [Configure Telegraf](/{{< latest "telegraf" >}}/administration/configuration/#global-tags).
-
-
Click Save Changes.
Set up Telegraf
Set up Telegraf to scrape metrics from InfluxDB OSS to send to your InfluxDB Cloud account.
On each InfluxDB OSS instance you want to monitor, do the following:
-
Go to Load Data > Telegraf in your InfluxDB Cloud account.
-
Click Setup Instructions under Scrape InfluxDB OSS Metrics.
-
Complete the Telegraf Setup instructions.
{{% note %}} For your API token, generate a new token or use an existing All Access token. If you run Telegraf as a service, edit your init script to set the environment variable and ensure its available to the service. {{% /note %}}
Telegraf runs quietly in the background (no immediate output appears), and Telegraf begins pushing metrics to your InfluxDB Cloud account.
View the Monitoring dashboard
To see your data in real time, view the Monitoring dashboard.
-
Select Boards (Dashboards) in your InfluxDB Cloud account.
{{< nav-icon "dashboards" >}}
-
Click InfluxDB OSS Metrics. Metrics appear in your dashboard.
-
Customize your monitoring dashboard as needed. For example, send an alert in the following cases:
- Users create a new task or bucket
- You're testing machine limits
- Metrics stop reporting
Alert when metrics stop reporting
The Monitoring template includes a deadman check to verify metrics are reported at regular intervals.
To alert when data stops flowing from InfluxDB OSS instances to your InfluxDB Cloud account, do the following:
- Customize the deadman check to identify the fields you want to monitor.
- Create a notification endpoint and rule to receive notifications when your deadman check is triggered.
Customize the deadman check
-
To view the deadman check, click Alerts in the navigation bar of your InfluxDB Cloud account.
{{< nav-icon "alerts" >}}
{{< img-hd src="/img/influxdb/2-0-monitor-oss-deadman.png" />}}
-
Choose a InfluxDB OSS field or create a new OSS field for your deadman alert:
- Click {{< icon "plus" >}} Create and select Deadman Check in the dropown menu.
- Define your query with at least one field.
- Click Submit and Configure Check. When metrics stop reporting, you'll receive an alert.
-
Start under Schedule Every, set the amount of time to check for data.
-
Set the amount of time to wait before switching to a critical alert.
-
Save the Check and click on View History of the Check under the gear icon to verify it is running.
Create a notification endpoint and rule
To receive a notification message when your deadman check is triggered, create a notification endpoint and rule.
Create a notification endpoint
InfluxData supports different endpoints: Slack, PagerDuty, and HTTP. Slack is free for all users, while PagerDuty and HTTP are exclusive to the Usage-Based Plan.
Send a notification to Slack
- Create a Slack Webhooks.
- Go to Alerts > Notification Endpoint and click {{< icon "plus" >}} Create, and enter a name and description for your Slack endpoint.
- Enter your Slack Webhook under Incoming Webhook URL and click Create Notification Endpoint.
Send a notification to PagerDuty or HTTP
Send a notification to PagerDuty or HTTP endpoints (other webhooks) by upgrading your InfluxDB Cloud account.
Create a notification rule
Create a notification rule to set rules for when to send a deadman alert message to your notification endpoint.
- Go to Alerts > Notification Rules and click {{< icon "plus" >}} Create.
- Fill out the About and Conditions section then click Create Notification Rule.