You've already forked mysqld_exporter
mirror of
https://github.com/prometheus/mysqld_exporter.git
synced 2025-07-31 17:44:21 +03:00
Introduce Scraper interface
Signed-off-by: Kamil Dziedzic <arvenil@klecza.pl>
This commit is contained in:
@ -36,7 +36,20 @@ func columnValue(scanArgs []interface{}, slaveCols []string, colName string) str
|
||||
}
|
||||
|
||||
// ScrapeSlaveStatus collects from `SHOW SLAVE STATUS`.
|
||||
func ScrapeSlaveStatus(db *sql.DB, ch chan<- prometheus.Metric) error {
|
||||
type ScrapeSlaveStatus struct{}
|
||||
|
||||
// Name of the Scraper. Should be unique.
|
||||
func (ScrapeSlaveStatus) Name() string {
|
||||
return slaveStatus
|
||||
}
|
||||
|
||||
// Help describes the role of the Scraper.
|
||||
func (ScrapeSlaveStatus) Help() string {
|
||||
return "Collect from SHOW SLAVE STATUS"
|
||||
}
|
||||
|
||||
// Scrape collects data from database connection and sends it over channel as prometheus metric.
|
||||
func (ScrapeSlaveStatus) Scrape(db *sql.DB, ch chan<- prometheus.Metric) error {
|
||||
var (
|
||||
slaveStatusRows *sql.Rows
|
||||
err error
|
||||
|
Reference in New Issue
Block a user