author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 28 Feb 2007 08:08:19 +0000 (09:08 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 28 Feb 2007 08:08:19 +0000 (09:08 +0100) |
Conflicts:
src/apache.c
src/apache.c
1 | 2 | |||
---|---|---|---|---|
configure.in | patch | | diff1 | | diff2 | | blob | history |
src/Makefile.am | patch | | diff1 | | diff2 | | blob | history |
src/apache.c | patch | | diff1 | | diff2 | | blob | history |
src/collectd.conf.in | patch | | diff1 | | diff2 | | blob | history |
src/collectd.conf.pod | patch | | diff1 | | diff2 | | blob | history |
diff --cc configure.in
index 0a70410a0a2a404ce384367ab6d16c94bd358990,cf9fce26a67259fe407f0cfc3f4fb2cf8fa88681..69f111a4d912b9378dbf24ee677e15845d2c0cba
--- 1/configure.in
--- 2/configure.in
+++ b/configure.in
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
diff --cc src/Makefile.am
Simple merge
diff --cc src/apache.c
index 0bf52d3158ace12554ae436c1a2bde3ce1c4946b,7c48f085bcd02924354115a342bd29f6ffeb8b7d..5156ff66de6d91b080b010e2c7b221f85712ad88
--- 1/src/apache.c
--- 2/src/apache.c
+++ b/src/apache.c
# 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
+}
diff --cc src/collectd.conf.in
index c564ee2e896fcf61438e6e3305f663d07d227b17,fcceb5412b5b407f70ddb32b29737a2b30c77e0f..9b6f8bf54d82beae12ae577d8add2d824bf77d4b
+++ b/src/collectd.conf.in
@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
# Port 7634
#</Plugin>
+ #<Plugin irq>
+ # Irq 7
+ # Irq 8
+ # Irq 9
+ # IgnoreSelected true
+ #</Plugin>
+
#<Plugin mbmon>
-# Host 127.0.0.1
+# Host "127.0.0.1"
# Port 411
#</Plugin>
diff --cc src/collectd.conf.pod
Simple merge