summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/plugins/in_nginx_exporter_metrics/nginx.h
blob: 97538587b048ce6ffab98896dc234b677b405a4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/*  Fluent Bit
 *  ==========
 *  Copyright (C) 2015-2022 The Fluent Bit Authors
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

#ifndef FLB_IN_NGINX_H
#define FLB_IN_NGINX_H

#include <msgpack.h>
#include <fluent-bit/flb_input.h>
#include <fluent-bit/flb_parser.h>
#include <fluent-bit/flb_network.h>

#define DEFAULT_STATUS_URL          "/status"

struct nginx_ctx
{
    int coll_id;                    /* collector id */
    flb_sds_t status_url;
    struct flb_parser *parser;
    struct flb_input_instance *ins; /* Input plugin instace */
    struct flb_upstream *upstream;
    struct cmt *cmt;
    struct cmt_counter *connections_accepted;
    struct cmt_counter *connections_handled;
    struct cmt_counter *connections_total;
    struct cmt_gauge *connection_active;
    struct cmt_gauge *connections_active;
    struct cmt_gauge *connections_reading;
    struct cmt_gauge *connections_writing;
    struct cmt_gauge *connections_waiting;
    struct cmt_gauge *connection_up;
    bool is_up;
    bool is_nginx_plus;
    int nginx_plus_version;

    struct nginx_plus_connections *plus_connections;
    struct nginx_plus_http_requests *plus_http_requests;
    struct nginx_plus_ssl *plus_ssl;
    struct nginx_plus_server_zones *server_zones;
    struct nginx_plus_location_zones *location_zones;
    struct nginx_plus_upstreams *upstreams;
    struct nginx_plus_streams *streams;
    struct nginx_plus_stream_upstreams *stream_upstreams;
};

struct nginx_status
{
    uint64_t active;
    uint64_t reading;
    uint64_t writing;
    uint64_t waiting;
    uint64_t accepts;
    uint64_t handled;
    uint64_t requests;
};

struct nginx_plus_connections {
    struct cmt_counter *connections_accepted;
    struct cmt_counter *connections_dropped;
    struct cmt_counter *connections_active;
    struct cmt_counter *connections_idle;
};

struct nginx_plus_ssl {
    struct cmt_counter *handshakes;
    struct cmt_counter *handshakes_failed;
    struct cmt_counter *session_reuses;
};

struct nginx_plus_http_requests {
    struct cmt_counter *total;
    struct cmt_counter *current;
};

struct nginx_plus_server_zones {
    struct cmt_counter *discarded;
    struct cmt_counter *processing;
    struct cmt_counter *received;
    struct cmt_counter *requests;
    struct cmt_counter *responses;
    struct cmt_counter *sent;
};

struct nginx_plus_upstreams {
    //struct nginx_plux_upstream_peer **peers;
    struct cmt_gauge   *keepalives;
    struct cmt_gauge   *zombies;
    // per peer
    struct cmt_gauge   *active;
    struct cmt_counter *fails;
    struct cmt_gauge   *header_time;
    struct cmt_gauge   *limit;
    struct cmt_counter *received;
    struct cmt_counter *requests;
    struct cmt_counter *responses;
    struct cmt_gauge   *response_time;
    struct cmt_counter *sent;
    struct cmt_gauge   *state;
    struct cmt_counter *unavail;
};

struct nginx_plus_location_zones {
    struct cmt_counter *discarded;
    struct cmt_counter *received;
    struct cmt_counter *requests;
    struct cmt_counter *responses;
    struct cmt_counter *sent;
};

struct nginx_plus_streams {
    struct cmt_counter *connections;
    struct cmt_counter *discarded;
    struct cmt_counter *processing;
    struct cmt_counter *received;
    struct cmt_counter *sent;
    struct cmt_counter *sessions;
};

struct nginx_plus_stream_upstreams {
    struct cmt_gauge   *zombies;
    // per peer
    struct cmt_gauge   *active;
    struct cmt_counter *fails;
    struct cmt_gauge   *limit;
    struct cmt_counter *received;
    struct cmt_gauge   *connect_time;
    struct cmt_gauge   *first_byte_time;
    struct cmt_counter *connections;
    struct cmt_gauge   *response_time;
    struct cmt_counter *sent;
    struct cmt_gauge   *state;
    struct cmt_counter *unavail;
};

#endif