root/src/modules/external_proc.h

Revision dad3f7f6ed2d68a68ba92aade5c0d9cc6b2ba96f, 2.6 kB (checked in by Philip Maddox <pmaddox@circonus.com>, 1 month ago)

Added Nagios Parsing Ability To External Check

Added the capability to parse Nagios checks meaningfully to the
external check. There is now a module config, "nagios_regex", that
contains the regex to parse out the output from Nagios scripts. If
"NAGIOS" is entered as the output_extract parameter, noitd will enter
a special Nagios parsing mode that will pull out the state and any
associated metrics from the Nagios script.

  • Property mode set to 100644
Line 
1 /*
2  * Copyright (c) 2009, OmniTI Computer Consulting, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *     * Redistributions of source code must retain the above copyright
10  *       notice, this list of conditions and the following disclaimer.
11  *     * Redistributions in binary form must reproduce the above
12  *       copyright notice, this list of conditions and the following
13  *       disclaimer in the documentation and/or other materials provided
14  *       with the distribution.
15  *     * Neither the name OmniTI Computer Consulting, Inc. nor the names
16  *       of its contributors may be used to endorse or promote products
17  *       derived from this software without specific prior written
18  *       permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef MODULES_EXTERNAL_PROC_H
34 #define MODULES_EXTERNAL_PROC_H
35
36 #include "noit_defines.h"
37 #include "eventer/eventer.h"
38 #include "utils/noit_atomic.h"
39 #include "utils/noit_hash.h"
40
41 typedef enum {
42   EXTERNAL_DEFAULT_TYPE = 0,
43   EXTERNAL_NAGIOS_TYPE = 1
44 } external_special_t;
45
46 struct external_response {
47   int64_t check_no;
48   int32_t exit_code;
49   int stdoutlen_sofar;
50   u_int16_t stdoutlen;
51   char *stdoutbuff;
52   int stderrlen_sofar;
53   u_int16_t stderrlen;
54   char *stderrbuff;
55 };
56 typedef struct {
57   noit_log_stream_t nlerr;
58   noit_log_stream_t nldeb;
59   int child;
60   int pipe_n2e[2];
61   int pipe_e2n[2];
62   char* path;
63   char* nagios_regex;
64   external_special_t type;
65   eventer_jobq_t *jobq;
66   noit_atomic64_t check_no_seq;
67   noit_hash_table external_checks;
68   noit_hash_table *options;
69
70   struct external_response *cr;
71 } external_data_t;
72
73 typedef struct {
74   int64_t check_no;
75   int32_t exit_code;
76   u_int16_t stdoutlen;
77 } __attribute__((packed)) external_header;
78
79 int external_child(external_data_t *);
80
81 #endif
Note: See TracBrowser for help on using the browser.