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 operatornames[][STRLEN]= {"greater than", "less than", "equal to",
00079 "not equal to"};
00080 char operatorshortnames[][3]= {">", "<", "=", "!="};
00081 char statusnames[][STRLEN]= {"not monitored", "monitored" };
00082
00083 int include_children= TRUE;
00084 int num_cpus=1;
00085
00086
00091 int init_process_info(void) {
00092
00093 return (init_process_info_sysdep());
00094
00095 }
00096
00097
00105 int update_process_data(Process_T p, pid_t pid) {
00106
00107 ProcInfo_T pi;
00108
00109 ASSERT(p);
00110
00111 pi= p->procinfo;
00112 pi->pid=pid;
00113
00114 if (! get_process_info(pi)) {
00115
00116 return FALSE;
00117
00118 }
00119
00120 return TRUE;
00121 }
00122
00123
00128 int update_loadavg(void) {
00129
00130 if ( -1 == getloadavg( Run.loadavg, 3) ) {
00131
00132 return FALSE;
00133
00134 }
00135
00136 return TRUE;
00137 }