summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f913353)
raw | patch | inline | side by side (parent: f913353)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 18 Feb 2008 20:19:32 +0000 (21:19 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 18 Feb 2008 20:19:32 +0000 (21:19 +0100) |
Instead point users to the `exec-nagios.px' script in collectd-exec(5).
src/collectd-exec.pod | patch | blob | history | |
src/exec.c | patch | blob | history |
diff --git a/src/collectd-exec.pod b/src/collectd-exec.pod
index e95fac9f8de1a12508f8249558f26f8692313df0..9882601b81213a3a58054aded34e2977af3e020b 100644 (file)
--- a/src/collectd-exec.pod
+++ b/src/collectd-exec.pod
See L<NOTIFICATION DATA FORMAT> below for a description of the data passed to
these programs.
-=begin comment
-
-=item C<NagiosExec>
-
-The executable is treated as a Nagios plugin. That means that the first line
-printed to C<STDOUT> by this program is used as the text of a notification and
-the severity of the notification depends on the exit status of the executable
-only.
-
-For information on how to write Nagios plugins please refer to the Nagios
-documentation. If a plugin works with Nagios but not with collectd please
-complain on the collectd mailing list instead.
-
-=end comment
-
=back
=head1 EXEC DATA FORMAT
=back
+=head1 USING NAGIOS PLUGINS
+
+Though the interface is far from perfect, there are tons of plugins for Nagios.
+You can use these plugins with collectd by using a simple transition layer,
+C<exec-nagios.px>, which is shipped with the collectd distribution in the
+C<contrib/> directory. It is a simple Perl script that comes with embedded
+documentation. To see it, run the following command:
+
+ perldoc exec-nagios.px
+
+This script expects a configuration file, C<exec-nagios.conf>. You can find an
+example in the C<contrib/> directory, too.
+
+Even a simple mechanism to submit "performance data" to collectd is
+implemented. If you need a more sophisticated setup, please rewrite the plugin
+to make use of collectd's more powerful interface.
+
=head1 CAVEATS
=over 4
diff --git a/src/exec.c b/src/exec.c
index 44f03e3387a9236260a6388eb3efbd62596dfac7..c6a58d1cff68b62bad8de377a1d4058136579edf 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
#define PL_NORMAL 0x01
#define PL_NOTIF_ACTION 0x02
-#define PL_NAGIOS_PLUGIN 0x04
#define PL_RUNNING 0x10
}
memset (pl, '\0', sizeof (program_list_t));
-#if 0
- if (strcasecmp ("NagiosExec", ci->key) == 0)
- pl->flags |= PL_NAGIOS_PLUGIN;
- else
-#endif
if (strcasecmp ("NotificationExec", ci->key) == 0)
pl->flags |= PL_NOTIF_ACTION;
else
{
oconfig_item_t *child = ci->children + i;
if ((strcasecmp ("Exec", child->key) == 0)
-#if 0
- || (strcasecmp ("NagiosExec", child->key) == 0)
-#endif
|| (strcasecmp ("NotificationExec", child->key) == 0))
exec_config_exec (child);
else
DEBUG ("exec plugin: exec_read_one: buffer = %s", buffer);
- if (pl->flags & PL_NAGIOS_PLUGIN)
- break;
-
parse_line (buffer);
} /* while (fgets) */
DEBUG ("exec plugin: Child %i exited with status %i.",
(int) pl->pid, pl->status);
- if (pl->flags & PL_NAGIOS_PLUGIN)
- {
- notification_t n;
-
- memset (&n, '\0', sizeof (n));
-
- n.severity = NOTIF_FAILURE;
- if (pl->status == 0)
- n.severity = NOTIF_OKAY;
- else if (pl->status == 1)
- n.severity = NOTIF_WARNING;
-
- strncpy (n.message, buffer, sizeof (n.message));
- n.message[sizeof (n.message) - 1] = '\0';
-
- n.time = time (NULL);
-
- strncpy (n.host, hostname_g, sizeof (n.host));
- n.host[sizeof (n.host) - 1] = '\0';
-
- plugin_dispatch_notification (&n);
- }
-
pl->pid = 0;
pthread_mutex_lock (&pl_lock);
pthread_t t;
pthread_attr_t attr;
- /* Only execute `normal' and `nagios' style executables here. */
- if ((pl->flags & (PL_NAGIOS_PLUGIN | PL_NORMAL)) == 0)
+ /* Only execute `normal' style executables here. */
+ if ((pl->flags & PL_NORMAL) == 0)
continue;
pthread_mutex_lock (&pl_lock);