[root@pmmclient ~]# cd /home/mysql/DBA/programs/PMM105/client/
[root@pmmclient client]# unzip prometheus-mysql-exporter-master.zip
Archive: prometheus-mysql-exporter-master.zip
7668d39742481bd91d60445a999ec98aeb185797
creating: prometheus-mysql-exporter-master/
inflating: prometheus-mysql-exporter-master/.gitignore
inflating: prometheus-mysql-exporter-master/Dockerfile
inflating: prometheus-mysql-exporter-master/LICENSE
inflating: prometheus-mysql-exporter-master/MANIFEST.in
inflating: prometheus-mysql-exporter-master/README.md
inflating: prometheus-mysql-exporter-master/exporter.cfg
creating: prometheus-mysql-exporter-master/prometheus_mysql_exporter/
inflating: prometheus-mysql-exporter-master/prometheus_mysql_exporter/__init__.py
inflating: prometheus-mysql-exporter-master/prometheus_mysql_exporter/__main__.py
inflating: prometheus-mysql-exporter-master/prometheus_mysql_exporter/parser.py
inflating: prometheus-mysql-exporter-master/setup.py
[root@pmmclient client]# cd ./prometheus-mysql-exporter-master/prometheus_mysql_exporter
[root@pmmclient prometheus_mysql_exporter]# vi __init__.py
.................
for name, (interval, query, value_columns) in queries.items():
mysql_client = MySQLdb.connect(
host = mysql_host,
port = mysql_port,
user = username,
passwd = password,
autocommit = True,
charset = 'utf8',
use_unicode = True,
)
run_scheduler(scheduler, mysql_client, dbs, name, interval, query, value_columns)
try:
scheduler.run()
except KeyboardInterrupt:
pass
logging.info('Shutting down')
[root@pmmclient prometheus_mysql_exporter]# cd /home/mysql/DBA/programs/PMM105/client/prometheus-mysql-exporter-master/
[root@pmmclient prometheus-mysql-exporter-master]# python3 setup.py install
running install
running bdist_egg
running egg_info
creating prometheus_mysql_exporter.egg-info
writing entry points to prometheus_mysql_exporter.egg-info/entry_points.txt
writing requirements to prometheus_mysql_exporter.egg-info/requires.txt
writing top-level names to prometheus_mysql_exporter.egg-info/top_level.txt
................
Using /usr/local/lib/python3.5/site-packages/prometheus_client-0.0.16-py3.5.egg
Searching for mysqlclient==1.3.9
Best match: mysqlclient 1.3.9
Processing mysqlclient-1.3.9-py3.5-linux-x86_64.egg
mysqlclient 1.3.9 is already the active version in easy-install.pth
Using /usr/local/lib/python3.5/site-packages/mysqlclient-1.3.9-py3.5-linux-x86_64.egg
Finished processing dependencies for prometheus-mysql-exporter==0.2.0.dev1
[root@pmmclient prometheus-mysql-exporter-master]# prometheus-mysql-exporter --help
usage: prometheus-mysql-exporter [-h] [-p PORT] [-c CONFIG_FILE]
[-s MYSQL_SERVER] -d MYSQL_DATABASES
[-u MYSQL_USER] [-P MYSQL_PASSWORD] [-v]
Export MySQL query results to Prometheus.
optional arguments:
-h, --help show this help message and exit
-p PORT, --port PORT port to serve the metrics endpoint on. (default: 8080)
-c CONFIG_FILE, --config-file CONFIG_FILE
path to query config file. Can be absolute, or
relative to the current working directory. (default:
exporter.cfg)
-s MYSQL_SERVER, --mysql-server MYSQL_SERVER
address of a MySQL server to run queries on. A port
can be provided if non-standard (3306) e.g. mysql:3333
(default: localhost)
-d MYSQL_DATABASES, --mysql-databases MYSQL_DATABASES
databases to run queries on. Database names should be
separated by commas e.g. db1,db2.
-u MYSQL_USER, --mysql-user MYSQL_USER
MySQL user to run queries as. (default: root)
-P MYSQL_PASSWORD, --mysql-password MYSQL_PASSWORD
password for the MySQL user, if required. (default: no
password)
-v, --verbose turn on verbose logging.