summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c7d818f)
raw | patch | inline | side by side (parent: c7d818f)
author | octo <octo> | |
Sat, 1 Apr 2006 20:42:55 +0000 (20:42 +0000) | ||
committer | octo <octo> | |
Sat, 1 Apr 2006 20:42:55 +0000 (20:42 +0000) |
ChangeLog | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/ping.c | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index 2e0860936ab3a6650ac1b0118ce06c2106abb52e..c980d16ba16f9695871f4dde00c7bb7f266cf752 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
* An option to compile collectd with different `step' and `hearbeat'
settings has been added. The size of RRAs is no longer static but
calculated based on the settings for `step' and `width'.
+ * The `ping' plugin can now be configured to use a certain TTL.
2006-03-14, Version 3.8.2
* `utils_mount.c' has been changed to not use the `MNTTAB' defined by
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 4920460e6cb9131e26a35978fc227fd0c68f9533..64c66548b6b0affea3c76915904e08025f52cd25 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
Host to ping periodically. This option may be repeated several times to ping
multiple hosts.
+=item B<TTL> I<0-255>
+
+Sets the Time-To-Live of generated ICMP packets.
+
=back
=head1 SEE ALSO
diff --git a/src/ping.c b/src/ping.c
index f18ea8cc5e39c32a426455e26707f5886ac21710..69661708baeb1bd468f884643777b7c98ac3643f 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
static char *config_keys[] =
{
"Host",
+ "TTL",
NULL
};
-static int config_keys_num = 1;
+static int config_keys_num = 2;
static void ping_init (void)
{
static int ping_config (char *key, char *value)
{
- if (strcasecmp (key, "host"))
- {
- return (-1);
- }
-
if (pingobj == NULL)
{
if ((pingobj = ping_construct ()) == NULL)
{
syslog (LOG_ERR, "ping: `ping_construct' failed.\n");
- return (-1);
+ return (1);
}
}
- if (ping_host_add (pingobj, value) < 0)
+ if (strcasecmp (key, "host") == 0)
{
- syslog (LOG_WARNING, "ping: `ping_host_add' failed.\n");
+ if (ping_host_add (pingobj, value) < 0)
+ {
+ syslog (LOG_WARNING, "ping: `ping_host_add' failed.");
+ return (1);
+ }
+ }
+ else if (strcasecmp (key, "ttl") == 0)
+ {
+ int ttl = atoi (value);
+ if (ping_setopt (pingobj, PING_DEF_TIMEOUT, (void *) &ttl))
+ {
+ syslog (LOG_WARNING, "ping: liboping did not accept the TTL value %i", ttl);
+ return (1);
+ }
+ }
+ else
+ {
+ return (-1);
}
return (0);