summaryrefslogtreecommitdiffstats
path: root/plugins/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/utils.h')
-rw-r--r--plugins/utils.h53
1 files changed, 28 insertions, 25 deletions
diff --git a/plugins/utils.h b/plugins/utils.h
index 92a6c115..68ff1630 100644
--- a/plugins/utils.h
+++ b/plugins/utils.h
@@ -32,8 +32,6 @@ suite of plugins. */
32void support(void); 32void support(void);
33void print_revision(const char *, const char *); 33void print_revision(const char *, const char *);
34 34
35extern time_t start_time, end_time;
36
37/* Test input types */ 35/* Test input types */
38 36
39bool is_integer(char *); 37bool is_integer(char *);
@@ -76,7 +74,7 @@ char *strnl(char *);
76char *strpcpy(char *, const char *, const char *); 74char *strpcpy(char *, const char *, const char *);
77char *strpcat(char *, const char *, const char *); 75char *strpcat(char *, const char *, const char *);
78int xvasprintf(char **strp, const char *fmt, va_list ap); 76int xvasprintf(char **strp, const char *fmt, va_list ap);
79int xasprintf(char **strp, const char *fmt, ...); 77int xasprintf(char **strp, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
80 78
81void usage(const char *) __attribute__((noreturn)); 79void usage(const char *) __attribute__((noreturn));
82void usage2(const char *, const char *) __attribute__((noreturn)); 80void usage2(const char *, const char *) __attribute__((noreturn));
@@ -88,13 +86,17 @@ void usage_va(const char *fmt, ...) __attribute__((noreturn));
88#define max(a, b) (((a) > (b)) ? (a) : (b)) 86#define max(a, b) (((a) > (b)) ? (a) : (b))
89#define min(a, b) (((a) < (b)) ? (a) : (b)) 87#define min(a, b) (((a) < (b)) ? (a) : (b))
90 88
91char *perfdata(const char *, long int, const char *, bool, long int, bool, long int, bool, long int, bool, long int); 89char *perfdata(const char *, long int, const char *, bool, long int, bool, long int, bool, long int,
90 bool, long int);
92 91
93char *perfdata_uint64(const char *, uint64_t, const char *, bool, uint64_t, bool, uint64_t, bool, uint64_t, bool, uint64_t); 92char *perfdata_uint64(const char *, uint64_t, const char *, bool, uint64_t, bool, uint64_t, bool,
93 uint64_t, bool, uint64_t);
94 94
95char *perfdata_int64(const char *, int64_t, const char *, bool, int64_t, bool, int64_t, bool, int64_t, bool, int64_t); 95char *perfdata_int64(const char *, int64_t, const char *, bool, int64_t, bool, int64_t, bool,
96 int64_t, bool, int64_t);
96 97
97char *fperfdata(const char *, double, const char *, bool, double, bool, double, bool, double, bool, double); 98char *fperfdata(const char *, double, const char *, bool, double, bool, double, bool, double, bool,
99 double);
98 100
99char *sperfdata(const char *, double, const char *, char *, char *, bool, double, bool, double); 101char *sperfdata(const char *, double, const char *, char *, char *, bool, double, bool, double);
100 102
@@ -104,21 +106,22 @@ char *sperfdata_int(const char *, int, const char *, char *, char *, bool, int,
104 most will or should. Therefore, for consistency, these very common 106 most will or should. Therefore, for consistency, these very common
105 options should have only these meanings throughout the overall suite */ 107 options should have only these meanings throughout the overall suite */
106 108
107#define STD_LONG_OPTS \ 109#define STD_LONG_OPTS \
108 {"version", no_argument, 0, 'V'}, {"verbose", no_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, \ 110 {"version", no_argument, 0, 'V'}, {"verbose", no_argument, 0, 'v'}, \
109 {"timeout", required_argument, 0, 't'}, {"critical", required_argument, 0, 'c'}, {"warning", required_argument, 0, 'w'}, \ 111 {"help", no_argument, 0, 'h'}, {"timeout", required_argument, 0, 't'}, \
112 {"critical", required_argument, 0, 'c'}, {"warning", required_argument, 0, 'w'}, \
110 {"hostname", required_argument, 0, 'H'} 113 {"hostname", required_argument, 0, 'H'}
111 114
112#define COPYRIGHT \ 115#define COPYRIGHT \
113 "Copyright (c) %s Monitoring Plugins Development Team\n\ 116 "Copyright (c) %s Monitoring Plugins Development Team\n\
114\t<%s>\n\n" 117\t<%s>\n\n"
115 118
116#define UT_HLP_VRS \ 119#define UT_HLP_VRS \
117 _("\ 120 _("\
118 %s (-h | --help) for detailed help\n\ 121 %s (-h | --help) for detailed help\n\
119 %s (-V | --version) for version information\n") 122 %s (-V | --version) for version information\n")
120 123
121#define UT_HELP_VRSN \ 124#define UT_HELP_VRSN \
122 _("\ 125 _("\
123\nOptions:\n\ 126\nOptions:\n\
124 -h, --help\n\ 127 -h, --help\n\
@@ -126,52 +129,52 @@ char *sperfdata_int(const char *, int, const char *, char *, char *, bool, int,
126 -V, --version\n\ 129 -V, --version\n\
127 Print version information\n") 130 Print version information\n")
128 131
129#define UT_HOST_PORT \ 132#define UT_HOST_PORT \
130 _("\ 133 _("\
131 -H, --hostname=ADDRESS\n\ 134 -H, --hostname=ADDRESS\n\
132 Host name, IP Address, or unix socket (must be an absolute path)\n\ 135 Host name, IP Address, or unix socket (must be an absolute path)\n\
133 -%c, --port=INTEGER\n\ 136 -%c, --port=INTEGER\n\
134 Port number (default: %s)\n") 137 Port number (default: %s)\n")
135 138
136#define UT_IPv46 \ 139#define UT_IPv46 \
137 _("\ 140 _("\
138 -4, --use-ipv4\n\ 141 -4, --use-ipv4\n\
139 Use IPv4 connection\n\ 142 Use IPv4 connection\n\
140 -6, --use-ipv6\n\ 143 -6, --use-ipv6\n\
141 Use IPv6 connection\n") 144 Use IPv6 connection\n")
142 145
143#define UT_VERBOSE \ 146#define UT_VERBOSE \
144 _("\ 147 _("\
145 -v, --verbose\n\ 148 -v, --verbose\n\
146 Show details for command-line debugging (output may be truncated by\n\ 149 Show details for command-line debugging (output may be truncated by\n\
147 the monitoring system)\n") 150 the monitoring system)\n")
148 151
149#define UT_WARN_CRIT \ 152#define UT_WARN_CRIT \
150 _("\ 153 _("\
151 -w, --warning=DOUBLE\n\ 154 -w, --warning=DOUBLE\n\
152 Response time to result in warning status (seconds)\n\ 155 Response time to result in warning status (seconds)\n\
153 -c, --critical=DOUBLE\n\ 156 -c, --critical=DOUBLE\n\
154 Response time to result in critical status (seconds)\n") 157 Response time to result in critical status (seconds)\n")
155 158
156#define UT_WARN_CRIT_RANGE \ 159#define UT_WARN_CRIT_RANGE \
157 _("\ 160 _("\
158 -w, --warning=RANGE\n\ 161 -w, --warning=RANGE\n\
159 Warning range (format: start:end). Alert if outside this range\n\ 162 Warning range (format: start:end). Alert if outside this range\n\
160 -c, --critical=RANGE\n\ 163 -c, --critical=RANGE\n\
161 Critical range\n") 164 Critical range\n")
162 165
163#define UT_CONN_TIMEOUT \ 166#define UT_CONN_TIMEOUT \
164 _("\ 167 _("\
165 -t, --timeout=INTEGER\n\ 168 -t, --timeout=INTEGER\n\
166 Seconds before connection times out (default: %d)\n") 169 Seconds before connection times out (default: %d)\n")
167 170
168#define UT_PLUG_TIMEOUT \ 171#define UT_PLUG_TIMEOUT \
169 _("\ 172 _("\
170 -t, --timeout=INTEGER\n\ 173 -t, --timeout=INTEGER\n\
171 Seconds before plugin times out (default: %d)\n") 174 Seconds before plugin times out (default: %d)\n")
172 175
173#ifdef NP_EXTRA_OPTS 176#ifdef NP_EXTRA_OPTS
174# define UT_EXTRA_OPTS \ 177# define UT_EXTRA_OPTS \
175 _("\ 178 _("\
176 --extra-opts=[section][@file]\n\ 179 --extra-opts=[section][@file]\n\
177 Read options from an ini file. See\n\ 180 Read options from an ini file. See\n\
@@ -181,25 +184,25 @@ char *sperfdata_int(const char *, int, const char *, char *, char *, bool, int,
181# define UT_EXTRA_OPTS " \b" 184# define UT_EXTRA_OPTS " \b"
182#endif 185#endif
183 186
184#define UT_THRESHOLDS_NOTES \ 187#define UT_THRESHOLDS_NOTES \
185 _("\ 188 _("\
186 See:\n\ 189 See:\n\
187 https://www.monitoring-plugins.org/doc/guidelines.html#THRESHOLDFORMAT\n\ 190 https://www.monitoring-plugins.org/doc/guidelines.html#THRESHOLDFORMAT\n\
188 for THRESHOLD format and examples.\n") 191 for THRESHOLD format and examples.\n")
189 192
190#define UT_SUPPORT \ 193#define UT_SUPPORT \
191 _("\n\ 194 _("\n\
192Send email to help@monitoring-plugins.org if you have questions regarding\n\ 195Send email to help@monitoring-plugins.org if you have questions regarding\n\
193use of this software. To submit patches or suggest improvements, send email\n\ 196use of this software. To submit patches or suggest improvements, send email\n\
194to devel@monitoring-plugins.org\n\n") 197to devel@monitoring-plugins.org\n\n")
195 198
196#define UT_NOWARRANTY \ 199#define UT_NOWARRANTY \
197 _("\n\ 200 _("\n\
198The Monitoring Plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n\ 201The Monitoring Plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n\
199copies of the plugins under the terms of the GNU General Public License.\n\ 202copies of the plugins under the terms of the GNU General Public License.\n\
200For more information about these matters, see the file named COPYING.\n") 203For more information about these matters, see the file named COPYING.\n")
201 204
202#define UT_OUTPUT_FORMAT \ 205#define UT_OUTPUT_FORMAT \
203 _("\ 206 _("\
204 --output-format=OUTPUT_FORMAT\n\ 207 --output-format=OUTPUT_FORMAT\n\
205 Select output format. Valid values: \"multi-line\", \"mp-test-json\"\n") 208 Select output format. Valid values: \"multi-line\", \"mp-test-json\"\n")