diff options
Diffstat (limited to 'plugins/check_curl.d/config.h')
| -rw-r--r-- | plugins/check_curl.d/config.h | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/plugins/check_curl.d/config.h b/plugins/check_curl.d/config.h new file mode 100644 index 00000000..f51b2ee9 --- /dev/null +++ b/plugins/check_curl.d/config.h | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../config.h" | ||
| 4 | #include "../common.h" | ||
| 5 | #include "../../lib/states.h" | ||
| 6 | #include "../../lib/thresholds.h" | ||
| 7 | #include <stddef.h> | ||
| 8 | #include <string.h> | ||
| 9 | #include <sys/socket.h> | ||
| 10 | #include "curl/curl.h" | ||
| 11 | #include "perfdata.h" | ||
| 12 | #include "regex.h" | ||
| 13 | |||
| 14 | enum { | ||
| 15 | MAX_RE_SIZE = 1024, | ||
| 16 | HTTP_PORT = 80, | ||
| 17 | HTTPS_PORT = 443, | ||
| 18 | MAX_PORT = 65535, | ||
| 19 | DEFAULT_MAX_REDIRS = 15 | ||
| 20 | }; | ||
| 21 | |||
| 22 | enum { | ||
| 23 | FOLLOW_HTTP_CURL = 0, | ||
| 24 | FOLLOW_LIBCURL = 1 | ||
| 25 | }; | ||
| 26 | |||
| 27 | enum { | ||
| 28 | STICKY_NONE = 0, | ||
| 29 | STICKY_HOST = 1, | ||
| 30 | STICKY_PORT = 2 | ||
| 31 | }; | ||
| 32 | |||
| 33 | #define HTTP_EXPECT "HTTP/" | ||
| 34 | #define DEFAULT_BUFFER_SIZE 2048 | ||
| 35 | #define DEFAULT_SERVER_URL "/" | ||
| 36 | |||
| 37 | typedef struct { | ||
| 38 | char *server_address; | ||
| 39 | char *server_url; | ||
| 40 | char *host_name; | ||
| 41 | |||
| 42 | char *http_method; | ||
| 43 | |||
| 44 | char *http_post_data; | ||
| 45 | |||
| 46 | unsigned short virtualPort; | ||
| 47 | unsigned short serverPort; | ||
| 48 | |||
| 49 | bool use_ssl; | ||
| 50 | bool no_body; | ||
| 51 | } check_curl_working_state; | ||
| 52 | |||
| 53 | check_curl_working_state check_curl_working_state_init(); | ||
| 54 | |||
| 55 | typedef struct { | ||
| 56 | bool automatic_decompression; | ||
| 57 | bool haproxy_protocol; | ||
| 58 | long socket_timeout; | ||
| 59 | sa_family_t sin_family; | ||
| 60 | int curl_http_version; | ||
| 61 | char **http_opt_headers; | ||
| 62 | size_t http_opt_headers_count; | ||
| 63 | int ssl_version; | ||
| 64 | char *client_cert; | ||
| 65 | char *client_privkey; | ||
| 66 | char *ca_cert; | ||
| 67 | bool verify_peer_and_host; | ||
| 68 | char user_agent[DEFAULT_BUFFER_SIZE]; | ||
| 69 | char proxy_auth[MAX_INPUT_BUFFER]; | ||
| 70 | char user_auth[MAX_INPUT_BUFFER]; | ||
| 71 | char *http_content_type; | ||
| 72 | char *cookie_jar_file; | ||
| 73 | } check_curl_static_curl_config; | ||
| 74 | |||
| 75 | typedef struct { | ||
| 76 | check_curl_working_state initial_config; | ||
| 77 | |||
| 78 | check_curl_static_curl_config curl_config; | ||
| 79 | int max_depth; | ||
| 80 | int followmethod; | ||
| 81 | int followsticky; | ||
| 82 | |||
| 83 | int maximum_age; | ||
| 84 | |||
| 85 | // the original regex string from the command line | ||
| 86 | char regexp[MAX_RE_SIZE]; | ||
| 87 | |||
| 88 | // the compiled regex for usage later | ||
| 89 | regex_t compiled_regex; | ||
| 90 | |||
| 91 | mp_state_enum state_regex; | ||
| 92 | bool invert_regex; | ||
| 93 | bool check_cert; | ||
| 94 | bool continue_after_check_cert; | ||
| 95 | int days_till_exp_warn; | ||
| 96 | int days_till_exp_crit; | ||
| 97 | mp_thresholds thlds; | ||
| 98 | mp_range page_length_limits; | ||
| 99 | bool page_length_limits_is_set; | ||
| 100 | struct { | ||
| 101 | char string[MAX_INPUT_BUFFER]; | ||
| 102 | bool is_present; | ||
| 103 | } server_expect; | ||
| 104 | char string_expect[MAX_INPUT_BUFFER]; | ||
| 105 | char header_expect[MAX_INPUT_BUFFER]; | ||
| 106 | mp_state_enum on_redirect_result_state; | ||
| 107 | bool on_redirect_dependent; | ||
| 108 | |||
| 109 | bool show_extended_perfdata; | ||
| 110 | bool show_body; | ||
| 111 | |||
| 112 | bool output_format_is_set; | ||
| 113 | mp_output_format output_format; | ||
| 114 | } check_curl_config; | ||
| 115 | |||
| 116 | check_curl_config check_curl_config_init(); | ||
