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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef NETDATA_EBPF_VFS_H
#define NETDATA_EBPF_VFS_H 1
// Module name & description
#define NETDATA_EBPF_MODULE_NAME_VFS "vfs"
#define NETDATA_EBPF_VFS_MODULE_DESC "Monitor VFS (Virtual File System) functions. This thread is integrated with apps and cgroup."
#define NETDATA_DIRECTORY_VFS_CONFIG_FILE "vfs.conf"
// Global chart name
#define NETDATA_VFS_FILE_CLEAN_COUNT "vfs_deleted_objects"
#define NETDATA_VFS_FILE_IO_COUNT "vfs_io"
#define NETDATA_VFS_FILE_ERR_COUNT "vfs_io_error"
#define NETDATA_VFS_IO_FILE_BYTES "vfs_io_bytes"
#define NETDATA_VFS_FSYNC "vfs_fsync"
#define NETDATA_VFS_FSYNC_ERR "vfs_fsync_error"
#define NETDATA_VFS_OPEN "vfs_open"
#define NETDATA_VFS_OPEN_ERR "vfs_open_error"
#define NETDATA_VFS_CREATE "vfs_create"
#define NETDATA_VFS_CREATE_ERR "vfs_create_error"
// Charts created on Apps submenu
#define NETDATA_SYSCALL_APPS_FILE_DELETED "file_deleted"
#define NETDATA_SYSCALL_APPS_VFS_WRITE_CALLS "vfs_write_call"
#define NETDATA_SYSCALL_APPS_VFS_READ_CALLS "vfs_read_call"
#define NETDATA_SYSCALL_APPS_VFS_WRITE_BYTES "vfs_write_bytes"
#define NETDATA_SYSCALL_APPS_VFS_READ_BYTES "vfs_read_bytes"
#define NETDATA_SYSCALL_APPS_VFS_FSYNC "vfs_fsync"
#define NETDATA_SYSCALL_APPS_VFS_OPEN "vfs_open"
#define NETDATA_SYSCALL_APPS_VFS_CREATE "vfs_create"
#define NETDATA_SYSCALL_APPS_VFS_WRITE_CALLS_ERROR "vfs_write_error"
#define NETDATA_SYSCALL_APPS_VFS_READ_CALLS_ERROR "vfs_read_error"
#define NETDATA_SYSCALL_APPS_VFS_FSYNC_CALLS_ERROR "vfs_fsync_error"
#define NETDATA_SYSCALL_APPS_VFS_OPEN_CALLS_ERROR "vfs_open_error"
#define NETDATA_SYSCALL_APPS_VFS_CREATE_CALLS_ERROR "vfs_create_error"
// Group used on Dashboard
#define NETDATA_VFS_GROUP "vfs"
// Contexts
#define NETDATA_CGROUP_VFS_UNLINK_CONTEXT "cgroup.vfs_unlink"
#define NETDATA_CGROUP_VFS_WRITE_CONTEXT "cgroup.vfs_write"
#define NETDATA_CGROUP_VFS_WRITE_ERROR_CONTEXT "cgroup.vfs_write_error"
#define NETDATA_CGROUP_VFS_READ_CONTEXT "cgroup.vfs_read"
#define NETDATA_CGROUP_VFS_READ_ERROR_CONTEXT "cgroup.vfs_read_error"
#define NETDATA_CGROUP_VFS_WRITE_BYTES_CONTEXT "cgroup.vfs_write_bytes"
#define NETDATA_CGROUP_VFS_READ_BYTES_CONTEXT "cgroup.vfs_read_bytes"
#define NETDATA_CGROUP_VFS_CREATE_CONTEXT "cgroup.vfs_create"
#define NETDATA_CGROUP_VFS_CREATE_ERROR_CONTEXT "cgroup.vfs_create_error"
#define NETDATA_CGROUP_VFS_OPEN_CONTEXT "cgroup.vfs_open"
#define NETDATA_CGROUP_VFS_OPEN_ERROR_CONTEXT "cgroup.vfs_open_error"
#define NETDATA_CGROUP_VFS_FSYNC_CONTEXT "cgroup.vfs_fsync"
#define NETDATA_CGROUP_VFS_FSYNC_ERROR_CONTEXT "cgroup.vfs_fsync_error"
#define NETDATA_SYSTEMD_VFS_UNLINK_CONTEXT "systemd.service.vfs_unlink"
#define NETDATA_SYSTEMD_VFS_WRITE_CONTEXT "systemd.service.vfs_write"
#define NETDATA_SYSTEMD_VFS_WRITE_ERROR_CONTEXT "systemd.service.vfs_write_error"
#define NETDATA_SYSTEMD_VFS_READ_CONTEXT "systemd.service.vfs_read"
#define NETDATA_SYSTEMD_VFS_READ_ERROR_CONTEXT "systemd.service.vfs_read_error"
#define NETDATA_SYSTEMD_VFS_WRITE_BYTES_CONTEXT "systemd.service.vfs_write_bytes"
#define NETDATA_SYSTEMD_VFS_READ_BYTES_CONTEXT "systemd.service.vfs_read_bytes"
#define NETDATA_SYSTEMD_VFS_CREATE_CONTEXT "systemd.service.vfs_create"
#define NETDATA_SYSTEMD_VFS_CREATE_ERROR_CONTEXT "systemd.service.vfs_create_error"
#define NETDATA_SYSTEMD_VFS_OPEN_CONTEXT "systemd.service.vfs_open"
#define NETDATA_SYSTEMD_VFS_OPEN_ERROR_CONTEXT "systemd.service.vfs_open_error"
#define NETDATA_SYSTEMD_VFS_FSYNC_CONTEXT "systemd.service.vfs_fsync"
#define NETDATA_SYSTEMD_VFS_FSYNC_ERROR_CONTEXT "systemd.service.vfs_fsync_error"
// ARAL name
#define NETDATA_EBPF_VFS_ARAL_NAME "ebpf_vfs"
// dimension
#define EBPF_COMMON_UNITS_BYTES "bytes/s"
typedef struct __attribute__((packed)) netdata_publish_vfs {
uint64_t ct;
//Counter
uint32_t write_call;
uint32_t writev_call;
uint32_t read_call;
uint32_t readv_call;
uint32_t unlink_call;
uint32_t fsync_call;
uint32_t open_call;
uint32_t create_call;
//Accumulator
uint64_t write_bytes;
uint64_t writev_bytes;
uint64_t readv_bytes;
uint64_t read_bytes;
//Counter
uint32_t write_err;
uint32_t writev_err;
uint32_t read_err;
uint32_t readv_err;
uint32_t unlink_err;
uint32_t fsync_err;
uint32_t open_err;
uint32_t create_err;
} netdata_publish_vfs_t;
typedef struct netdata_ebpf_vfs {
uint64_t ct;
uint32_t tgid;
uint32_t uid;
uint32_t gid;
char name[TASK_COMM_LEN];
//Counter
uint32_t write_call;
uint32_t writev_call;
uint32_t read_call;
uint32_t readv_call;
uint32_t unlink_call;
uint32_t fsync_call;
uint32_t open_call;
uint32_t create_call;
//Accumulator
uint64_t write_bytes;
uint64_t writev_bytes;
uint64_t readv_bytes;
uint64_t read_bytes;
//Counter
uint32_t write_err;
uint32_t writev_err;
uint32_t read_err;
uint32_t readv_err;
uint32_t unlink_err;
uint32_t fsync_err;
uint32_t open_err;
uint32_t create_err;
} netdata_ebpf_vfs_t;
enum netdata_publish_vfs_list {
NETDATA_KEY_PUBLISH_VFS_UNLINK,
NETDATA_KEY_PUBLISH_VFS_READ,
NETDATA_KEY_PUBLISH_VFS_WRITE,
NETDATA_KEY_PUBLISH_VFS_FSYNC,
NETDATA_KEY_PUBLISH_VFS_OPEN,
NETDATA_KEY_PUBLISH_VFS_CREATE,
NETDATA_KEY_PUBLISH_VFS_END
};
enum vfs_counters {
NETDATA_KEY_CALLS_VFS_WRITE,
NETDATA_KEY_ERROR_VFS_WRITE,
NETDATA_KEY_BYTES_VFS_WRITE,
NETDATA_KEY_CALLS_VFS_WRITEV,
NETDATA_KEY_ERROR_VFS_WRITEV,
NETDATA_KEY_BYTES_VFS_WRITEV,
NETDATA_KEY_CALLS_VFS_READ,
NETDATA_KEY_ERROR_VFS_READ,
NETDATA_KEY_BYTES_VFS_READ,
NETDATA_KEY_CALLS_VFS_READV,
NETDATA_KEY_ERROR_VFS_READV,
NETDATA_KEY_BYTES_VFS_READV,
NETDATA_KEY_CALLS_VFS_UNLINK,
NETDATA_KEY_ERROR_VFS_UNLINK,
NETDATA_KEY_CALLS_VFS_FSYNC,
NETDATA_KEY_ERROR_VFS_FSYNC,
NETDATA_KEY_CALLS_VFS_OPEN,
NETDATA_KEY_ERROR_VFS_OPEN,
NETDATA_KEY_CALLS_VFS_CREATE,
NETDATA_KEY_ERROR_VFS_CREATE,
// Keep this as last and don't skip numbers as it is used as element counter
NETDATA_VFS_COUNTER
};
enum netdata_vfs_tables {
NETDATA_VFS_PID,
NETDATA_VFS_ALL,
NETDATA_VFS_CTRL
};
enum netdata_vfs_calls_name {
NETDATA_EBPF_VFS_WRITE,
NETDATA_EBPF_VFS_WRITEV,
NETDATA_EBPF_VFS_READ,
NETDATA_EBPF_VFS_READV,
NETDATA_EBPF_VFS_UNLINK,
NETDATA_EBPF_VFS_FSYNC,
NETDATA_EBPF_VFS_OPEN,
NETDATA_EBPF_VFS_CREATE,
NETDATA_VFS_END_LIST
};
void *ebpf_vfs_thread(void *ptr);
void ebpf_vfs_create_apps_charts(struct ebpf_module *em, void *ptr);
void ebpf_vfs_release(netdata_publish_vfs_t *stat);
extern netdata_ebpf_targets_t vfs_targets[];
extern struct config vfs_config;
#endif /* NETDATA_EBPF_VFS_H */
|