1
0
mirror of https://github.com/prometheus/mysqld_exporter.git synced 2025-04-18 09:24:02 +03:00

add info files and fix simple issues

This commit is contained in:
Eugene Chertikhin 2015-03-12 18:58:52 +03:00
parent 60e8f761ef
commit 4a2553da87
6 changed files with 48 additions and 16 deletions

13
AUTHORS.md Normal file
View File

@ -0,0 +1,13 @@
The Prometheus project was started by Matt T. Proud (emeritus) and
Julius Volz in 2012.
Maintainers of this repository:
* Brian Brazil <brian.brazil@boxever.com>
* Johannes 'fish' Ziemke <github@freigeist.org>
* Tobias Schmidt <ts@soundcloud.com>
The following individuals have contributed code to this repository
(listed in alphabetical order):
* Eugene Chertikhin <e.chertikhin@crestwavetech.ru>

18
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,18 @@
# Contributing
Prometheus uses GitHub to manage reviews of pull requests.
* If you have a trivial fix or improvement, go ahead and create a pull
request, addressing (with `@...`) one or more of the maintainers
(see [AUTHORS.md](AUTHORS.md)) in the description of the pull request.
* If you plan to do something more involved, first discuss your ideas
on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
This will avoid unnecessary work and surely give you and us a good deal
of inspiration.
* Relevant coding style guidelines are the [Go Code Review
Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
and the _Formatting and style_ section of Peter Bourgon's [Go: Best
Practices for Production
Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).

View File

@ -1,4 +1,4 @@
# Copyright 2013 The Prometheus Authors
# Copyright 2015 The Prometheus Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

7
NOTICE
View File

@ -1,5 +1,2 @@
Exporter for mysql daemon
by Eugene Chertikhin <e.chertikhin@crestwavetech.ru>
This product includes software developed at
SoundCloud Ltd. (http://soundcloud.com/).
Exporter for MySQL daemon.
Copyright 2015 The Prometheus Authors

View File

@ -7,6 +7,14 @@ Exporter for MySQL server metrics http://prometheus.io/
make
./mysqld_exporter <flags>
Flags description
Name | Description
-------------------|------------
web.listen-address | Address to listen on for web interface and telemetry.
web.telemetry-path | Path under which to expose metrics.
config.file | Config file name with connection string
## Configuration
The configuration is in JSON. An example with all possible options:
```
@ -16,10 +24,5 @@ The configuration is in JSON. An example with all possible options:
}
}
```
Name | Description
---------|------------
login | Login name for connect with server
password | Password for connect with server
host | Server hostname or ip. May be omitted
dbname | Name of database
Format of connection string described at https://github.com/go-sql-driver/mysql#dsn-data-source-name

View File

@ -8,6 +8,7 @@ import (
"net/http"
"strconv"
"sync"
"strings"
"database/sql"
_ "github.com/go-sql-driver/mysql"
@ -20,7 +21,7 @@ const (
)
var (
listenAddress = flag.String("web.listen-address", ":9091", "Address to listen on for web interface and telemetry.")
listenAddress = flag.String("web.listen-address", ":9104", "Address to listen on for web interface and telemetry.")
metricPath = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.")
configFile = flag.String("config.file", "mysqld_exporter.conf", "Path to config file.")
)
@ -59,12 +60,12 @@ func NewMySQLExporter(config *Config) *Exporter {
}),
totalScrapes: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "exporter_total_scrapes",
Name: "exporter_scrapes_total",
Help: "Current total mysqld scrapes.",
}),
errorScrapes: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "exporter_error_scrapes",
Name: "exporter_scrape_errors_total",
Help: "Error mysqld scrapes.",
}),
metrics: map[string]prometheus.Gauge{},
@ -139,7 +140,7 @@ func (e *Exporter) scrape(scrapes chan<- []string) {
func (e *Exporter) setMetrics(scrapes <-chan []string) {
for row := range scrapes {
name := row[0]
name := strings.ToLower(row[0])
value, err := strconv.ParseInt(row[1], 10, 64)
if err != nil {
// not really important