From: Florian Forster Date: Wed, 28 Feb 2007 08:08:19 +0000 (+0100) Subject: Merge branch 'master' into merge/collectd-4 X-Git-Tag: collectd-4.0.0-rc4~91 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6360474f4aa35dd1a587b6148ff88a23e6155132;p=collectd.git Merge branch 'master' into merge/collectd-4 Conflicts: src/apache.c --- 6360474f4aa35dd1a587b6148ff88a23e6155132 diff --cc configure.in index 0a70410a,cf9fce26..69f111a4 --- a/configure.in +++ b/configure.in @@@ -1067,17 -1044,16 +1067,18 @@@ AC_COLLECTD([csv], [disable], [mo 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]) @@@ -1125,9 -1099,8 +1126,10 @@@ Configuration 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 diff --cc src/apache.c index 0bf52d31,7c48f085..5156ff66 --- a/src/apache.c +++ b/src/apache.c @@@ -32,53 -37,57 +35,63 @@@ # 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", @@@ -174,53 -186,55 +187,56 @@@ static int init (void { 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) { @@@ -326,6 -337,8 +342,8 @@@ static int apache_read (void { if (strcmp (fields[0], "Scoreboard:") == 0) submit_scoreboard (fields[1]); + else if (strcmp (fields[0], "BusyServers:") == 0) - submit ("apache_connections", NULL, atol (fields[1])); ++ submit_gauge ("apache_connections", NULL, atol (fields[1])); } } @@@ -337,14 -350,12 +355,15 @@@ 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 +} diff --cc src/collectd.conf.in index c564ee2e,fcceb541..9b6f8bf5 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@@ -24,8 -29,8 +24,9 @@@ @BUILD_MODULE_DF_TRUE@LoadPlugin df @BUILD_MODULE_DISK_TRUE@LoadPlugin disk @BUILD_MODULE_DNS_TRUE@LoadPlugin dns +@BUILD_MODULE_EMAIL_TRUE@LoadPlugin email @BUILD_MODULE_HDDTEMP_TRUE@LoadPlugin hddtemp + @BUILD_MODULE_IRQ_TRUE@LoadPlugin irq @BUILD_MODULE_LOAD_TRUE@LoadPlugin load @BUILD_MODULE_MBMON_TRUE@LoadPlugin mbmon @BUILD_MODULE_MEMORY_TRUE@LoadPlugin memory @@@ -68,8 -71,15 +69,15 @@@ # Port 7634 # + # + # Irq 7 + # Irq 8 + # Irq 9 + # IgnoreSelected true + # + # -# Host 127.0.0.1 +# Host "127.0.0.1" # Port 411 #