Esempio n. 1
0
/* Init counters */
static void uac_reg_counter_init()
{
	LM_DBG("*** Initializing UAC reg counters\n");
        counter_register(&regtotal, "uac", "regtotal", 0, 0, 0, "Total number of registration accounts in memory", 0);
        counter_register(&regactive, "uac", "regactive", 0, 0, 0, "Number of successfully registred accounts (200 OK)", 0);
        counter_register(&regdisabled, "uac", "regdisabled", 0, 0, 0, "Counter of failed registrations (not 200 OK)", 0);
}
Esempio n. 2
0
/** parse the the script_counter modparam.
 *  Format:   [grp.]name[( |:)desc]
 *  E.g.:
 *           "name" => new counter: *cnt_script_grp."name"
 *           "grp.name" => new counter: "grp"."name"
 *           "name desc" => new counter "name", desc = "desc"
 *           "grp.name desc" => "grp"."name", desc = "desc".
 */
static int add_script_counter(modparam_t type, void* val)
{
	char* name;
	counter_handle_t h;
	int ret;
	char* grp;
	char* desc;
	char* p;

	if ((type & PARAM_STRING) == 0) {
		BUG("bad parameter type %d\n", type);
		goto error;
	}
	name = (char*) val;
	grp = cnt_script_grp; /* default group */
	desc = "custom script counter."; /* default desc. */
	if ((p = strchr(name, ':')) != 0 ||
			(p = strchr(name, ' ')) != 0) {
		/* found desc. */
		*p = 0;
		for(p = p+1; *p && (*p == ' ' || *p == '\t'); p++);
		if (*p)
			desc = p;
	}
	if ((p = strchr(name, '.')) != 0) {
		/* found group */
		grp = name;
		*p = 0;
		name = p+1;
	}
	ret = counter_register(&h, grp, name, 0, 0, 0, desc, 0);
	if (ret < 0) {
		if (ret == -2) {
			ERR("counter %s.%s already registered\n", grp, name);
			return 0;
		}
		ERR("failed to register counter %s.%s\n", grp, name);
		goto error;
	}
	return 0;
error:
	return -1;
}
Esempio n. 3
0
/* Init counters */
static void curl_counter_init()
{
	counter_register(&connections, "httpclient", "connections", 0, 0, 0, "Counter of connection definitions (httpcon)", 0);
	counter_register(&connok, "httpclient", "connok", 0, 0, 0, "Counter of successful connections (200 OK)", 0);
	counter_register(&connfail, "httpclient", "connfail", 0, 0, 0, "Counter of failed connections (not 200 OK)", 0);
}