summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/negate.c115
-rw-r--r--plugins/netutils.c35
-rw-r--r--plugins/popen.c87
-rw-r--r--plugins/runcmd.c79
-rw-r--r--plugins/sslutils.c34
-rw-r--r--plugins/urlize.c47
-rw-r--r--plugins/utils.c38
7 files changed, 183 insertions, 252 deletions
diff --git a/plugins/negate.c b/plugins/negate.c
index 7bfef95a..eccc404d 100644
--- a/plugins/negate.c
+++ b/plugins/negate.c
@@ -1,72 +1,36 @@
1/****************************************************************************** 1/*****************************************************************************
2* 2*
3* Nagios negate plugin 3* Nagios negate plugin
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2002-2007 nagios-plugins team 6* Copyright (c) 2002-2007 Nagios Plugins Development Team
7* 7*
8* Last Modified: $Date$ 8* Last Modified: $Date$
9* 9*
10* Description: 10* Description:
11* 11*
12* This file contains the negate plugin 12* This file contains the negate plugin
13* 13*
14* Negates the status of a plugin (returns OK for CRITICAL, and vice-versa) 14* Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).
15* 15* Can also perform custom state switching.
16* License Information: 16*
17* 17*
18* This program is free software; you can redistribute it and/or modify 18* This program is free software: you can redistribute it and/or modify
19* it under the terms of the GNU General Public License as published by 19* it under the terms of the GNU General Public License as published by
20* the Free Software Foundation; either version 2 of the License, or 20* the Free Software Foundation, either version 3 of the License, or
21* (at your option) any later version. 21* (at your option) any later version.
22* 22*
23* This program is distributed in the hope that it will be useful, 23* This program is distributed in the hope that it will be useful,
24* but WITHOUT ANY WARRANTY; without even the implied warranty of 24* but WITHOUT ANY WARRANTY; without even the implied warranty of
25* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26* GNU General Public License for more details. 26* GNU General Public License for more details.
27* 27*
28* You should have received a copy of the GNU General Public License 28* You should have received a copy of the GNU General Public License
29* along with this program; if not, write to the Free Software 29* along with this program. If not, see <http://www.gnu.org/licenses/>.
30* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 30*
31*
32* $Id$ 31* $Id$
33 32*
34@@-<article> 33*****************************************************************************/
35
36<sect1>
37<title>Quick Reference</title>
38<refentry>
39<refmeta><manvolnum>5<manvolnum></refmeta>
40<refnamdiv>
41<refname>&progname;</refname>
42<refpurpose>&SUMMARY;</refpurpose>
43</refnamdiv>
44</refentry>
45</sect1>
46
47<sect1>
48<title>FAQ</title>
49</sect1>
50
51<sect1>
52<title>Theory, Installation, and Operation</title>
53
54<sect2>
55<title>General Description</title>
56<para>
57&DESCRIPTION;
58</para>
59</sect2>
60
61<sect2>
62<title>Future Enhancements</title>
63<para>ToDo List</para>
64<itemizedlist>
65<listitem>Add option to do regex substitution in output text</listitem>
66</itemizedlist>
67</sect2>-@@
68
69******************************************************************************/
70 34
71const char *progname = "negate"; 35const char *progname = "negate";
72const char *revision = "$Revision$"; 36const char *revision = "$Revision$";
@@ -142,25 +106,6 @@ main (int argc, char **argv)
142 } 106 }
143} 107}
144 108
145/******************************************************************************
146@@-
147<sect2>
148<title>Functions</title>
149
150<sect3>
151<title>process_arguments</title>
152
153<para>This function parses the command line into the needed
154variables.</para>
155
156<para>Aside from the standard 'help' and 'version' options, there
157is a only a 'timeout' option.</para>
158
159</sect3>
160-@@
161******************************************************************************/
162
163
164 109
165/* process command-line arguments */ 110/* process command-line arguments */
166static const char ** 111static const char **
@@ -239,19 +184,6 @@ process_arguments (int argc, char **argv)
239} 184}
240 185
241 186
242/******************************************************************************
243@@-
244<sect3>
245<title>validate_arguments</title>
246
247<para>No validation is currently done.</para>
248
249</sect3>
250-@@
251******************************************************************************/
252
253
254
255int 187int
256validate_arguments (char **command_line) 188validate_arguments (char **command_line)
257{ 189{
@@ -262,13 +194,6 @@ validate_arguments (char **command_line)
262 usage4 (_("Require path to command")); 194 usage4 (_("Require path to command"));
263} 195}
264 196
265/******************************************************************************
266@@-
267</sect2>
268</sect1>
269</article>
270-@@
271******************************************************************************/
272 197
273int 198int
274translate_state (char *state_text) 199translate_state (char *state_text)
diff --git a/plugins/netutils.c b/plugins/netutils.c
index 09a73e45..5e00723e 100644
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
@@ -1,35 +1,34 @@
1/**************************************************************************** 1/*****************************************************************************
2* 2*
3* Nagios plugins network utilities 3* Nagios plugins network utilities
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org) 6* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
7* 7* Copyright (c) 2003-2008 Nagios Plugins Development Team
8*
8* Last Modified: $Date$ 9* Last Modified: $Date$
9* 10*
10* Description: 11* Description:
11* 12*
12* This file contains commons functions used in many of the plugins. 13* This file contains commons functions used in many of the plugins.
13* 14*
14* License Information: 15*
15* 16* This program is free software: you can redistribute it and/or modify
16* This program is free software; you can redistribute it and/or modify
17* it under the terms of the GNU General Public License as published by 17* it under the terms of the GNU General Public License as published by
18* the Free Software Foundation; either version 2 of the License, or 18* the Free Software Foundation, either version 3 of the License, or
19* (at your option) any later version. 19* (at your option) any later version.
20* 20*
21* This program is distributed in the hope that it will be useful, 21* This program is distributed in the hope that it will be useful,
22* but WITHOUT ANY WARRANTY; without even the implied warranty of 22* but WITHOUT ANY WARRANTY; without even the implied warranty of
23* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24* GNU General Public License for more details. 24* GNU General Public License for more details.
25* 25*
26* You should have received a copy of the GNU General Public License 26* You should have received a copy of the GNU General Public License
27* along with this program; if not, write to the Free Software 27* along with this program. If not, see <http://www.gnu.org/licenses/>.
28* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 28*
29*
30* $Id$ 29* $Id$
31* 30*
32****************************************************************************/ 31*****************************************************************************/
33 32
34#define LOCAL_TIMEOUT_ALARM_HANDLER 33#define LOCAL_TIMEOUT_ALARM_HANDLER
35 34
diff --git a/plugins/popen.c b/plugins/popen.c
index 45d2a3dc..df00ebeb 100644
--- a/plugins/popen.c
+++ b/plugins/popen.c
@@ -1,48 +1,45 @@
1/**************************************************************************** 1/*****************************************************************************
2 * 2*
3 * Nagios plugins popen 3* Nagios plugins popen
4 * 4*
5 * License: GPL 5* License: GPL
6 * Copyright (c) 2005 nagios-plugins team 6* Copyright (c) 2005-2007 Nagios Plugins Development Team
7 * 7*
8 * Last Modified: $Date$ 8* Last Modified: $Date$
9 * 9*
10 * Description: 10* Description:
11 * 11*
12 * A safe alternative to popen 12* A safe alternative to popen
13 * 13*
14 * Provides spopen and spclose 14* Provides spopen and spclose
15 * 15*
16 * FILE * spopen(const char *); 16* FILE * spopen(const char *);
17 * int spclose(FILE *); 17* int spclose(FILE *);
18 * 18*
19 * 19* Code taken with liitle modification from "Advanced Programming for the Unix
20 * Code taken with liitle modification from "Advanced Programming for the Unix 20* Environment" by W. Richard Stevens
21 * Environment" by W. Richard Stevens 21*
22 * 22* This is considered safe in that no shell is spawned, and the environment
23 * This is considered safe in that no shell is spawned, and the environment and 23* and path passed to the exec'd program are essentially empty. (popen create
24 * path passed to the exec'd program are esstially empty. (popen create a shell 24* a shell and passes the environment to it).
25 * and passes the environment to it). 25*
26 * 26*
27 * License Information: 27* This program is free software: you can redistribute it and/or modify
28 * 28* it under the terms of the GNU General Public License as published by
29 * This program is free software; you can redistribute it and/or modify 29* the Free Software Foundation, either version 3 of the License, or
30 * it under the terms of the GNU General Public License as published by 30* (at your option) any later version.
31 * the Free Software Foundation; either version 2 of the License, or 31*
32 * (at your option) any later version. 32* This program is distributed in the hope that it will be useful,
33 * 33* but WITHOUT ANY WARRANTY; without even the implied warranty of
34 * This program is distributed in the hope that it will be useful, 34* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 * but WITHOUT ANY WARRANTY; without even the implied warranty of 35* GNU General Public License for more details.
36 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36*
37 * GNU General Public License for more details. 37* You should have received a copy of the GNU General Public License
38 * 38* along with this program. If not, see <http://www.gnu.org/licenses/>.
39 * You should have received a copy of the GNU General Public License 39*
40 * along with this program; if not, write to the Free Software 40* $Id$
41 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 41*
42 * 42*****************************************************************************/
43 * $Id$
44 *
45 ******************************************************************************/
46 43
47#include "common.h" 44#include "common.h"
48 45
diff --git a/plugins/runcmd.c b/plugins/runcmd.c
index af12d224..8c52b5c9 100644
--- a/plugins/runcmd.c
+++ b/plugins/runcmd.c
@@ -1,42 +1,43 @@
1/**************************************************************************** 1/*****************************************************************************
2 * Nagios run command utilities 2*
3 * 3* Nagios run command utilities
4 * License: GPL 4*
5 * Copyright (c) 2005 nagios-plugins team 5* License: GPL
6 * 6* Copyright (c) 2005-2006 Nagios Plugins Development Team
7 * $Id$ 7*
8 * 8* Last Modified: $Date$
9 * Description : 9*
10 * 10* Description :
11 * A simple interface to executing programs from other programs, using an 11*
12 * optimized and safe popen()-like implementation. It is considered safe 12* A simple interface to executing programs from other programs, using an
13 * in that no shell needs to be spawned and the environment passed to the 13* optimized and safe popen()-like implementation. It is considered safe
14 * execve()'d program is essentially empty. 14* in that no shell needs to be spawned and the environment passed to the
15 * 15* execve()'d program is essentially empty.
16 * 16*
17 * The code in this file is a derivative of popen.c which in turn was taken 17* The code in this file is a derivative of popen.c which in turn was taken
18 * from "Advanced Programming for the Unix Environment" by W. Richard Stevens. 18* from "Advanced Programming for the Unix Environment" by W. Richard Stevens.
19 * 19*
20 * Care has been taken to make sure the functions are async-safe. The one 20* Care has been taken to make sure the functions are async-safe. The one
21 * function which isn't is np_runcmd_init() which it doesn't make sense to 21* function which isn't is np_runcmd_init() which it doesn't make sense to
22 * call twice anyway, so the api as a whole should be considered async-safe. 22* call twice anyway, so the api as a whole should be considered async-safe.
23 * 23*
24 * License Information: 24*
25 * 25* This program is free software: you can redistribute it and/or modify
26 * This program is free software; you can redistribute it and/or modify 26* it under the terms of the GNU General Public License as published by
27 * it under the terms of the GNU General Public License as published by 27* the Free Software Foundation, either version 3 of the License, or
28 * the Free Software Foundation; either version 2 of the License, or 28* (at your option) any later version.
29 * (at your option) any later version. 29*
30 * 30* This program is distributed in the hope that it will be useful,
31 * This program is distributed in the hope that it will be useful, 31* but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of 32* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33* GNU General Public License for more details.
34 * GNU General Public License for more details. 34*
35 * 35* You should have received a copy of the GNU General Public License
36 * You should have received a copy of the GNU General Public License 36* along with this program. If not, see <http://www.gnu.org/licenses/>.
37 * along with this program; if not, write to the Free Software 37*
38 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 38* $Id$
39 */ 39*
40*****************************************************************************/
40 41
41#define NAGIOSPLUG_API_C 1 42#define NAGIOSPLUG_API_C 1
42 43
diff --git a/plugins/sslutils.c b/plugins/sslutils.c
index 8d2e93c7..3d4f9016 100644
--- a/plugins/sslutils.c
+++ b/plugins/sslutils.c
@@ -1,35 +1,33 @@
1/**************************************************************************** 1/*****************************************************************************
2* 2*
3* Nagios plugins SSL utilities 3* Nagios plugins SSL utilities
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2005 nagios-plugins team 6* Copyright (c) 2005-2007 Nagios Plugins Development Team
7* 7*
8* Last Modified: $Date$ 8* Last Modified: $Date$
9* 9*
10* Description: 10* Description:
11* 11*
12* This file contains common functions for plugins that require SSL. 12* This file contains common functions for plugins that require SSL.
13*
13* 14*
14* License Information: 15* This program is free software: you can redistribute it and/or modify
15*
16* This program is free software; you can redistribute it and/or modify
17* it under the terms of the GNU General Public License as published by 16* it under the terms of the GNU General Public License as published by
18* the Free Software Foundation; either version 2 of the License, or 17* the Free Software Foundation, either version 3 of the License, or
19* (at your option) any later version. 18* (at your option) any later version.
20* 19*
21* This program is distributed in the hope that it will be useful, 20* This program is distributed in the hope that it will be useful,
22* but WITHOUT ANY WARRANTY; without even the implied warranty of 21* but WITHOUT ANY WARRANTY; without even the implied warranty of
23* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24* GNU General Public License for more details. 23* GNU General Public License for more details.
25* 24*
26* You should have received a copy of the GNU General Public License 25* You should have received a copy of the GNU General Public License
27* along with this program; if not, write to the Free Software 26* along with this program. If not, see <http://www.gnu.org/licenses/>.
28* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 27*
29*
30* $Id$ 28* $Id$
31* 29*
32****************************************************************************/ 30*****************************************************************************/
33 31
34#define LOCAL_TIMEOUT_ALARM_HANDLER 32#define LOCAL_TIMEOUT_ALARM_HANDLER
35#include "common.h" 33#include "common.h"
diff --git a/plugins/urlize.c b/plugins/urlize.c
index 612dd14d..34e25c4e 100644
--- a/plugins/urlize.c
+++ b/plugins/urlize.c
@@ -1,40 +1,37 @@
1/****************************************************************************** 1/*****************************************************************************
2* 2*
3* Nagios urlize plugin 3* Nagios urlize plugin
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2000-2006 nagios-plugins team 6* Copyright (c) 2000-2007 Nagios Plugins Development Team
7* 7*
8* Last Modified: $Date$ 8* Last Modified: $Date$
9* 9*
10* Description: 10* Description:
11* 11*
12* This file contains the urlize plugin 12* This file contains the urlize plugin
13* 13*
14* This plugin wraps the text output of another command (plugin) 14* This plugin wraps the text output of another command (plugin) in HTML <A>
15* in HTML <A> tags, thus displaying the plugin output in as a clickable link in 15* tags, thus displaying the plugin output in as a clickable link in the
16* the Nagios status screen. The return status is the same as the invoked plugin. 16* Nagios status screen. The return status is the same as the invoked plugin.
17* 17*
18* License Information: 18*
19* 19* This program is free software: you can redistribute it and/or modify
20* This program is free software; you can redistribute it and/or modify
21* it under the terms of the GNU General Public License as published by 20* it under the terms of the GNU General Public License as published by
22* the Free Software Foundation; either version 2 of the License, or 21* the Free Software Foundation, either version 3 of the License, or
23* (at your option) any later version. 22* (at your option) any later version.
24* 23*
25* This program is distributed in the hope that it will be useful, 24* This program is distributed in the hope that it will be useful,
26* but WITHOUT ANY WARRANTY; without even the implied warranty of 25* but WITHOUT ANY WARRANTY; without even the implied warranty of
27* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28* GNU General Public License for more details. 27* GNU General Public License for more details.
29* 28*
30* You should have received a copy of the GNU General Public License 29* You should have received a copy of the GNU General Public License
31* along with this program; if not, write to the Free Software 30* along with this program. If not, see <http://www.gnu.org/licenses/>.
32* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 31*
33* 32* $Id$
34 33*
35 $Id$ 34*****************************************************************************/
36
37******************************************************************************/
38 35
39const char *progname = "urlize"; 36const char *progname = "urlize";
40const char *revision = "$Revision$"; 37const char *revision = "$Revision$";
diff --git a/plugins/utils.c b/plugins/utils.c
index 88b44114..c8f3a00d 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -1,16 +1,30 @@
1/***************************************************************************** 1/*****************************************************************************
2 * 2*
3 * utils.c 3* Library of useful functions for plugins
4 * 4*
5 * Library of useful functions for plugins 5* License: GPL
6 * 6* Copyright (c) 2000 Karl DeBisschop (karl@debisschop.net)
7 * Copyright (c) 2000 Karl DeBisschop (karl@debisschop.net) 7* Copyright (c) 2002-2007 Nagios Plugin Development Team
8 * Copyright (c) 2006 Nagios Plugin Development Team 8*
9 * License: GPL 9* Last Modified: $Date$
10 * 10*
11 * $Revision$ 11*
12 * $Date$ 12* This program is free software: you can redistribute it and/or modify
13 ****************************************************************************/ 13* it under the terms of the GNU General Public License as published by
14* the Free Software Foundation, either version 3 of the License, or
15* (at your option) any later version.
16*
17* This program is distributed in the hope that it will be useful,
18* but WITHOUT ANY WARRANTY; without even the implied warranty of
19* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20* GNU General Public License for more details.
21*
22* You should have received a copy of the GNU General Public License
23* along with this program. If not, see <http://www.gnu.org/licenses/>.
24*
25* $Id$
26*
27*****************************************************************************/
14 28
15#define LOCAL_TIMEOUT_ALARM_HANDLER 29#define LOCAL_TIMEOUT_ALARM_HANDLER
16 30