summaryrefslogtreecommitdiffstats
path: root/collectors/ebpf.plugin/ebpf.h
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2020-05-13 16:56:42 +0000
committerGitHub <noreply@github.com>2020-05-13 16:56:42 +0000
commit18ec989b21eb1c6cf1f736e27b6b89b1a3108b34 (patch)
treeb3de2d0312bcce1d6017376672e4b8babd81abec /collectors/ebpf.plugin/ebpf.h
parent8d5db453b71bb7d3440d909f7e2f3c01718f5ae1 (diff)
Rename eBPF collector (#8822)
We renamed eBPF collector for a more meaningful name.
Diffstat (limited to 'collectors/ebpf.plugin/ebpf.h')
-rw-r--r--collectors/ebpf.plugin/ebpf.h155
1 files changed, 155 insertions, 0 deletions
diff --git a/collectors/ebpf.plugin/ebpf.h b/collectors/ebpf.plugin/ebpf.h
new file mode 100644
index 0000000000..5f05389e02
--- /dev/null
+++ b/collectors/ebpf.plugin/ebpf.h
@@ -0,0 +1,155 @@
+#ifndef _NETDATA_VFS_EBPF_H_
+# define _NETDATA_VFS_EBPF_H_ 1
+
+# include <stdint.h>
+
+#ifndef __FreeBSD__
+# include <linux/perf_event.h>
+# endif
+# include <stdint.h>
+# include <errno.h>
+# include <signal.h>
+# include <stdio.h>
+# include <stdint.h>
+# include <stdlib.h>
+# include <string.h>
+# include <unistd.h>
+# include <dlfcn.h>
+
+# define NETDATA_GLOBAL_VECTOR 24
+# define NETDATA_MAX_MONITOR_VECTOR 9
+# define NETDATA_VFS_ERRORS 3
+# define NETDATA_PROCESS_ERRORS 4
+
+# define NETDATA_DEL_START 2
+# define NETDATA_IN_START_BYTE 3
+# define NETDATA_EXIT_START 5
+# define NETDATA_PROCESS_START 7
+# define NETDATA_PROCESS_RUNNING_COUNT 9
+
+# define NETDATA_EBPF_PROCESS_THREADS (uint32_t)3
+
+# include <fcntl.h>
+# include <ctype.h>
+# include <dirent.h>
+
+//From libnetdata.h
+# include "../../libnetdata/threads/threads.h"
+# include "../../libnetdata/locks/locks.h"
+# include "../../libnetdata/avl/avl.h"
+# include "../../libnetdata/clocks/clocks.h"
+# include "../../libnetdata/config/appconfig.h"
+# include "../../libnetdata/ebpf/ebpf.h"
+
+typedef enum {
+ MODE_RETURN = 0, //This attaches kprobe when the function returns
+ MODE_DEVMODE, //This stores log given description about the errors raised
+ MODE_ENTRY //This attaches kprobe when the function is called
+} netdata_run_mode_t;
+
+typedef struct netdata_syscall_stat {
+ unsigned long bytes; //total number of bytes
+ uint64_t call; //total number of calls
+ uint64_t ecall; //number of calls that returned error
+ struct netdata_syscall_stat *next; //Link list
+}netdata_syscall_stat_t;
+
+typedef uint64_t netdata_idx_t;
+
+typedef struct netdata_publish_syscall {
+ char *dimension;
+ char *name;
+ unsigned long nbyte;
+ unsigned long pbyte;
+ uint64_t ncall;
+ uint64_t pcall;
+ uint64_t nerr;
+ uint64_t perr;
+ struct netdata_publish_syscall *next;
+}netdata_publish_syscall_t;
+
+typedef struct netdata_publish_vfs_common {
+ long write;
+ long read;
+
+ long running;
+ long zombie;
+}netdata_publish_vfs_common_t;
+
+typedef struct netdata_error_report {
+ char comm[16];
+ __u32 pid;
+
+ int type;
+ int err;
+}netdata_error_report_t;
+
+//Chart defintions
+# define NETDATA_EBPF_FAMILY "ebpf"
+# define NETDATA_FILE_GROUP "File"
+# define NETDATA_VFS_GROUP "VFS"
+# define NETDATA_PROCESS_GROUP "Process"
+
+# define NETDATA_FILE_OPEN_CLOSE_COUNT "file_descriptor"
+# define NETDATA_FILE_OPEN_ERR_COUNT "file_error"
+# define NETDATA_VFS_FILE_CLEAN_COUNT "deleted_objects"
+# define NETDATA_VFS_FILE_IO_COUNT "io"
+# define NETDATA_VFS_FILE_ERR_COUNT "io_error"
+
+# define NETDATA_EXIT_SYSCALL "exit"
+# define NETDATA_PROCESS_SYSCALL "process_thread"
+# define NETDATA_PROCESS_ERROR_NAME "task_error"
+# define NETDATA_PROCESS_STATUS_NAME "process_status"
+
+# define NETDATA_VFS_IO_FILE_BYTES "io_bytes"
+# define NETDATA_VFS_DIM_IN_FILE_BYTES "write"
+# define NETDATA_VFS_DIM_OUT_FILE_BYTES "read"
+
+//Log file
+# define NETDATA_DEVELOPER_LOG_FILE "developer.log"
+
+//Maximum number of processors monitored on perf events
+# define NETDATA_MAX_PROCESSOR 512
+
+//Kernel versions calculated with the formula:
+// R = MAJOR*65536 + MINOR*256 + PATCH
+# define NETDATA_KERNEL_V5_3 328448
+# define NETDATA_KERNEL_V4_15 265984
+
+//Index from kernel
+# define NETDATA_KEY_CALLS_DO_SYS_OPEN 0
+# define NETDATA_KEY_ERROR_DO_SYS_OPEN 1
+
+# define NETDATA_KEY_CALLS_VFS_WRITE 2
+# define NETDATA_KEY_ERROR_VFS_WRITE 3
+# define NETDATA_KEY_BYTES_VFS_WRITE 4
+
+# define NETDATA_KEY_CALLS_VFS_READ 5
+# define NETDATA_KEY_ERROR_VFS_READ 6
+# define NETDATA_KEY_BYTES_VFS_READ 7
+
+# define NETDATA_KEY_CALLS_VFS_UNLINK 8
+# define NETDATA_KEY_ERROR_VFS_UNLINK 9
+
+# define NETDATA_KEY_CALLS_DO_EXIT 10
+
+# define NETDATA_KEY_CALLS_RELEASE_TASK 11
+
+# define NETDATA_KEY_CALLS_DO_FORK 12
+# define NETDATA_KEY_ERROR_DO_FORK 13
+
+# define NETDATA_KEY_CALLS_CLOSE_FD 14
+# define NETDATA_KEY_ERROR_CLOSE_FD 15
+
+# define NETDATA_KEY_CALLS_SYS_CLONE 16
+# define NETDATA_KEY_ERROR_SYS_CLONE 17
+
+# define NETDATA_KEY_CALLS_VFS_WRITEV 18
+# define NETDATA_KEY_ERROR_VFS_WRITEV 19
+# define NETDATA_KEY_BYTES_VFS_WRITEV 20
+
+# define NETDATA_KEY_CALLS_VFS_READV 21
+# define NETDATA_KEY_ERROR_VFS_READV 22
+# define NETDATA_KEY_BYTES_VFS_READV 23
+
+#endif