Skip to content
This repository was archived by the owner on Jun 22, 2022. It is now read-only.

Commit 5451447

Browse files
committed
Descriptors dictionary contained duplicates of metrics due to placement
inside a loop.
1 parent d990180 commit 5451447

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

apache_status/python_modules/apache_status.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ def metric_init(params):
147147
}
148148

149149
if "refresh_rate" not in params:
150-
params["refresh_rate"] = 10
150+
params["refresh_rate"] = 15
151151
if "url" not in params:
152-
params["url"] = "http://localhost/server-status?auto"
152+
params["url"] = "http://localhost:8001/server-status?auto"
153153

154154
_Worker_Thread = UpdateApacheStatusThread(params)
155155
_Worker_Thread.start()
@@ -174,27 +174,27 @@ def metric_init(params):
174174
"description": "hits",
175175
}))
176176

177+
descriptors.append(create_desc({
178+
"name" : "ap_busy_workers",
179+
"value_type" : "uint",
180+
"units" : "threads",
181+
"format" : "%u",
182+
"description": "Busy threads",
183+
}))
184+
185+
descriptors.append(create_desc({
186+
"name" : "ap_idle_workers",
187+
"value_type" : "uint",
188+
"units" : "threads",
189+
"format" : "%u",
190+
"description": "Idle threads",
191+
}))
177192

178193
for k,v in Scoreboard.iteritems():
179194
descriptors.append(create_desc({
180195
"name" : k,
181196
"description" : v["desc"],
182197
}))
183-
descriptors.append(create_desc({
184-
"name" : "ap_busy_workers",
185-
"value_type" : "uint",
186-
"units" : "threads",
187-
"format" : "%u",
188-
"description": "Busy threads",
189-
}))
190-
191-
descriptors.append(create_desc({
192-
"name" : "ap_idle_workers",
193-
"value_type" : "uint",
194-
"units" : "threads",
195-
"format" : "%u",
196-
"description": "Idle threads",
197-
}))
198198

199199
return descriptors
200200

@@ -205,7 +205,7 @@ def metric_cleanup():
205205
if __name__ == '__main__':
206206
try:
207207
params = {
208-
'url' : 'http://localhost/server-status?auto',
208+
'url' : 'http://localhost:8001/server-status?auto',
209209
#'virtual_host': 'health',
210210
}
211211
metric_init(params)
@@ -216,7 +216,7 @@ def metric_cleanup():
216216
print 'value for %s is %.3f' % (d['name'], v)
217217
else:
218218
print 'value for %s is %u' % (d['name'], v)
219-
time.sleep(5)
219+
time.sleep(15)
220220
except KeyboardInterrupt:
221221
time.sleep(0.2)
222222
os._exit(1)

0 commit comments

Comments
 (0)