/[monit]/monit/status.c
ViewVC logotype

Diff of /monit/status.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by hauk, Thu Dec 19 20:50:06 2002 UTC revision 1.19 by hauk, Sat Dec 21 13:56:04 2002 UTC
# Line 73  void status() { Line 73  void status() {
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    
# Line 82  void status() { Line 82  void status() {
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    
# Line 96  void status() { Line 96  void status() {
96            
97    }    }
98    
99    if ( Run.httpdssl ) {    if(Run.httpdssl) {
100    
101      delete_ssl_socket(ssl);      delete_ssl_socket(ssl);
102    
# Line 114  void status_group(char *G) { Line 114  void status_group(char *G) {
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    
# Line 138  void status_group(char *G) { Line 140  void status_group(char *G) {
140        
141    }    }
142    
143    if ( Run.httpdssl ) {    if(Run.httpdssl) {
144    
145      delete_ssl_socket(ssl);      delete_ssl_socket(ssl);
146    
# Line 155  void status_group(char *G) { Line 157  void status_group(char *G) {
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    
# Line 181  static void local_status(Process_T p) { Line 185  static void local_status(Process_T p) {
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"
# Line 208  static int remote_status(Process_T p, ss Line 214  static int remote_status(Process_T p, ss
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");

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26