utils_base.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Header file for nagios plugins utils_base.c */
  2. /* This file holds header information for thresholds - use this in preference to
  3. individual plugin logic */
  4. /* This has not been merged with utils.h because of problems with
  5. timeout_interval when other utils_*.h files use utils.h */
  6. /* Long term, add new functions to utils_base.h for common routines
  7. and utils_*.h for specific to plugin routines. If routines are
  8. placed in utils_*.h, then these can be tested with libtap */
  9. #define OUTSIDE 0
  10. #define INSIDE 1
  11. typedef struct range_struct {
  12. double start;
  13. int start_infinity; /* FALSE (default) or TRUE */
  14. double end;
  15. int end_infinity;
  16. int alert_on; /* OUTSIDE (default) or INSIDE */
  17. } range;
  18. typedef struct thresholds_struct {
  19. range *warning;
  20. range *critical;
  21. } thresholds;
  22. range *parse_range_string (char *);
  23. int _set_thresholds(thresholds **, char *, char *);
  24. void set_thresholds(thresholds **, char *, char *);
  25. int check_range(double, range *);
  26. int get_status(double, thresholds *);
  27. char *np_escaped_string (const char *);
  28. void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3)));