Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Biscuola <git-no-reply@zabbix.com>2017-07-18 15:55:06 +0300
committerAndrea Biscuola <git-no-reply@zabbix.com>2017-07-18 15:55:06 +0300
commit2cc1a9d9390cebd5776f36948b42fb61af9cfc0f (patch)
tree450197a2ad6512db60ae6765f2a0834ec772a77d
parentcc08a5dd7797a72cdff4fabce5131a7ca200b6c0 (diff)
...G...... [ZBXNEXT-3910] Added 'disk' and 'trace' process track for OpenBSD
Introduce two new defines for two more types of monitored processes. in sysinfo.h. They will be used for also the other future commits. Handle processes that are in an uninterruptible sleep (D) and in a stopped state(T). We still keep the series of ifdef for older versions of the OS after the KVM subsystem was moved to the new kern_proc structure. It should be removed in one of the next releases, being nearly 5 years that it was introduced (consider that OpenBSD support a release for only one year).
-rw-r--r--include/sysinfo.h2
-rw-r--r--src/libs/zbxsysinfo/openbsd/proc.c14
2 files changed, 16 insertions, 0 deletions
diff --git a/include/sysinfo.h b/include/sysinfo.h
index 8943a3ac31a..1b481ba91d2 100644
--- a/include/sysinfo.h
+++ b/include/sysinfo.h
@@ -160,6 +160,8 @@ extern int CONFIG_UNSAFE_USER_PARAMETERS;
#define ZBX_PROC_STAT_RUN 1
#define ZBX_PROC_STAT_SLEEP 2
#define ZBX_PROC_STAT_ZOMB 3
+#define ZBX_PROC_STAT_IOWAIT 4
+#define ZBX_PROC_STAT_TRACE 5
#define ZBX_DO_SUM 0
#define ZBX_DO_MAX 1
diff --git a/src/libs/zbxsysinfo/openbsd/proc.c b/src/libs/zbxsysinfo/openbsd/proc.c
index d92dd1a6ae0..feed4404620 100644
--- a/src/libs/zbxsysinfo/openbsd/proc.c
+++ b/src/libs/zbxsysinfo/openbsd/proc.c
@@ -38,6 +38,7 @@
#ifdef KERN_PROC2
# define ZBX_P_COMM p_comm
+# define ZBX_P_FLAG p_flag
# define ZBX_P_PID p_pid
# define ZBX_P_STAT p_stat
# define ZBX_P_VM_TSIZE p_vm_tsize
@@ -45,6 +46,7 @@
# define ZBX_P_VM_SSIZE p_vm_ssize
#else
# define ZBX_P_COMM kp_proc.p_comm
+# define ZBX_P_FLAG kp_proc.p_flag
# define ZBX_P_PID kp_proc.p_pid
# define ZBX_P_STAT kp_proc.p_stat
# define ZBX_P_VM_TSIZE kp_eproc.e_vm.vm_tsize
@@ -340,6 +342,10 @@ int PROC_NUM(AGENT_REQUEST *request, AGENT_RESULT *result)
zbx_proc_stat = ZBX_PROC_STAT_SLEEP;
else if (0 == strcmp(param, "zomb"))
zbx_proc_stat = ZBX_PROC_STAT_ZOMB;
+ else if (0 == strcmp(param, "disk"))
+ zbx_proc_stat = ZBX_PROC_STAT_IOWAIT;
+ else if (0 == strcmp(param, "trace"))
+ zbx_proc_stat = ZBX_PROC_STAT_TRACE;
else
{
SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid third parameter."));
@@ -435,6 +441,14 @@ int PROC_NUM(AGENT_REQUEST *request, AGENT_RESULT *result)
if (SZOMB == proc[i].ZBX_P_STAT || SDEAD == proc[i].ZBX_P_STAT)
stat_ok = 1;
break;
+ case ZBX_PROC_STAT_IOWAIT:
+ if (SSLEEP == proc[i].ZBX_P_STAT && !(proc[i].ZBX_P_FLAG & P_SINTR))
+ stat_ok = 1;
+ break;
+ case ZBX_PROC_STAT_TRACE:
+ if (SSTOP == proc[i].ZBX_P_STAT)
+ stat_ok = 1;
+ break;
}
}
else