00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "config.h"
00021
00022 #ifdef HAVE_SYS_TYPES_H
00023 #include <sys/types.h>
00024 #endif
00025
00026 #ifdef HAVE_SYS_STAT_H
00027 #include <sys/stat.h>
00028 #endif
00029
00030 #ifdef HAVE_FCNTL_H
00031 #include <fcntl.h>
00032 #endif
00033
00034 #ifdef HAVE_STDLIB_H
00035 #include <stdlib.h>
00036 #endif
00037
00038 #ifdef TIME_WITH_SYS_TIME
00039 #include <time.h>
00040
00041 #ifdef HAVE_SYS_TIME
00042 #include <sys/time.h>
00043 #endif
00044 #else
00045 #include <time.h>
00046 #endif
00047
00048 #ifdef HAVE_SYS_LOADAVG_H
00049 #include <sys/loadavg.h>
00050 #endif
00051
00052 #ifdef HAVE_STRING_H
00053 #include <string.h>
00054 #endif
00055
00056 #include <stdio.h>
00057
00058 #include "monitor.h"
00059 #include "monit_process.h"
00060 #include "process/process.h"
00061
00074
00075
00076 char actionnames[][STRLEN]= {"ignore", "alert", "restart", "stop"};
00077 char modenames[][STRLEN]= {"active", "passive", "manual"};
00078 char operatorshortnames[][3]= {">", "<", "=", "!="};
00079 char operatornames[][STRLEN]= {"greater than", "less than", "equal to",
00080 "not equal to"};
00081
00082 int include_children= TRUE;
00083 int num_cpus=1;
00084
00085
00090 int init_process_info(void) {
00091
00092 return (init_process_info_sysdep());
00093
00094 }
00095
00096
00104 int update_process_data(Process_T p, pid_t pid) {
00105
00106 ProcInfo_T pi;
00107
00108 ASSERT(p);
00109
00110 pi= p->procinfo;
00111 pi->pid=pid;
00112
00113 if (! get_process_info(pi)) {
00114
00115 return FALSE;
00116
00117 }
00118
00119 return TRUE;
00120 }
00121
00122
00127 int update_loadavg(void) {
00128
00129 if ( -1 == getloadavg( Run.loadavg, 3) ) {
00130
00131 return FALSE;
00132
00133 }
00134
00135 return TRUE;
00136 }