73 |
int remote= TRUE; |
int remote= TRUE; |
74 |
ssl_connection * ssl= NULL; |
ssl_connection * ssl= NULL; |
75 |
|
|
76 |
if ( Run.httpdssl ) { |
if(Run.httpdssl) { |
77 |
|
|
78 |
ssl = new_ssl_connection(Run.httpsslpem); |
ssl = new_ssl_connection(Run.httpsslpem); |
79 |
|
|
82 |
fprintf(stdout, "monit daemon uptime: %s\n", uptime); |
fprintf(stdout, "monit daemon uptime: %s\n", uptime); |
83 |
free(uptime); |
free(uptime); |
84 |
|
|
85 |
for ( p= processlist; p; p= p->next) { |
for(p= processlist; p; p= p->next) { |
86 |
|
|
87 |
if (remote) { |
if(remote) { |
88 |
|
|
89 |
remote = remote_status(p, ssl); |
remote = remote_status(p, ssl); |
90 |
|
|
96 |
|
|
97 |
} |
} |
98 |
|
|
99 |
if ( Run.httpdssl ) { |
if(Run.httpdssl) { |
100 |
|
|
101 |
delete_ssl_socket(ssl); |
delete_ssl_socket(ssl); |
102 |
|
|
114 |
int remote= TRUE; |
int remote= TRUE; |
115 |
ssl_connection * ssl= NULL; |
ssl_connection * ssl= NULL; |
116 |
|
|
117 |
if ( Run.httpdssl ) { |
ASSERT(G); |
118 |
|
|
119 |
|
if(Run.httpdssl) { |
120 |
|
|
121 |
ssl = new_ssl_connection(Run.httpsslclientpem); |
ssl = new_ssl_connection(Run.httpsslclientpem); |
122 |
|
|
123 |
} |
} |
124 |
|
|
125 |
for ( p= processlist; p; p= p->next) { |
for(p= processlist; p; p= p->next) { |
126 |
|
|
127 |
if (is(p->group, G) ) { |
if(is(p->group, G)) { |
128 |
|
|
129 |
if (remote) { |
if(remote) { |
130 |
|
|
131 |
remote = remote_status(p, ssl); |
remote = remote_status(p, ssl); |
132 |
|
|
140 |
|
|
141 |
} |
} |
142 |
|
|
143 |
if ( Run.httpdssl ) { |
if(Run.httpdssl) { |
144 |
|
|
145 |
delete_ssl_socket(ssl); |
delete_ssl_socket(ssl); |
146 |
|
|
157 |
static void local_status(Process_T p) { |
static void local_status(Process_T p) { |
158 |
|
|
159 |
pid_t pid= -1; |
pid_t pid= -1; |
160 |
|
|
161 |
|
ASSERT(p); |
162 |
|
|
163 |
if ( (pid= is_process_running(p)) ) { |
if((pid= is_process_running(p))) { |
164 |
|
|
165 |
char *uptime= get_process_uptime(p->pidfile); |
char *uptime= get_process_uptime(p->pidfile); |
166 |
|
|
185 |
*/ |
*/ |
186 |
static int remote_status(Process_T p, ssl_connection * ssl) { |
static int remote_status(Process_T p, ssl_connection * ssl) { |
187 |
|
|
188 |
if ( exist_daemon() ) { |
ASSERT(p); |
189 |
|
|
190 |
|
if(exist_daemon()) { |
191 |
|
|
192 |
/* If a monit daemon exist we request status information from the server */ |
/* If a monit daemon exist we request status information from the server */ |
193 |
|
|
194 |
int s= create_socket(Run.bind_addr?Run.bind_addr:"localhost", |
int s= create_socket(Run.bind_addr?Run.bind_addr:"localhost", |
195 |
Run.httpdport, SOCK_STREAM); |
Run.httpdport, SOCK_STREAM); |
196 |
if (s<0) { |
if(s<0) { |
197 |
|
|
198 |
fprintf(stdout, |
fprintf(stdout, |
199 |
"Cannot connect to monit server to get" |
"Cannot connect to monit server to get" |
214 |
|
|
215 |
free(auth); |
free(auth); |
216 |
|
|
217 |
if ( ssl != NULL ) { |
if(ssl != NULL) { |
218 |
|
|
219 |
if (!embed_ssl_socket(ssl, s)) { |
if(!embed_ssl_socket(ssl, s)) { |
220 |
|
|
221 |
fprintf(stdout, "Failed establish SSL communication to monit" |
fprintf(stdout, "Failed establish SSL communication to monit" |
222 |
" server\n"); |
" server\n"); |