def metric_init()

in opsworks_ganglia/files/default/apache.py [0:0]


def metric_init(params):
	global descriptors
	global status_url

	status_url = params.get('status_url', status_url)

	apache_descriptions = dict(
		busyworkers = {
			'description': "Busy Workers",
			'units': "workers",
		},
		idleworkers = {
			'description': "Idle Workers",
			'units': "workers",
		},
		uptime = {
			'description': "The time the server has been running for",
			'units': "secs",
		},
		total_accesses = {
			'description': "Total Accesses",
			'units': "accesses/sec",
			'slope': "positive",
		},
		total_kbytes = {
			'description': "Total KBs",
			'units': "kb/sec",
			'slope': "positive",
		},
		cpuload = {
			'description': "CPU Load",
			'value_type': "float",
			'units': "load",
			'format': '%.3f',
		},
		bytespersec = {
			'description': "Bytes per second",
			'value_type': "float",
			'units': "bytes/sec",
			'format': '%.3f',
		},
		bytesperreq = {
			'description': "Bytes per request",
			'value_type': "float",
			'units': "bytes/req",
			'format': '%.3f',
		},
		reqpersec = {
			'description': "Requests per second",
			'value_type': "float",
			'units': "reqs/sec",
			'format': '%.3f',
		},
	)

	for label in apache_descriptions:
		d = {
			'name': 'apache_' + label,
			'call_back': get_stat,
			'time_max': 90,
			'value_type': "uint",
			'units': "",
			'slope': "both",
			'format': '%u',
			'description': "http://httpd.apache.org/docs/2.2/mod/mod_status.html",
			'groups': 'apache',
		}

		d.update(apache_descriptions[label])

		descriptors.append(d)
			
	return descriptors