| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | /* thresholds.h -- nagios thresholds |
| 3 | |
| 4 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by |
| 6 | the Free Software Foundation, either version 3 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include "system.h" |
| 20 | |
| 21 | /* Return codes for _set_thresholds */ |
| 22 | #define NP_RANGE_UNPARSEABLE 1 |
| 23 | #define NP_WARN_WITHIN_CRIT 2 |
| 24 | |
| 25 | #define NP_RANGE_OUTSIDE 0 |
| 26 | #define NP_RANGE_INSIDE 1 |
| 27 | |
| 28 | /* see: nagios-plugins-1.4.15/lib/utils_base.h */ |
| 29 | typedef struct range_struct |
| 30 | { |
| 31 | double start; |
| 32 | double end; |
| 33 | bool start_infinity; /* false (default) or true */ |
| 34 | bool end_infinity; |
| 35 | int alert_on; /* NP_RANGE_OUTSIDE (default) or NP_RANGE_INSIDE */ |
| 36 | } range; |
| 37 | |
| 38 | typedef struct thresholds_struct |
| 39 | { |
| 40 | range *warning; |
| 41 | range *critical; |
| 42 | } thresholds; |
| 43 | |
| 44 | int get_status (double, thresholds *); |
| 45 | int set_thresholds (thresholds **, char *, char *); |
| 46 | bool thresholds_expressed_as_percentages (char *warn_string, |
| 47 | char *critical_string); |