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 + MySQLDashboard (see screenshot above)- Telegraf configuration for
nginxandmysql - Bucket variables for
mysqlBucketandnginxBucket. You will need to update the value for these thru the InfluxDB UISettings>Variablesafter you've installed this dashboard template - Labels:
nginxandmysql
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_modulemodule. Module documentation here -
urllocation for yourstub_statuse.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:
usernamefor an authorized user with READ access at the very leastpasswordaddressaddress 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 thetelegrafbucket. 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_USERNAMEMYSQL_PASSWORDMYSQL_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>Tokenspage 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
