This InfluxDB Template can be used to monitor a website running on NGINX and MySQL
In the InfluxDB UI, go to Settings->Templates and enter this URL: https://raw.githubusercontent.com/influxdata/community-templates/master/nginx_mysql/nginx_mysql.yml
If you have your InfluxDB credentials configured in the CLI, you can install this template with:
influx apply -u https://raw.githubusercontent.com/influxdata/community-templates/master/nginx_mysql/nginx_mysql.yml
NGINX + MySQL
Dashboard (see screenshot above)- Telegraf configuration for
nginx
andmysql
- Bucket variables for
mysqlBucket
andnginxBucket
. You will need to update the value for these thru the InfluxDB UISettings
>Variables
after you've installed this dashboard template - Labels:
nginx
andmysql
General instructions on using InfluxDB Templates can be found in the use a template document.
In order to collect information from your NGINX server, you will need:
-
NGINX compiled with
ngx_http_stub_status_module
module. Module documentation here -
url
location for yourstub_status
e.g. "{{nginx_url}}/basic_status" when configured with:location = /basic_status { stub_status; }
In order to collect information form your MySQL database you will need:
username
for an authorized user with READ access at the very leastpassword
address
address of your MySQL instance(s)
The data for the dashboard is populated by the included Telegraf NGINX and MySQL configurations. The Configuration requires the following environment variables
INFLUX_TOKEN
- The token with the permissions to read Telegraf configs and write data to thetelegraf
bucket. You can just use your operator token to get started.INFLUX_ORG
- The name of your Organization (this will be your email address on the InfluxDB Cloud free tier)INFLUX_HOST
- The URL of your InfluxDB host (this can your localhost, a remote instance, or InfluxDB Cloud)NGINX_STATUS_URL
- The URL where your server status reports are served fromMYSQL_USERNAME
MYSQL_PASSWORD
MYSQL_ADDRESS
You MUST set these environment variables before running Telegraf using something similar to the following commands
- This can be found on the
Load Data
>Tokens
page in your browser:export INFLUX_TOKEN=TOKEN
- Your Organization name can be found on the Settings page in your browser:
export INFLUX_ORG=my_org
Be sure to update the values for these variables: mysqlBucket
, nginxBucket
, NGINX_STATUS_URL
, MYSQL_USERNAME
, MYSQL_PASSWORD
, and MYSQL_ADDRESS
- Author: Ray Farias
- Email: ray@sudokrew.com
- Github: @sgnl
- Influx Slack: @Ray Farias