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