AC_COLLECTD([df], [disable], [module], [df statistics])
AC_COLLECTD([dns], [disable], [module], [dns statistics])
AC_COLLECTD([email], [disable], [module], [email statistics])
-AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
+AC_COLLECTD([entropy], [disable], [module], [entropy statistics])
+AC_COLLECTD([exec], [disable], [module], [exec of external programs])
AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
+ AC_COLLECTD([irq], [disable], [module], [irq statistics])
AC_COLLECTD([load], [disable], [module], [system load statistics])
AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
AC_COLLECTD([memory], [disable], [module], [memory statistics])
AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
+AC_COLLECTD([network], [disable], [module], [network functionality])
AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
- AC_COLLECTD([ntpd], [disable], [module], [nfs statistics])
+ AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
AC_COLLECTD([ping], [disable], [module], [ping statistics])
AC_COLLECTD([processes], [disable], [module], [processes statistics])
AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
disk . . . . . . . $enable_disk
dns . . . . . . . . $enable_dns
email . . . . . . . $enable_email
+ entropy . . . . . . $enable_entropy
+ exec . . . . . . . $enable_exec
hddtemp . . . . . . $enable_hddtemp
+ irq . . . . . . . . $enable_irq
load . . . . . . . $enable_load
mbmon . . . . . . . $enable_mbmon
memory . . . . . . $enable_memory
# define APACHE_HAVE_READ 0
#endif
-static char *url = NULL;
-static char *user = NULL;
-static char *pass = NULL;
-static char *cacert = NULL;
-
-#if HAVE_LIBCURL
-static CURL *curl = NULL;
-
-#define ABUFFER_SIZE 16384
-static char apache_buffer[ABUFFER_SIZE];
-static int apache_buffer_len = 0;
-static char apache_curl_error[CURL_ERROR_SIZE];
-#endif /* HAVE_LIBCURL */
-
/* Limit to 2^27 bytes/s. That's what a gigabit-ethernet link can handle, in
* theory. */
-static char *bytes_file = "apache/apache_bytes.rrd";
-static char *bytes_ds_def[] =
+static data_source_t apache_bytes_dsrc[1] =
{
- "DS:count:COUNTER:"COLLECTD_HEARTBEAT":0:134217728",
- NULL
+ {"count", DS_TYPE_COUNTER, 0, 134217728.0},
+};
+
+static data_set_t apache_bytes_ds =
+{
+ "apache_bytes", 1, apache_bytes_dsrc
};
-static int bytes_ds_num = 1;
/* Limit to 2^20 requests/s */
-static char *requests_file = "apache/apache_requests.rrd";
-static char *requests_ds_def[] =
+static data_source_t apache_requests_dsrc[1] =
{
- "DS:count:COUNTER:"COLLECTD_HEARTBEAT":0:1048576",
- NULL
+ {"count", DS_TYPE_COUNTER, 0, 134217728.0},
};
-static int requests_ds_num = 1;
-static char *scoreboard_file = "apache/apache_scoreboard-%s.rrd";
-static char *scoreboard_ds_def[] =
+static data_set_t apache_requests_ds =
{
- "DS:count:GAUGE:"COLLECTD_HEARTBEAT":0:U",
- NULL
+ "apache_requests", 1, apache_requests_dsrc
};
-static int scoreboard_ds_num = 1;
-/* for lighttpd; Limit to 65536 active connections */
-static char *connections_file = "apache/apache_connections.rrd";
-static char *connections_ds_def[] =
+static data_source_t apache_scoreboard_dsrc[1] =
{
- "DS:connections:GAUGE:"COLLECTD_HEARTBEAT":0:65536",
- NULL
+ {"count", DS_TYPE_GAUGE, 0, 65535.0},
+};
+
+static data_set_t apache_scoreboard_ds =
+{
+ "apache_scoreboard", 1, apache_scoreboard_dsrc
};
-static int connections_ds_num = 1;
-static char *config_keys[] =
++static data_source_t apache_connections_dsrc[1] =
++{
++ {"count", DS_TYPE_GAUGE, 0, 65535.0},
++};
++
++static data_set_t apache_connections_ds =
++{
++ "apache_connections", 1, apache_connections_dsrc
++};
++
+#if APACHE_HAVE_READ
+static char *url = NULL;
+static char *user = NULL;
+static char *pass = NULL;
+static char *cacert = NULL;
+
+static CURL *curl = NULL;
+
+#define ABUFFER_SIZE 16384
+static char apache_buffer[ABUFFER_SIZE];
+static int apache_buffer_len = 0;
+static char apache_curl_error[CURL_ERROR_SIZE];
+
+static const char *config_keys[] =
{
"URL",
"User",
{
curl_easy_setopt (curl, CURLOPT_CAINFO, cacert);
}
-#endif /* HAVE_LIBCURL */
-}
-static void bytes_write (char *host, char *inst, char *val)
-{
- rrd_update_file (host, bytes_file, val, bytes_ds_def, bytes_ds_num);
-}
+ return (0);
+} /* int init */
-static void requests_write (char *host, char *inst, char *val)
+static void submit_counter (const char *type, const char *type_instance,
+ unsigned long long value)
{
- rrd_update_file (host, requests_file, val, requests_ds_def, requests_ds_num);
-}
+ value_t values[1];
+ value_list_t vl = VALUE_LIST_INIT;
-static void scoreboard_write (char *host, char *inst, char *val)
-{
- char buf[1024];
+ DBG ("type = %s; type_instance = %s; value = %llu;",
+ type, type_instance, value);
- if (snprintf (buf, 1024, scoreboard_file, inst) >= 1024)
- return;
+ values[0].counter = value;
- rrd_update_file (host, buf, val, scoreboard_ds_def, scoreboard_ds_num);
-}
+ vl.values = values;
+ vl.values_len = 1;
+ vl.time = time (NULL);
+ strcpy (vl.host, hostname);
+ strcpy (vl.plugin, "apache");
+ strcpy (vl.plugin_instance, "");
+ strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
-static void connections_write (char *host, char *inst, char *val)
-{
- rrd_update_file (host, connections_file, val, connections_ds_def,
- connections_ds_num);
-}
+ plugin_dispatch_values (type, &vl);
+} /* void submit_counter */
-#if APACHE_HAVE_READ
-static void submit (char *type, char *inst, long long value)
+static void submit_gauge (const char *type, const char *type_instance,
+ double value)
{
- char buf[1024];
- int status;
+ value_t values[1];
+ value_list_t vl = VALUE_LIST_INIT;
- status = snprintf (buf, 1024, "%u:%lli", (unsigned int) curtime, value);
- if (status < 0)
- {
- syslog (LOG_ERR, "apache: bytes_submit: snprintf failed");
- return;
- }
- else if (status >= 1024)
- {
- syslog (LOG_WARNING, "apache: bytes_submit: snprintf was truncated");
- return;
- }
+ DBG ("type = %s; type_instance = %s; value = %lf;",
+ type, type_instance, value);
- plugin_submit (type, inst, buf);
-}
+ values[0].gauge = value;
+
+ vl.values = values;
+ vl.values_len = 1;
+ vl.time = time (NULL);
+ strcpy (vl.host, hostname);
+ strcpy (vl.plugin, "apache");
+ strcpy (vl.plugin_instance, "");
- strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
++
++ if (type_instance != NULL)
++ strncpy (vl.type_instance, type_instance,
++ sizeof (vl.type_instance));
+
+ plugin_dispatch_values (type, &vl);
+} /* void submit_counter */
static void submit_scoreboard (char *buf)
{
{
if (strcmp (fields[0], "Scoreboard:") == 0)
submit_scoreboard (fields[1]);
- submit ("apache_connections", NULL, atol (fields[1]));
+ else if (strcmp (fields[0], "BusyServers:") == 0)
++ submit_gauge ("apache_connections", NULL, atol (fields[1]));
}
}
void module_register (void)
{
- plugin_register (MODULE_NAME, init, apache_read, NULL);
- plugin_register ("apache_requests", NULL, NULL, requests_write);
- plugin_register ("apache_bytes", NULL, NULL, bytes_write);
- plugin_register ("apache_scoreboard", NULL, NULL, scoreboard_write);
- plugin_register ("apache_connections", NULL, NULL, connections_write);
- cf_register (MODULE_NAME, config, config_keys, config_keys_num);
-}
+ plugin_register_data_set (&apache_bytes_ds);
+ plugin_register_data_set (&apache_requests_ds);
+ plugin_register_data_set (&apache_scoreboard_ds);
++ plugin_register_data_set (&apache_connections_ds);
-#undef MODULE_NAME
+#if APACHE_HAVE_READ
+ plugin_register_config ("apache", config,
+ config_keys, config_keys_num);
+ plugin_register_init ("apache", init);
+ plugin_register_read ("apache", apache_read);
+#endif
+}