Index: trunk/ganglia_metrics/gmetricd.py |
— | — | @@ -180,7 +180,7 @@ |
181 | 181 | diskStats = DiskStats.DiskStats() |
182 | 182 | pushMetrics = GangliaMetrics.MetricCollection() |
183 | 183 | |
184 | | -mysqlStats = MySQLStats.MySQLStats( conf['dbuser'], conf['dbpassword'] ) |
| 184 | +mysqlStats = MySQLStats.MySQLStats( conf['dbuser'], conf['dbpassword'], conf['mysqlclient'] ) |
185 | 185 | allMetrics = (diskStats, pushMetrics, mysqlStats) |
186 | 186 | |
187 | 187 | # Daemonize |
Index: trunk/ganglia_metrics/MySQLStats.py |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | A collection of metrics from MySQL, using SHOW STATUS and SHOW PROCESSLIST |
8 | 8 | """ |
9 | 9 | class MySQLStats(MetricCollection): |
10 | | - def __init__(self, user, password): |
| 10 | + def __init__(self, user, password, client): |
11 | 11 | self.metrics = { |
12 | 12 | 'mysql_questions': DeltaMetricItem( |
13 | 13 | 'mysql_questions', |
— | — | @@ -35,6 +35,7 @@ |
36 | 36 | } |
37 | 37 | self.user = user |
38 | 38 | self.password = password |
| 39 | + self.client = client |
39 | 40 | |
40 | 41 | if self.query('select 1') == None: |
41 | 42 | self.disabled = True |
— | — | @@ -76,10 +77,9 @@ |
77 | 78 | return True |
78 | 79 | |
79 | 80 | def query(self, sql): |
80 | | - global conf |
81 | 81 | proc = subprocess.Popen( |
82 | 82 | [ |
83 | | - conf['mysqlclient'], '-XB', |
| 83 | + self.client, '-XB', |
84 | 84 | '--user=' + self.user, |
85 | 85 | '--password=' + self.password, |
86 | 86 | '-e', sql |
Index: trunk/ganglia_metrics/Makefile |
— | — | @@ -1,5 +1,5 @@ |
2 | | -SOURCES=__init__.py gmetricd.py GangliaMetrics.py MySQLStats.py SelectServer.py |
3 | | -OBJECTS=gmetricd.pyo GangliaMetrics.pyo MySQLStats.pyo SelectServer.pyo |
| 2 | +SOURCES=__init__.py gmetricd.py GangliaMetrics.py MySQLStats.py SelectServer.py DiskStats.py |
| 3 | +OBJECTS=gmetricd.pyo GangliaMetrics.pyo MySQLStats.pyo SelectServer.pyo DiskStats.pyo |
4 | 4 | |
5 | 5 | all: $(OBJECTS) |
6 | 6 | |