From: Marc Fournier Date: Mon, 30 Jun 2014 16:03:47 +0000 (+0200) Subject: openldap: add threads monitoring X-Git-Tag: collectd-5.5.0~152^2~20 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=efd664f05f6561f771b140359c65cca637e80627;p=collectd.git openldap: add threads monitoring --- diff --git a/src/openldap.c b/src/openldap.c index f284a191..990310ba 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -411,9 +411,10 @@ static int ldap_read_host (user_data_t *ud) int rc; int status; - char *attrs[3] = { "monitorCounter", + char *attrs[4] = { "monitorCounter", "monitorOpCompleted", - "monitorOpInitiated" }; + "monitorOpInitiated", + "monitoredInfo" }; if ((ud == NULL) || (ud->data == NULL)) { @@ -451,10 +452,12 @@ static int ldap_read_host (user_data_t *ud) struct berval counter_data; struct berval opc_data; struct berval opi_data; + struct berval info_data; struct berval **counter_list; struct berval **opc_list; struct berval **opi_list; + struct berval **info_list; if ((counter_list = ldap_get_values_len (st->ld, e, "monitorCounter")) != NULL) @@ -477,6 +480,14 @@ static int ldap_read_host (user_data_t *ud) opi = atoll (opi_data.bv_val); } + if ((info_list = ldap_get_values_len (st->ld, e, + "monitoredInfo")) != NULL) + { + info_data = *info_list[0]; + // don't convert search result to long long at this point, + // because this field is often populated with non-numerical data. + } + if (strcmp (dn, "cn=Total,cn=Connections,cn=Monitor") == 0) { @@ -616,6 +627,41 @@ static int ldap_read_host (user_data_t *ud) submit_derive ("derive", "statistics-referrals", counter, st); } + else if (strcmp (dn, + "cn=Open,cn=Threads,cn=Monitor") + == 0) + { + submit_gauge ("threads", "threads-open", + atoll (info_data.bv_val), st); + } + else if (strcmp (dn, + "cn=Starting,cn=Threads,cn=Monitor") + == 0) + { + submit_gauge ("threads", "threads-starting", + atoll (info_data.bv_val), st); + } + else if (strcmp (dn, + "cn=Active,cn=Threads,cn=Monitor") + == 0) + { + submit_gauge ("threads", "threads-active", + atoll (info_data.bv_val), st); + } + else if (strcmp (dn, + "cn=Pending,cn=Threads,cn=Monitor") + == 0) + { + submit_gauge ("threads", "threads-pending", + atoll (info_data.bv_val), st); + } + else if (strcmp (dn, + "cn=Backload,cn=Threads,cn=Monitor") + == 0) + { + submit_gauge ("threads", "threads-backload", + atoll (info_data.bv_val), st); + } else if (strcmp (dn, "cn=Read,cn=Waiters,cn=Monitor") == 0) @@ -634,6 +680,7 @@ static int ldap_read_host (user_data_t *ud) ldap_value_free_len (counter_list); ldap_value_free_len (opc_list); ldap_value_free_len (opi_list); + ldap_value_free_len (info_list); } ldap_memfree (dn);