75 |
static void do_runtime(HttpRequest, HttpResponse); |
static void do_runtime(HttpRequest, HttpResponse); |
76 |
static void do_viewlog(HttpRequest, HttpResponse); |
static void do_viewlog(HttpRequest, HttpResponse); |
77 |
static void handle_action(HttpRequest, HttpResponse); |
static void handle_action(HttpRequest, HttpResponse); |
78 |
static void print_status(Process_T, HttpResponse res); |
static void print_status(Service_T, HttpResponse res); |
79 |
static void is_monit_running(HttpRequest, HttpResponse); |
static void is_monit_running(HttpRequest, HttpResponse); |
80 |
static void do_task(HttpRequest, HttpResponse, char *); |
static void do_task(HttpRequest, HttpResponse, char *); |
81 |
static void do_task_device(HttpRequest, HttpResponse, Process_T); |
static void do_task_device(HttpRequest, HttpResponse, Service_T); |
82 |
static void do_task_directory(HttpRequest, HttpResponse, Process_T); |
static void do_task_directory(HttpRequest, HttpResponse, Service_T); |
83 |
static void do_task_file(HttpRequest, HttpResponse, Process_T); |
static void do_task_file(HttpRequest, HttpResponse, Service_T); |
84 |
static void do_task_process(HttpRequest, HttpResponse, Process_T); |
static void do_task_process(HttpRequest, HttpResponse, Service_T); |
85 |
|
|
86 |
extern ssl_server_connection * mySSLServerConnection; |
extern ssl_server_connection * mySSLServerConnection; |
87 |
|
|
447 |
char *name= req->url; |
char *name= req->url; |
448 |
char *action= get_parameter(req, "action"); |
char *action= get_parameter(req, "action"); |
449 |
|
|
450 |
if(exist_process(++name)) { |
if(exist_service(++name)) { |
451 |
|
|
452 |
if(action) { |
if(action) { |
453 |
|
|
454 |
Process_T p= get_process(name); |
Service_T s= get_service(name); |
455 |
|
|
456 |
if( IS(action, "start") ) { |
if( IS(action, "start") ) { |
457 |
|
|
458 |
if(p->start) { |
if(s->start) { |
459 |
|
|
460 |
LOCK(p->mutex) |
LOCK(s->mutex) |
461 |
check_process(name, action); |
check_service(name, action); |
462 |
END_LOCK; |
END_LOCK; |
463 |
|
|
464 |
} else { |
} else { |
465 |
|
|
466 |
send_error(res, SC_BAD_REQUEST, |
send_error(res, SC_BAD_REQUEST, |
467 |
"Start method not defined for the process"); |
"Start method not defined for the service"); |
468 |
goto quit; |
goto quit; |
469 |
|
|
470 |
} |
} |
473 |
|
|
474 |
if( IS(action, "stop") ) { |
if( IS(action, "stop") ) { |
475 |
|
|
476 |
if(p->stop) { |
if(s->stop) { |
477 |
|
|
478 |
LOCK(p->mutex) |
LOCK(s->mutex) |
479 |
check_process(name, action); |
check_service(name, action); |
480 |
END_LOCK; |
END_LOCK; |
481 |
|
|
482 |
} else { |
} else { |
483 |
|
|
484 |
send_error(res, SC_BAD_REQUEST, |
send_error(res, SC_BAD_REQUEST, |
485 |
"Stop method not defined for the process"); |
"Stop method not defined for the service"); |
486 |
goto quit; |
goto quit; |
487 |
|
|
488 |
} |
} |
491 |
|
|
492 |
if( IS(action, "restart") ) { |
if( IS(action, "restart") ) { |
493 |
|
|
494 |
if(p->start && p->stop) { |
if(s->start && s->stop) { |
495 |
|
|
496 |
LOCK(p->mutex) |
LOCK(s->mutex) |
497 |
check_process(name, action); |
check_service(name, action); |
498 |
END_LOCK; |
END_LOCK; |
499 |
|
|
500 |
} else { |
} else { |
501 |
|
|
502 |
send_error(res, SC_BAD_REQUEST, |
send_error(res, SC_BAD_REQUEST, |
503 |
"Start or stop method not defined for the process"); |
"Start or stop method not defined for the service"); |
504 |
goto quit; |
goto quit; |
505 |
|
|
506 |
} |
} |
509 |
|
|
510 |
if(IS(action, "status")) { |
if(IS(action, "status")) { |
511 |
|
|
512 |
print_status(p, res); |
print_status(s, res); |
513 |
goto quit; |
goto quit; |
514 |
|
|
515 |
} |
} |
535 |
|
|
536 |
static void do_task(HttpRequest req, HttpResponse res, char *name) { |
static void do_task(HttpRequest req, HttpResponse res, char *name) { |
537 |
|
|
538 |
Process_T p= get_process(name); |
Service_T s= get_service(name); |
539 |
|
|
540 |
HEAD(name, 1000) |
HEAD(name, 1000) |
541 |
|
|
542 |
switch (p->task) { |
switch (s->task) { |
543 |
|
|
544 |
case TASK_DEVICE: |
case TASK_DEVICE: |
545 |
do_task_device(req, res, p); |
do_task_device(req, res, s); |
546 |
break; |
break; |
547 |
|
|
548 |
case TASK_DIRECTORY: |
case TASK_DIRECTORY: |
549 |
do_task_directory(req, res, p); |
do_task_directory(req, res, s); |
550 |
break; |
break; |
551 |
|
|
552 |
case TASK_FILE: |
case TASK_FILE: |
553 |
do_task_file(req, res, p); |
do_task_file(req, res, s); |
554 |
break; |
break; |
555 |
|
|
556 |
case TASK_PROCESS: |
case TASK_PROCESS: |
557 |
do_task_process(req, res, p); |
do_task_process(req, res, s); |
558 |
break; |
break; |
559 |
|
|
560 |
default: |
default: |
567 |
} |
} |
568 |
|
|
569 |
|
|
570 |
static void print_status(Process_T p, HttpResponse res) { |
static void print_status(Service_T s, HttpResponse res) { |
571 |
|
|
572 |
pid_t pid= -1; |
pid_t pid= -1; |
573 |
FILE *out= res->outputstream; |
FILE *out= res->outputstream; |
575 |
|
|
576 |
res->is_committed= TRUE; |
res->is_committed= TRUE; |
577 |
|
|
578 |
switch(p->task) { |
switch(s->task) { |
579 |
|
|
580 |
case TASK_PROCESS: |
case TASK_PROCESS: |
581 |
|
|
582 |
if((pid= is_process_running(p))) { |
if((pid= is_process_running(s))) { |
583 |
|
|
584 |
char *uptime= get_process_uptime(p->path); |
char *uptime= get_process_uptime(s->path); |
585 |
char buf[STRLEN]; |
char buf[STRLEN]; |
586 |
ProcInfo_T pi= p->procinfo; |
ProcInfo_T pi= s->procinfo; |
587 |
|
|
588 |
if ( Run.doprocess ) { |
if ( Run.doprocess ) { |
589 |
|
|
590 |
sprintf(buf, |
sprintf(buf, |
591 |
"Process '%s' is running with pid [%d]\n\tUptime: %s " |
"Process '%s' is running with pid [%d]\n\tUptime: %s " |
592 |
"CPU: %.1f%% Memory w/o children: %.1f%% [%ldkB]\n" |
"CPU: %.1f%% Memory w/o children: %.1f%% [%ldkB]\n" |
593 |
"\tChildren: %i Memory w/ children: %.1f%% [%ldkB]\n" |
"\tChildren: %i Memory w/ children: %.1f%% [%ldkB]\n" |
594 |
"\tMonitoring status: %s\n", |
"\tMonitoring status: %s\n", |
595 |
p->name, (int)pid, uptime, pi->cpu_percent/10.0, |
s->name, (int)pid, uptime, pi->cpu_percent/10.0, |
596 |
pi->mem_percent/10.0,pi->mem_kbyte, |
pi->mem_percent/10.0,pi->mem_kbyte, |
597 |
pi->children,pi->total_mem_percent/10.0,pi->total_mem_kbyte, |
pi->children,pi->total_mem_percent/10.0,pi->total_mem_kbyte, |
598 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
599 |
|
|
600 |
} else { |
} else { |
601 |
|
|
602 |
sprintf(buf, |
sprintf(buf, |
603 |
"Process '%s' is running with pid [%d]\n\tUptime: %s " |
"Process '%s' is running with pid [%d]\n\tUptime: %s " |
604 |
"\tMonitoring status: %s\n", |
"\tMonitoring status: %s\n", |
605 |
p->name, (int)pid, uptime,statusnames[p->do_validate]); |
s->name, (int)pid, uptime,statusnames[s->do_validate]); |
606 |
|
|
607 |
} |
} |
608 |
|
|
622 |
|
|
623 |
if( Run.httpdssl ) { |
if( Run.httpdssl ) { |
624 |
|
|
625 |
printf_ssl_socket(res->ssl, "Process '%s' is not running\n", p->name); |
printf_ssl_socket(res->ssl, "Process '%s' is not running\n", s->name); |
626 |
|
|
627 |
} else { |
} else { |
628 |
|
|
629 |
fprintf(out, "Process '%s' is not running\n", p->name); |
fprintf(out, "Process '%s' is not running\n", s->name); |
630 |
|
|
631 |
} |
} |
632 |
|
|
634 |
break; |
break; |
635 |
|
|
636 |
case TASK_DEVICE: |
case TASK_DEVICE: |
637 |
if(get_fsusage(p->path, p->devinfo)) { |
if(get_fsusage(s->path, s->devinfo)) { |
638 |
|
|
639 |
if(p->devinfo->f_files > 0) { |
if(s->devinfo->f_files > 0) { |
640 |
|
|
641 |
if( Run.httpdssl ) { |
if( Run.httpdssl ) { |
642 |
|
|
643 |
printf_ssl_socket(res->ssl, "Device '%s' is accessible\n\t" |
printf_ssl_socket(res->ssl, "Device '%s' is accessible\n\t" |
644 |
"Space: %.1f%% [%.1f MB] Inodes: %.1f%% [%ld objects]\n\t" |
"Space: %.1f%% [%.1f MB] Inodes: %.1f%% [%ld objects]\n\t" |
645 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
646 |
p->name, |
s->name, |
647 |
(float) 100 * (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / p->devinfo->f_blocks, |
(float) 100 * (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / s->devinfo->f_blocks, |
648 |
(float) (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / 1048576 * p->devinfo->f_bsize, |
(float) (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / 1048576 * s->devinfo->f_bsize, |
649 |
(float) 100 * (p->devinfo->f_files - p->devinfo->f_filesfree) / p->devinfo->f_files, |
(float) 100 * (s->devinfo->f_files - s->devinfo->f_filesfree) / s->devinfo->f_files, |
650 |
p->devinfo->f_files - p->devinfo->f_filesfree, |
s->devinfo->f_files - s->devinfo->f_filesfree, |
651 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
652 |
|
|
653 |
} else { |
} else { |
654 |
|
|
655 |
fprintf(out, "Device '%s' is accessible\n\t" |
fprintf(out, "Device '%s' is accessible\n\t" |
656 |
"Space: %.1f%% [%.1f MB] Inodes: %.1f%% [%ld objects]\n\t" |
"Space: %.1f%% [%.1f MB] Inodes: %.1f%% [%ld objects]\n\t" |
657 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
658 |
p->name, |
s->name, |
659 |
(float) 100 * (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / p->devinfo->f_blocks, |
(float) 100 * (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / s->devinfo->f_blocks, |
660 |
(float) (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / 1048576 * p->devinfo->f_bsize, |
(float) (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / 1048576 * s->devinfo->f_bsize, |
661 |
(float) 100 * (p->devinfo->f_files - p->devinfo->f_filesfree) / p->devinfo->f_files, |
(float) 100 * (s->devinfo->f_files - s->devinfo->f_filesfree) / s->devinfo->f_files, |
662 |
p->devinfo->f_files - p->devinfo->f_filesfree, |
s->devinfo->f_files - s->devinfo->f_filesfree, |
663 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
664 |
|
|
665 |
} |
} |
666 |
|
|
671 |
printf_ssl_socket(res->ssl, "Device '%s' is accessible\n\t" |
printf_ssl_socket(res->ssl, "Device '%s' is accessible\n\t" |
672 |
"Space: %.1f%% [%.1f MB]\n\t" |
"Space: %.1f%% [%.1f MB]\n\t" |
673 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
674 |
p->name, |
s->name, |
675 |
(float) 100 * (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / p->devinfo->f_blocks, |
(float) 100 * (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / s->devinfo->f_blocks, |
676 |
(float) (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / 1048576 * p->devinfo->f_bsize, |
(float) (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / 1048576 * s->devinfo->f_bsize, |
677 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
678 |
|
|
679 |
} else { |
} else { |
680 |
|
|
681 |
fprintf(out, "Device '%s' is accessible\n\t" |
fprintf(out, "Device '%s' is accessible\n\t" |
682 |
"Space: %.1f%% [%.1f MB]\n\t" |
"Space: %.1f%% [%.1f MB]\n\t" |
683 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
684 |
p->name, |
s->name, |
685 |
(float) 100 * (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / p->devinfo->f_blocks, |
(float) 100 * (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / s->devinfo->f_blocks, |
686 |
(float) (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / 1048576 * p->devinfo->f_bsize, |
(float) (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / 1048576 * s->devinfo->f_bsize, |
687 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
688 |
|
|
689 |
} |
} |
690 |
|
|
697 |
printf_ssl_socket(res->ssl, "Device '%s' is not accessible\n\t" |
printf_ssl_socket(res->ssl, "Device '%s' is not accessible\n\t" |
698 |
"Space: - Inodes: -\n\t" |
"Space: - Inodes: -\n\t" |
699 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
700 |
p->name, statusnames[p->do_validate]); |
s->name, statusnames[s->do_validate]); |
701 |
|
|
702 |
} else { |
} else { |
703 |
|
|
704 |
fprintf(out, "Device '%s' is not accessible\n\t" |
fprintf(out, "Device '%s' is not accessible\n\t" |
705 |
"Space: - Inodes: -\n\t" |
"Space: - Inodes: -\n\t" |
706 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
707 |
p->name, statusnames[p->do_validate]); |
s->name, statusnames[s->do_validate]); |
708 |
|
|
709 |
} |
} |
710 |
|
|
713 |
break; |
break; |
714 |
|
|
715 |
case TASK_FILE: |
case TASK_FILE: |
716 |
if( (stat(p->path, &stat_buf) == 0) && S_ISREG(stat_buf.st_mode) ) { |
if( (stat(s->path, &stat_buf) == 0) && S_ISREG(stat_buf.st_mode) ) { |
717 |
if( Run.httpdssl ) { |
if( Run.httpdssl ) { |
718 |
|
|
719 |
printf_ssl_socket(res->ssl, |
printf_ssl_socket(res->ssl, |
720 |
"File '%s' exist\n\t" |
"File '%s' exist\n\t" |
721 |
"Size: %.3f MB UID: %d GID: %d Permission: %o\n\t" |
"Size: %.3f MB UID: %d GID: %d Permission: %o\n\t" |
722 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
723 |
p->name, |
s->name, |
724 |
(float) stat_buf.st_size / 1048576, (int)stat_buf.st_uid, |
(float) stat_buf.st_size / 1048576, (int)stat_buf.st_uid, |
725 |
(int)stat_buf.st_gid, (int)(stat_buf.st_mode & 07777), |
(int)stat_buf.st_gid, (int)(stat_buf.st_mode & 07777), |
726 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
727 |
|
|
728 |
} else { |
} else { |
729 |
|
|
731 |
"File '%s' exist\n\t" |
"File '%s' exist\n\t" |
732 |
"Size: %.3f MB UID: %d GID: %d Permission: %o\n\t" |
"Size: %.3f MB UID: %d GID: %d Permission: %o\n\t" |
733 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
734 |
p->name, |
s->name, |
735 |
(float) stat_buf.st_size / 1048576, (int)stat_buf.st_uid, |
(float) stat_buf.st_size / 1048576, (int)stat_buf.st_uid, |
736 |
(int)stat_buf.st_gid, (int)(stat_buf.st_mode & 07777), |
(int)stat_buf.st_gid, (int)(stat_buf.st_mode & 07777), |
737 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
738 |
|
|
739 |
} |
} |
740 |
} else { |
} else { |
741 |
if( Run.httpdssl ) { |
if( Run.httpdssl ) { |
742 |
|
|
743 |
printf_ssl_socket(res->ssl, "File '%s' doesn't exist\n\tMonitoring status: %s\n", |
printf_ssl_socket(res->ssl, "File '%s' doesn't exist\n\tMonitoring status: %s\n", |
744 |
p->name, statusnames[p->do_validate]); |
s->name, statusnames[s->do_validate]); |
745 |
|
|
746 |
} else { |
} else { |
747 |
|
|
748 |
fprintf(out, "File '%s' doesn't exist\n\tMonitoring status: %s\n", |
fprintf(out, "File '%s' doesn't exist\n\tMonitoring status: %s\n", |
749 |
p->name, statusnames[p->do_validate]); |
s->name, statusnames[s->do_validate]); |
750 |
|
|
751 |
} |
} |
752 |
} |
} |
753 |
break; |
break; |
754 |
|
|
755 |
case TASK_DIRECTORY: |
case TASK_DIRECTORY: |
756 |
if( (stat(p->path, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode) ) { |
if( (stat(s->path, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode) ) { |
757 |
if( Run.httpdssl ) { |
if( Run.httpdssl ) { |
758 |
|
|
759 |
printf_ssl_socket(res->ssl, |
printf_ssl_socket(res->ssl, |
760 |
"Directory '%s' exist\n\t" |
"Directory '%s' exist\n\t" |
761 |
"UID: %d GID: %d Permission: %o\n\t" |
"UID: %d GID: %d Permission: %o\n\t" |
762 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
763 |
p->name, |
s->name, |
764 |
(int)stat_buf.st_uid, (int)stat_buf.st_gid, (int)(stat_buf.st_mode & 07777), |
(int)stat_buf.st_uid, (int)stat_buf.st_gid, (int)(stat_buf.st_mode & 07777), |
765 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
766 |
|
|
767 |
} else { |
} else { |
768 |
|
|
770 |
"Directory '%s' exist\n\t" |
"Directory '%s' exist\n\t" |
771 |
"UID: %d GID: %d Permission: %o\n\t" |
"UID: %d GID: %d Permission: %o\n\t" |
772 |
"Monitoring status: %s\n", |
"Monitoring status: %s\n", |
773 |
p->name, |
s->name, |
774 |
(int)stat_buf.st_uid, (int)stat_buf.st_gid, (int)(stat_buf.st_mode & 07777), |
(int)stat_buf.st_uid, (int)stat_buf.st_gid, (int)(stat_buf.st_mode & 07777), |
775 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
776 |
|
|
777 |
} |
} |
778 |
} else { |
} else { |
779 |
if( Run.httpdssl ) { |
if( Run.httpdssl ) { |
780 |
|
|
781 |
printf_ssl_socket(res->ssl, "Directory '%s' doesn't exist\n\tMonitoring status: %s\n", |
printf_ssl_socket(res->ssl, "Directory '%s' doesn't exist\n\tMonitoring status: %s\n", |
782 |
p->name, statusnames[p->do_validate]); |
s->name, statusnames[s->do_validate]); |
783 |
|
|
784 |
} else { |
} else { |
785 |
|
|
786 |
fprintf(out, "Directory '%s' doesn't exist\n\tMonitoring status: %s\n", |
fprintf(out, "Directory '%s' doesn't exist\n\tMonitoring status: %s\n", |
787 |
p->name, statusnames[p->do_validate]); |
s->name, statusnames[s->do_validate]); |
788 |
|
|
789 |
} |
} |
790 |
} |
} |
854 |
|
|
855 |
int on= TRUE; |
int on= TRUE; |
856 |
int header= TRUE; |
int header= TRUE; |
857 |
Process_T p; |
Service_T s; |
858 |
|
|
859 |
for (p= processlist; p; p= p->next) { |
for(s= servicelist; s; s= s->next) { |
860 |
|
|
861 |
int isrunning; |
int isrunning; |
862 |
char *uptime; |
char *uptime; |
863 |
|
|
864 |
if(p->task != TASK_PROCESS) continue; |
if(s->task != TASK_PROCESS) continue; |
865 |
|
|
866 |
if(header) { |
if(header) { |
867 |
|
|
895 |
|
|
896 |
} |
} |
897 |
|
|
898 |
isrunning= is_process_running(p); |
isrunning= is_process_running(s); |
899 |
uptime= get_process_uptime(p->path); |
uptime= get_process_uptime(s->path); |
900 |
|
|
901 |
if ( Run.doprocess ) { |
if(Run.doprocess) { |
902 |
ProcInfo_T pi= p->procinfo; |
ProcInfo_T pi= s->procinfo; |
903 |
if ( isrunning ) { |
if(isrunning) { |
904 |
out_print(res, |
out_print(res, |
905 |
"<tr %s>" |
"<tr %s>" |
906 |
"<td width=\"20%\"><a href='/%s'>%s</a></td>" |
"<td width=\"20%\"><a href='/%s'>%s</a></td>" |
908 |
"<td align=\"right\">%.1f%%</td>" |
"<td align=\"right\">%.1f%%</td>" |
909 |
"<td align=\"right\">%.1f%% [%ldkB]</td></tr>", |
"<td align=\"right\">%.1f%% [%ldkB]</td></tr>", |
910 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
911 |
p->name, p->name, |
s->name, s->name, |
912 |
p->has_checksum_error? |
s->has_checksum_error? |
913 |
"<font color='#ff0000'>Cheksum Error</font>": |
"<font color='#ff0000'>Cheksum Error</font>": |
914 |
isrunning? |
isrunning? |
915 |
"<font color=green>running</font>": |
"<font color=green>running</font>": |
927 |
"<td align=\"right\">- </td>" |
"<td align=\"right\">- </td>" |
928 |
"<td align=\"right\">- [-]</td></tr>", |
"<td align=\"right\">- [-]</td></tr>", |
929 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
930 |
p->name, p->name, |
s->name, s->name, |
931 |
p->has_checksum_error? |
s->has_checksum_error? |
932 |
"<font color='#ff0000'>Cheksum Error</font>": |
"<font color='#ff0000'>Cheksum Error</font>": |
933 |
"<font color=red>not running</font>" |
"<font color=red>not running</font>" |
934 |
); |
); |
940 |
"<td align=\"left\">%s %s</td>" |
"<td align=\"left\">%s %s</td>" |
941 |
"</tr>", |
"</tr>", |
942 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
943 |
p->name, p->name, |
s->name, s->name, |
944 |
p->has_checksum_error? |
s->has_checksum_error? |
945 |
"<font color='#ff0000'>Cheksum Error</font>": |
"<font color='#ff0000'>Cheksum Error</font>": |
946 |
isrunning? |
isrunning? |
947 |
"<font color=green>running</font>": |
"<font color=green>running</font>": |
961 |
|
|
962 |
static void do_home_device(HttpRequest req, HttpResponse res) { |
static void do_home_device(HttpRequest req, HttpResponse res) { |
963 |
|
|
964 |
|
Service_T s; |
965 |
int on= TRUE; |
int on= TRUE; |
966 |
int header= TRUE; |
int header= TRUE; |
|
Process_T p; |
|
967 |
|
|
968 |
for (p= processlist; p; p= p->next) { |
for(s= servicelist; s; s= s->next) { |
969 |
|
|
970 |
if(p->task != TASK_DEVICE) continue; |
if(s->task != TASK_DEVICE) continue; |
971 |
|
|
972 |
if(header) { |
if(header) { |
973 |
|
|
986 |
|
|
987 |
} |
} |
988 |
|
|
989 |
if(!get_fsusage(p->path, p->devinfo)) { |
if(!get_fsusage(s->path, s->devinfo)) { |
990 |
|
|
991 |
out_print(res, |
out_print(res, |
992 |
"<tr %s>" |
"<tr %s>" |
996 |
"<td align=\"right\">- [-]</td>" |
"<td align=\"right\">- [-]</td>" |
997 |
"</tr>", |
"</tr>", |
998 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
999 |
p->name, p->name); |
s->name, s->name); |
1000 |
|
|
1001 |
} else { |
} else { |
1002 |
|
|
1003 |
if(p->devinfo->f_files > 0) { |
if(s->devinfo->f_files > 0) { |
1004 |
|
|
1005 |
out_print(res, |
out_print(res, |
1006 |
"<tr %s>" |
"<tr %s>" |
1010 |
"<td align=\"right\">%.1f%% [%ld objects]</td>" |
"<td align=\"right\">%.1f%% [%ld objects]</td>" |
1011 |
"</tr>", |
"</tr>", |
1012 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
1013 |
p->name, p->name, |
s->name, s->name, |
1014 |
(float) 100 * (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / p->devinfo->f_blocks, |
(float) 100 * (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / s->devinfo->f_blocks, |
1015 |
(float) (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / 1048576 * p->devinfo->f_bsize, |
(float) (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / 1048576 * s->devinfo->f_bsize, |
1016 |
(float) 100 * (p->devinfo->f_files - p->devinfo->f_filesfree) / p->devinfo->f_files, |
(float) 100 * (s->devinfo->f_files - s->devinfo->f_filesfree) / s->devinfo->f_files, |
1017 |
p->devinfo->f_files - p->devinfo->f_filesfree); |
s->devinfo->f_files - s->devinfo->f_filesfree); |
1018 |
|
|
1019 |
} else { |
} else { |
1020 |
|
|
1026 |
"<td align=\"right\"><font color=red>not supported by filesystem</font></td>" |
"<td align=\"right\"><font color=red>not supported by filesystem</font></td>" |
1027 |
"</tr>", |
"</tr>", |
1028 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
1029 |
p->name, p->name, |
s->name, s->name, |
1030 |
(float) 100 * (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / p->devinfo->f_blocks, |
(float) 100 * (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / s->devinfo->f_blocks, |
1031 |
(float) (p->devinfo->f_blocks - p->devinfo->f_blocksfree) / 1048576 * p->devinfo->f_bsize); |
(float) (s->devinfo->f_blocks - s->devinfo->f_blocksfree) / 1048576 * s->devinfo->f_bsize); |
1032 |
|
|
1033 |
} |
} |
1034 |
} |
} |
1044 |
|
|
1045 |
static void do_home_file(HttpRequest req, HttpResponse res) { |
static void do_home_file(HttpRequest req, HttpResponse res) { |
1046 |
|
|
1047 |
|
Service_T s; |
1048 |
int on= TRUE; |
int on= TRUE; |
1049 |
int header= TRUE; |
int header= TRUE; |
|
Process_T p; |
|
1050 |
struct stat stat_buf; |
struct stat stat_buf; |
1051 |
|
|
1052 |
for (p= processlist; p; p= p->next) { |
for(s= servicelist; s; s= s->next) { |
1053 |
|
|
1054 |
if(p->task != TASK_FILE) continue; |
if(s->task != TASK_FILE) continue; |
1055 |
|
|
1056 |
if(header) { |
if(header) { |
1057 |
|
|
1072 |
|
|
1073 |
} |
} |
1074 |
|
|
1075 |
if( (stat(p->path, &stat_buf) != 0) || !S_ISREG(stat_buf.st_mode) ) { |
if((stat(s->path, &stat_buf) != 0) || !S_ISREG(stat_buf.st_mode) ) { |
1076 |
|
|
1077 |
out_print(res, |
out_print(res, |
1078 |
"<tr %s>" |
"<tr %s>" |
1084 |
"<td align=\"right\">-</td>" |
"<td align=\"right\">-</td>" |
1085 |
"</tr>", |
"</tr>", |
1086 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
1087 |
p->name, p->name |
s->name, s->name |
1088 |
); |
); |
1089 |
|
|
1090 |
} else { |
} else { |
1099 |
"<td align=\"right\">%d</td>" |
"<td align=\"right\">%d</td>" |
1100 |
"</tr>", |
"</tr>", |
1101 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
1102 |
p->name, p->name, |
s->name, s->name, |
1103 |
(float) stat_buf.st_size / 1048576, |
(float) stat_buf.st_size / 1048576, |
1104 |
stat_buf.st_mode & 07777, |
stat_buf.st_mode & 07777, |
1105 |
stat_buf.st_uid, |
stat_buf.st_uid, |
1119 |
|
|
1120 |
static void do_home_directory(HttpRequest req, HttpResponse res) { |
static void do_home_directory(HttpRequest req, HttpResponse res) { |
1121 |
|
|
1122 |
|
Service_T s; |
1123 |
int on= TRUE; |
int on= TRUE; |
1124 |
int header= TRUE; |
int header= TRUE; |
|
Process_T p; |
|
1125 |
struct stat stat_buf; |
struct stat stat_buf; |
1126 |
|
|
1127 |
for (p= processlist; p; p= p->next) { |
for(s= servicelist; s; s= s->next) { |
1128 |
|
|
1129 |
if(p->task != TASK_DIRECTORY) continue; |
if(s->task != TASK_DIRECTORY) continue; |
1130 |
|
|
1131 |
if(header) { |
if(header) { |
1132 |
|
|
1146 |
|
|
1147 |
} |
} |
1148 |
|
|
1149 |
if( (stat(p->path, &stat_buf) != 0) || !S_ISDIR(stat_buf.st_mode) ) { |
if( (stat(s->path, &stat_buf) != 0) || !S_ISDIR(stat_buf.st_mode) ) { |
1150 |
|
|
1151 |
out_print(res, |
out_print(res, |
1152 |
"<tr %s>" |
"<tr %s>" |
1157 |
"<td align=\"right\">-</td>" |
"<td align=\"right\">-</td>" |
1158 |
"</tr>", |
"</tr>", |
1159 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
1160 |
p->name, p->name |
s->name, s->name |
1161 |
); |
); |
1162 |
|
|
1163 |
} else { |
} else { |
1171 |
"<td align=\"right\">%d</td>" |
"<td align=\"right\">%d</td>" |
1172 |
"</tr>", |
"</tr>", |
1173 |
on?"bgcolor=\"#EFEFEF\"":"", |
on?"bgcolor=\"#EFEFEF\"":"", |
1174 |
p->name, p->name, |
s->name, s->name, |
1175 |
stat_buf.st_mode & 07777, |
stat_buf.st_mode & 07777, |
1176 |
stat_buf.st_uid, |
stat_buf.st_uid, |
1177 |
stat_buf.st_gid |
stat_buf.st_gid |
1188 |
} |
} |
1189 |
|
|
1190 |
|
|
1191 |
static void do_task_device(HttpRequest req, HttpResponse res, Process_T p) { |
static void do_task_device(HttpRequest req, HttpResponse res, Service_T s) { |
1192 |
|
|
1193 |
int state= get_fsusage(p->path, p->devinfo); |
int state= get_fsusage(s->path, s->devinfo); |
1194 |
|
|
1195 |
out_print(res, |
out_print(res, |
1196 |
"<p><br><h3>Device status</h3><br>"); |
"<p><br><h3>Device status</h3><br>"); |
1197 |
out_print(res,"<table cellspacing=0 cellpadding=3 border=1 width=\"90%\">" |
out_print(res,"<table cellspacing=0 cellpadding=3 border=1 width=\"90%\">" |
1198 |
"<tr><td width=\"30%\"><b>Parameter</b></td><td width=\"70%\"><b>Value</b></td></tr>"); |
"<tr><td width=\"30%\"><b>Parameter</b></td><td width=\"70%\"><b>Value</b></td></tr>"); |
1199 |
out_print(res, |
out_print(res, |
1200 |
"<tr><td>Name</a></td><td>%s</td></tr>", p->name); |
"<tr><td>Name</a></td><td>%s</td></tr>", s->name); |
1201 |
out_print(res, |
out_print(res, |
1202 |
"<tr><td>Group</a></td><td><font color='#0000ff'>%s</font></td></tr>", |
"<tr><td>Group</a></td><td><font color='#0000ff'>%s</font></td></tr>", |
1203 |
p->group?p->group:"(not defined)"); |
s->group?s->group:"(not defined)"); |
1204 |
out_print(res, |
out_print(res, |
1205 |
"<tr><td>Device status</a></td><td>%s</td></tr>", |
"<tr><td>Device status</a></td><td>%s</td></tr>", |
1206 |
state?"<font color='#00ff00'>Accessible</font>": |
state?"<font color='#00ff00'>Accessible</font>": |
1207 |
"<font color='#ff0000'>Not Accessible</font>"); |
"<font color='#ff0000'>Not Accessible</font>"); |
1208 |
out_print(res, |
out_print(res, |
1209 |
"<tr><td>Path</a></td><td>%s</td></tr>", |
"<tr><td>Path</a></td><td>%s</td></tr>", |
1210 |
p->path); |
s->path); |
1211 |
out_print(res, |
out_print(res, |
1212 |
"<tr><td>Monitoring mode</a></td><td>%s</td></tr>", |
"<tr><td>Monitoring mode</a></td><td>%s</td></tr>", |
1213 |
modenames[p->mode]); |
modenames[s->mode]); |
1214 |
out_print(res, |
out_print(res, |
1215 |
"<tr><td>Monitoring status</a></td><td>%s</td></tr>", |
"<tr><td>Monitoring status</a></td><td>%s</td></tr>", |
1216 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
1217 |
if(p->start) { |
if(s->start) { |
1218 |
int i = 0; |
int i = 0; |
1219 |
|
|
1220 |
out_print(res, "<tr><td>Start program</a></td><td>"); |
out_print(res, "<tr><td>Start program</a></td><td>"); |
1221 |
while(p->start->arg[i]) |
while(s->start->arg[i]) |
1222 |
out_print(res, "%s ", p->start->arg[i++]); |
out_print(res, "%s ", s->start->arg[i++]); |
1223 |
printf("</td></tr>"); |
printf("</td></tr>"); |
1224 |
} else { |
} else { |
1225 |
out_print(res, |
out_print(res, |
1226 |
"<tr><td>Start program</a></td><td>(not defined)</td></tr>"); |
"<tr><td>Start program</a></td><td>(not defined)</td></tr>"); |
1227 |
} |
} |
1228 |
if(p->stop) { |
if(s->stop) { |
1229 |
int i = 0; |
int i = 0; |
1230 |
|
|
1231 |
out_print(res, "<tr><td>Stop program</a></td><td>"); |
out_print(res, "<tr><td>Stop program</a></td><td>"); |
1232 |
while(p->stop->arg[i]) |
while(s->stop->arg[i]) |
1233 |
out_print(res, "%s ", p->stop->arg[i++]); |
out_print(res, "%s ", s->stop->arg[i++]); |
1234 |
printf("</td></tr>"); |
printf("</td></tr>"); |
1235 |
} else { |
} else { |
1236 |
out_print(res, |
out_print(res, |
1239 |
{ |
{ |
1240 |
Dependant_T d; |
Dependant_T d; |
1241 |
|
|
1242 |
for(d= p->dependantlist; d; d= d->next) { |
for(d= s->dependantlist; d; d= d->next) { |
1243 |
if(d->dependant != NULL) { |
if(d->dependant != NULL) { |
1244 |
out_print(res,"<tr><td>Depends on Task </a></td>" |
out_print(res,"<tr><td>Depends on Task </a></td>" |
1245 |
"<td> <a href=%s> %s </a></td></tr>", |
"<td> <a href=%s> %s </a></td></tr>", |
1250 |
|
|
1251 |
out_print(res, |
out_print(res, |
1252 |
"<tr><td>Check task</a></td><td>Every %d cycle</td></tr>", |
"<tr><td>Check task</a></td><td>Every %d cycle</td></tr>", |
1253 |
p->every?p->every:1); |
s->every?s->every:1); |
1254 |
out_print(res, |
out_print(res, |
1255 |
"<tr><td>Timeout</a></td><td>Timeout if %d restart within %d cycles" |
"<tr><td>Timeout</a></td><td>Timeout if %d restart within %d cycles" |
1256 |
"</td></tr>", p->to_start, p->to_cycle); |
"</td></tr>", s->to_start, s->to_cycle); |
1257 |
{ |
{ |
1258 |
|
|
1259 |
Device_T dl; |
Device_T dl; |
1260 |
|
|
1261 |
if(p->devicelist) { |
if(s->devicelist) { |
1262 |
|
|
1263 |
for(dl= p->devicelist; dl; dl= dl->next) { |
for(dl= s->devicelist; dl; dl= dl->next) { |
1264 |
|
|
1265 |
if(dl->resource == RESOURCE_INODE) { |
if(dl->resource == RESOURCE_INODE) { |
1266 |
|
|
1289 |
if(state) { |
if(state) { |
1290 |
out_print(res, |
out_print(res, |
1291 |
"<tr><td>Blocks total</a></td><td>%ld [%.1f MB]</td></tr>", |
"<tr><td>Blocks total</a></td><td>%ld [%.1f MB]</td></tr>", |
1292 |
p->devinfo->f_blocks, |
s->devinfo->f_blocks, |
1293 |
(float) p->devinfo->f_blocks / 1048576 * p->devinfo->f_bsize); |
(float) s->devinfo->f_blocks / 1048576 * s->devinfo->f_bsize); |
1294 |
out_print(res, |
out_print(res, |
1295 |
"<tr><td>Blocks free for non superuser</a></td><td>%ld [%.1f MB] [%.1f%%]</font></td></tr>", |
"<tr><td>Blocks free for non superuser</a></td><td>%ld [%.1f MB] [%.1f%%]</font></td></tr>", |
1296 |
p->devinfo->f_blocksfree, |
s->devinfo->f_blocksfree, |
1297 |
(float) p->devinfo->f_blocksfree / 1048576 * p->devinfo->f_bsize, |
(float) s->devinfo->f_blocksfree / 1048576 * s->devinfo->f_bsize, |
1298 |
(float) 100 * p->devinfo->f_blocksfree / p->devinfo->f_blocks); |
(float) 100 * s->devinfo->f_blocksfree / s->devinfo->f_blocks); |
1299 |
out_print(res, |
out_print(res, |
1300 |
"<tr><td>Blocks free total</a></td><td>%ld [%.1f MB] [%.1f%%]</td></tr>", |
"<tr><td>Blocks free total</a></td><td>%ld [%.1f MB] [%.1f%%]</td></tr>", |
1301 |
p->devinfo->f_blocksfreetotal, |
s->devinfo->f_blocksfreetotal, |
1302 |
(float) p->devinfo->f_blocksfreetotal / 1048576 * p->devinfo->f_bsize, |
(float) s->devinfo->f_blocksfreetotal / 1048576 * s->devinfo->f_bsize, |
1303 |
(float) 100 * p->devinfo->f_blocksfreetotal / p->devinfo->f_blocks); |
(float) 100 * s->devinfo->f_blocksfreetotal / s->devinfo->f_blocks); |
1304 |
out_print(res, |
out_print(res, |
1305 |
"<tr><td>Block size</a></td><td>%ld B</td></tr>", |
"<tr><td>Block size</a></td><td>%ld B</td></tr>", |
1306 |
p->devinfo->f_bsize); |
s->devinfo->f_bsize); |
1307 |
if(p->devinfo->f_files > 0) { |
if(s->devinfo->f_files > 0) { |
1308 |
out_print(res, |
out_print(res, |
1309 |
"<tr><td>Inodes total</a></td><td>%ld</td></tr>", |
"<tr><td>Inodes total</a></td><td>%ld</td></tr>", |
1310 |
p->devinfo->f_files); |
s->devinfo->f_files); |
1311 |
out_print(res, |
out_print(res, |
1312 |
"<tr><td>Inodes free</a></td><td>%ld [%.1f%%]</font></td></tr>", |
"<tr><td>Inodes free</a></td><td>%ld [%.1f%%]</font></td></tr>", |
1313 |
p->devinfo->f_filesfree, |
s->devinfo->f_filesfree, |
1314 |
(float) 100 * p->devinfo->f_filesfree / p->devinfo->f_files); |
(float) 100 * s->devinfo->f_filesfree / s->devinfo->f_files); |
1315 |
} |
} |
1316 |
} else { |
} else { |
1317 |
out_print(res, |
out_print(res, |
1330 |
} |
} |
1331 |
{ |
{ |
1332 |
Mail_T r; |
Mail_T r; |
1333 |
for(r= p->maillist; r; r= r->next) { |
for(r= s->maillist; r; r= r->next) { |
1334 |
out_print(res, |
out_print(res, |
1335 |
"<tr bgcolor=\"#EFEFEF\"><td>Alert mail to</a></td><td>%s</td></tr>", |
"<tr bgcolor=\"#EFEFEF\"><td>Alert mail to</a></td><td>%s</td></tr>", |
1336 |
r->to?r->to:""); |
r->to?r->to:""); |
1366 |
out_print(res, "</table>"); |
out_print(res, "</table>"); |
1367 |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
1368 |
/* Start program */ |
/* Start program */ |
1369 |
if(p->start) |
if(s->start) |
1370 |
out_print(res, |
out_print(res, |
1371 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1372 |
"<input type=hidden value='start' name=action>" |
"<input type=hidden value='start' name=action>" |
1373 |
"<input type=submit value='Start program' style='font-size: 12pt'></font>" |
"<input type=submit value='Start program' style='font-size: 12pt'></font>" |
1374 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1375 |
/* Stop program */ |
/* Stop program */ |
1376 |
if(p->stop) |
if(s->stop) |
1377 |
out_print(res, |
out_print(res, |
1378 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1379 |
"<input type=hidden value='stop' name=action>" |
"<input type=hidden value='stop' name=action>" |
1380 |
"<input type=submit value='Stop program' style='font-size: 12pt'></font>" |
"<input type=submit value='Stop program' style='font-size: 12pt'></font>" |
1381 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1382 |
if(p->start && p->stop) |
if(s->start && s->stop) |
1383 |
out_print(res, |
out_print(res, |
1384 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1385 |
"<input type=hidden value='restart' name=action>" |
"<input type=hidden value='restart' name=action>" |
1386 |
"<input type=submit value='Restart program' style='font-size: 12pt'></font>" |
"<input type=submit value='Restart program' style='font-size: 12pt'></font>" |
1387 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1388 |
out_print(res, "</tr></table>"); |
out_print(res, "</tr></table>"); |
1389 |
|
|
1390 |
} |
} |
1391 |
|
|
1392 |
|
|
1393 |
static void do_task_directory(HttpRequest req, HttpResponse res, Process_T p) { |
static void do_task_directory(HttpRequest req, HttpResponse res, Service_T s) { |
1394 |
|
|
1395 |
struct stat stat_buf; |
struct stat stat_buf; |
1396 |
int state= ( (stat(p->path, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode) ); |
int state= ( (stat(s->path, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode) ); |
1397 |
|
|
1398 |
out_print(res, |
out_print(res, |
1399 |
"<p><br><h3>Directory status</h3><br>"); |
"<p><br><h3>Directory status</h3><br>"); |
1400 |
out_print(res,"<table cellspacing=0 cellpadding=3 border=1 width=\"90%\">" |
out_print(res,"<table cellspacing=0 cellpadding=3 border=1 width=\"90%\">" |
1401 |
"<tr><td width=\"30%\"><b>Parameter</b></td><td width=\"70%\"><b>Value</b></td></tr>"); |
"<tr><td width=\"30%\"><b>Parameter</b></td><td width=\"70%\"><b>Value</b></td></tr>"); |
1402 |
out_print(res, |
out_print(res, |
1403 |
"<tr><td>Name</a></td><td>%s</td></tr>", p->name); |
"<tr><td>Name</a></td><td>%s</td></tr>", s->name); |
1404 |
out_print(res, |
out_print(res, |
1405 |
"<tr><td>Group</a></td><td><font color='#0000ff'>%s</font></td></tr>", |
"<tr><td>Group</a></td><td><font color='#0000ff'>%s</font></td></tr>", |
1406 |
p->group?p->group:"(not defined)"); |
s->group?s->group:"(not defined)"); |
1407 |
out_print(res, |
out_print(res, |
1408 |
"<tr><td>Directory status</a></td><td>%s</td></tr>", |
"<tr><td>Directory status</a></td><td>%s</td></tr>", |
1409 |
state?"<font color='#00ff00'>Exist</font>": |
state?"<font color='#00ff00'>Exist</font>": |
1410 |
"<font color='#ff0000'>Doesn't Exist</font>"); |
"<font color='#ff0000'>Doesn't Exist</font>"); |
1411 |
out_print(res, |
out_print(res, |
1412 |
"<tr><td>Path</a></td><td>%s</td></tr>", |
"<tr><td>Path</a></td><td>%s</td></tr>", |
1413 |
p->path); |
s->path); |
1414 |
out_print(res, |
out_print(res, |
1415 |
"<tr><td>Monitoring mode</a></td><td>%s</td></tr>", |
"<tr><td>Monitoring mode</a></td><td>%s</td></tr>", |
1416 |
modenames[p->mode]); |
modenames[s->mode]); |
1417 |
out_print(res, |
out_print(res, |
1418 |
"<tr><td>Monitoring status</a></td><td>%s</td></tr>", |
"<tr><td>Monitoring status</a></td><td>%s</td></tr>", |
1419 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
1420 |
if(p->start) { |
if(s->start) { |
1421 |
int i = 0; |
int i = 0; |
1422 |
|
|
1423 |
out_print(res, "<tr><td>Start program</a></td><td>"); |
out_print(res, "<tr><td>Start program</a></td><td>"); |
1424 |
while(p->start->arg[i]) |
while(s->start->arg[i]) |
1425 |
out_print(res, "%s ", p->start->arg[i++]); |
out_print(res, "%s ", s->start->arg[i++]); |
1426 |
printf("</td></tr>"); |
printf("</td></tr>"); |
1427 |
} else { |
} else { |
1428 |
out_print(res, |
out_print(res, |
1429 |
"<tr><td>Start program</a></td><td>(not defined)</td></tr>"); |
"<tr><td>Start program</a></td><td>(not defined)</td></tr>"); |
1430 |
} |
} |
1431 |
if(p->stop) { |
if(s->stop) { |
1432 |
int i = 0; |
int i = 0; |
1433 |
|
|
1434 |
out_print(res, "<tr><td>Stop program</a></td><td>"); |
out_print(res, "<tr><td>Stop program</a></td><td>"); |
1435 |
while(p->stop->arg[i]) |
while(s->stop->arg[i]) |
1436 |
out_print(res, "%s ", p->stop->arg[i++]); |
out_print(res, "%s ", s->stop->arg[i++]); |
1437 |
printf("</td></tr>"); |
printf("</td></tr>"); |
1438 |
} else { |
} else { |
1439 |
out_print(res, |
out_print(res, |
1442 |
{ |
{ |
1443 |
Dependant_T d; |
Dependant_T d; |
1444 |
|
|
1445 |
for(d= p->dependantlist; d; d= d->next) { |
for(d= s->dependantlist; d; d= d->next) { |
1446 |
if(d->dependant != NULL) { |
if(d->dependant != NULL) { |
1447 |
out_print(res,"<tr><td>Depends on Task </a></td>" |
out_print(res,"<tr><td>Depends on Task </a></td>" |
1448 |
"<td> <a href=%s> %s </a></td></tr>", |
"<td> <a href=%s> %s </a></td></tr>", |
1452 |
} |
} |
1453 |
out_print(res, |
out_print(res, |
1454 |
"<tr><td>Check task</a></td><td>Every %d cycle</td></tr>", |
"<tr><td>Check task</a></td><td>Every %d cycle</td></tr>", |
1455 |
p->every?p->every:1); |
s->every?s->every:1); |
1456 |
out_print(res, |
out_print(res, |
1457 |
"<tr><td>Timeout</a></td><td>Timeout if %d restart within %d cycles" |
"<tr><td>Timeout</a></td><td>Timeout if %d restart within %d cycles" |
1458 |
"</td></tr>", p->to_start, p->to_cycle); |
"</td></tr>", s->to_start, s->to_cycle); |
1459 |
out_print(res, |
out_print(res, |
1460 |
"<tr><td>UID</a></td><td>%d</td></tr>", |
"<tr><td>UID</a></td><td>%d</td></tr>", |
1461 |
stat_buf.st_uid); |
stat_buf.st_uid); |
1462 |
out_print(res, |
out_print(res, |
1463 |
"<tr><td>GID</a></td><td>%d</td></tr>", |
"<tr><td>GID</a></td><td>%d</td></tr>", |
1464 |
stat_buf.st_gid); |
stat_buf.st_gid); |
1465 |
if(p->perm != -1) |
if(s->perm != -1) |
1466 |
out_print(res, "<tr><td>Associated permission</a></td><td>%o</td></tr>", p->perm); |
out_print(res, "<tr><td>Associated permission</a></td><td>%o</td></tr>", s->perm); |
1467 |
out_print(res, |
out_print(res, |
1468 |
"<tr><td>Permission</a></td><td>%o</td></tr>", |
"<tr><td>Permission</a></td><td>%o</td></tr>", |
1469 |
stat_buf.st_mode & 07777); |
stat_buf.st_mode & 07777); |
1470 |
{ |
{ |
1471 |
Mail_T r; |
Mail_T r; |
1472 |
for(r= p->maillist; r; r= r->next) { |
for(r= s->maillist; r; r= r->next) { |
1473 |
out_print(res, |
out_print(res, |
1474 |
"<tr bgcolor=\"#EFEFEF\"><td>Alert mail to</a></td><td>%s</td></tr>", |
"<tr bgcolor=\"#EFEFEF\"><td>Alert mail to</a></td><td>%s</td></tr>", |
1475 |
r->to?r->to:""); |
r->to?r->to:""); |
1505 |
out_print(res, "</table>"); |
out_print(res, "</table>"); |
1506 |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
1507 |
/* Start program */ |
/* Start program */ |
1508 |
if(p->start) |
if(s->start) |
1509 |
out_print(res, |
out_print(res, |
1510 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1511 |
"<input type=hidden value='start' name=action>" |
"<input type=hidden value='start' name=action>" |
1512 |
"<input type=submit value='Start program' style='font-size: 12pt'></font>" |
"<input type=submit value='Start program' style='font-size: 12pt'></font>" |
1513 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1514 |
/* Stop program */ |
/* Stop program */ |
1515 |
if(p->stop) |
if(s->stop) |
1516 |
out_print(res, |
out_print(res, |
1517 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1518 |
"<input type=hidden value='stop' name=action>" |
"<input type=hidden value='stop' name=action>" |
1519 |
"<input type=submit value='Stop program' style='font-size: 12pt'></font>" |
"<input type=submit value='Stop program' style='font-size: 12pt'></font>" |
1520 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1521 |
if(p->start && p->stop) |
if(s->start && s->stop) |
1522 |
out_print(res, |
out_print(res, |
1523 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1524 |
"<input type=hidden value='restart' name=action>" |
"<input type=hidden value='restart' name=action>" |
1525 |
"<input type=submit value='Restart program' style='font-size: 12pt'></font>" |
"<input type=submit value='Restart program' style='font-size: 12pt'></font>" |
1526 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1527 |
out_print(res, "</tr></table>"); |
out_print(res, "</tr></table>"); |
1528 |
|
|
1529 |
} |
} |
1530 |
|
|
1531 |
|
|
1532 |
static void do_task_file(HttpRequest req, HttpResponse res, Process_T p) { |
static void do_task_file(HttpRequest req, HttpResponse res, Service_T s) { |
1533 |
|
|
1534 |
struct stat stat_buf; |
struct stat stat_buf; |
1535 |
int state= ( (stat(p->path, &stat_buf) == 0) && S_ISREG(stat_buf.st_mode) ); |
int state= ( (stat(s->path, &stat_buf) == 0) && S_ISREG(stat_buf.st_mode) ); |
1536 |
|
|
1537 |
out_print(res, |
out_print(res, |
1538 |
"<p><br><h3>File status</h3><br>"); |
"<p><br><h3>File status</h3><br>"); |
1539 |
out_print(res,"<table cellspacing=0 cellpadding=3 border=1 width=\"90%\">" |
out_print(res,"<table cellspacing=0 cellpadding=3 border=1 width=\"90%\">" |
1540 |
"<tr><td width=\"30%\"><b>Parameter</b></td><td width=\"70%\"><b>Value</b></td></tr>"); |
"<tr><td width=\"30%\"><b>Parameter</b></td><td width=\"70%\"><b>Value</b></td></tr>"); |
1541 |
out_print(res, |
out_print(res, |
1542 |
"<tr><td>Name</a></td><td>%s</td></tr>", p->name); |
"<tr><td>Name</a></td><td>%s</td></tr>", s->name); |
1543 |
out_print(res, |
out_print(res, |
1544 |
"<tr><td>Group</a></td><td><font color='#0000ff'>%s</font></td></tr>", |
"<tr><td>Group</a></td><td><font color='#0000ff'>%s</font></td></tr>", |
1545 |
p->group?p->group:"(not defined)"); |
s->group?s->group:"(not defined)"); |
1546 |
out_print(res, |
out_print(res, |
1547 |
"<tr><td>File status</a></td><td>%s</td></tr>", |
"<tr><td>File status</a></td><td>%s</td></tr>", |
1548 |
state?"<font color='#00ff00'>Exist</font>": |
state?"<font color='#00ff00'>Exist</font>": |
1549 |
"<font color='#ff0000'>Doesn't Exist</font>"); |
"<font color='#ff0000'>Doesn't Exist</font>"); |
1550 |
out_print(res, |
out_print(res, |
1551 |
"<tr><td>Path</a></td><td>%s</td></tr>", |
"<tr><td>Path</a></td><td>%s</td></tr>", |
1552 |
p->path); |
s->path); |
1553 |
out_print(res, |
out_print(res, |
1554 |
"<tr><td>Monitoring mode</a></td><td>%s</td></tr>", |
"<tr><td>Monitoring mode</a></td><td>%s</td></tr>", |
1555 |
modenames[p->mode]); |
modenames[s->mode]); |
1556 |
out_print(res, |
out_print(res, |
1557 |
"<tr><td>Monitoring status</a></td><td>%s</td></tr>", |
"<tr><td>Monitoring status</a></td><td>%s</td></tr>", |
1558 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
1559 |
if(p->start) { |
if(s->start) { |
1560 |
int i = 0; |
int i = 0; |
1561 |
|
|
1562 |
out_print(res, "<tr><td>Start program</a></td><td>"); |
out_print(res, "<tr><td>Start program</a></td><td>"); |
1563 |
while(p->start->arg[i]) |
while(s->start->arg[i]) |
1564 |
out_print(res, "%s ", p->start->arg[i++]); |
out_print(res, "%s ", s->start->arg[i++]); |
1565 |
printf("</td></tr>"); |
printf("</td></tr>"); |
1566 |
} else { |
} else { |
1567 |
out_print(res, |
out_print(res, |
1568 |
"<tr><td>Start program</a></td><td>(not defined)</td></tr>"); |
"<tr><td>Start program</a></td><td>(not defined)</td></tr>"); |
1569 |
} |
} |
1570 |
if(p->stop) { |
if(s->stop) { |
1571 |
int i = 0; |
int i = 0; |
1572 |
|
|
1573 |
out_print(res, "<tr><td>Stop program</a></td><td>"); |
out_print(res, "<tr><td>Stop program</a></td><td>"); |
1574 |
while(p->stop->arg[i]) |
while(s->stop->arg[i]) |
1575 |
out_print(res, "%s ", p->stop->arg[i++]); |
out_print(res, "%s ", s->stop->arg[i++]); |
1576 |
printf("</td></tr>"); |
printf("</td></tr>"); |
1577 |
} else { |
} else { |
1578 |
out_print(res, |
out_print(res, |
1580 |
} |
} |
1581 |
{ |
{ |
1582 |
struct mychecksum *c; |
struct mychecksum *c; |
1583 |
for(c= p->checksumlist; c; c= c->next) |
for(c= s->checksumlist; c; c= c->next) |
1584 |
out_print(res, "<tr><td>Associated checksum</a></td><td>%s %s</td>" |
out_print(res, "<tr><td>Associated checksum</a></td><td>%s %s</td>" |
1585 |
"</tr>", c->md5, c->file); |
"</tr>", c->md5, c->file); |
1586 |
} |
} |
1587 |
{ |
{ |
1588 |
Dependant_T d; |
Dependant_T d; |
1589 |
|
|
1590 |
for(d= p->dependantlist; d; d= d->next) { |
for(d= s->dependantlist; d; d= d->next) { |
1591 |
if(d->dependant != NULL) { |
if(d->dependant != NULL) { |
1592 |
out_print(res,"<tr><td>Depends on Task </a></td>" |
out_print(res,"<tr><td>Depends on Task </a></td>" |
1593 |
"<td> <a href=%s> %s </a></td></tr>", |
"<td> <a href=%s> %s </a></td></tr>", |
1597 |
} |
} |
1598 |
{ |
{ |
1599 |
struct mytimestamp *t; |
struct mytimestamp *t; |
1600 |
for(t= p->timestamplist; t; t= t->next) |
for(t= s->timestamplist; t; t= t->next) |
1601 |
out_print(res, |
out_print(res, |
1602 |
"<tr><td>Associated timestamp</a></td>" |
"<tr><td>Associated timestamp</a></td>" |
1603 |
"<td>If %s %s %d second(s) then %s</td></tr>", |
"<td>If %s %s %d second(s) then %s</td></tr>", |
1605 |
} |
} |
1606 |
out_print(res, |
out_print(res, |
1607 |
"<tr><td>Check task</a></td><td>Every %d cycle</td></tr>", |
"<tr><td>Check task</a></td><td>Every %d cycle</td></tr>", |
1608 |
p->every?p->every:1); |
s->every?s->every:1); |
1609 |
out_print(res, |
out_print(res, |
1610 |
"<tr><td>Timeout</a></td><td>Timeout if %d restart within %d cycles" |
"<tr><td>Timeout</a></td><td>Timeout if %d restart within %d cycles" |
1611 |
"</td></tr>", p->to_start, p->to_cycle); |
"</td></tr>", s->to_start, s->to_cycle); |
1612 |
out_print(res, |
out_print(res, |
1613 |
"<tr><td>Size</a></td><td>%.3f MB</td></tr>", |
"<tr><td>Size</a></td><td>%.3f MB</td></tr>", |
1614 |
(float) stat_buf.st_size / 1048576); |
(float) stat_buf.st_size / 1048576); |
1618 |
out_print(res, |
out_print(res, |
1619 |
"<tr><td>GID</a></td><td>%d</td></tr>", |
"<tr><td>GID</a></td><td>%d</td></tr>", |
1620 |
stat_buf.st_gid); |
stat_buf.st_gid); |
1621 |
if(p->perm != -1) |
if(s->perm != -1) |
1622 |
out_print(res, "<tr><td>Associated permission</a></td><td>%o</td></tr>", p->perm); |
out_print(res, "<tr><td>Associated permission</a></td><td>%o</td></tr>", s->perm); |
1623 |
out_print(res, |
out_print(res, |
1624 |
"<tr><td>Permission</a></td><td>%o</td></tr>", |
"<tr><td>Permission</a></td><td>%o</td></tr>", |
1625 |
stat_buf.st_mode & 07777); |
stat_buf.st_mode & 07777); |
1626 |
{ |
{ |
1627 |
Mail_T r; |
Mail_T r; |
1628 |
for(r= p->maillist; r; r= r->next) { |
for(r= s->maillist; r; r= r->next) { |
1629 |
out_print(res, |
out_print(res, |
1630 |
"<tr bgcolor=\"#EFEFEF\"><td>Alert mail to</a></td><td>%s</td></tr>", |
"<tr bgcolor=\"#EFEFEF\"><td>Alert mail to</a></td><td>%s</td></tr>", |
1631 |
r->to?r->to:""); |
r->to?r->to:""); |
1661 |
out_print(res, "</table>"); |
out_print(res, "</table>"); |
1662 |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
1663 |
/* Start program */ |
/* Start program */ |
1664 |
if(p->start) |
if(s->start) |
1665 |
out_print(res, |
out_print(res, |
1666 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1667 |
"<input type=hidden value='start' name=action>" |
"<input type=hidden value='start' name=action>" |
1668 |
"<input type=submit value='Start program' style='font-size: 12pt'></font>" |
"<input type=submit value='Start program' style='font-size: 12pt'></font>" |
1669 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1670 |
/* Stop program */ |
/* Stop program */ |
1671 |
if(p->stop) |
if(s->stop) |
1672 |
out_print(res, |
out_print(res, |
1673 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1674 |
"<input type=hidden value='stop' name=action>" |
"<input type=hidden value='stop' name=action>" |
1675 |
"<input type=submit value='Stop program' style='font-size: 12pt'></font>" |
"<input type=submit value='Stop program' style='font-size: 12pt'></font>" |
1676 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1677 |
if(p->start && p->stop) |
if(s->start && s->stop) |
1678 |
out_print(res, |
out_print(res, |
1679 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1680 |
"<input type=hidden value='restart' name=action>" |
"<input type=hidden value='restart' name=action>" |
1681 |
"<input type=submit value='Restart program' style='font-size: 12pt'></font>" |
"<input type=submit value='Restart program' style='font-size: 12pt'></font>" |
1682 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1683 |
out_print(res, "</tr></table>"); |
out_print(res, "</tr></table>"); |
1684 |
|
|
1685 |
} |
} |
1686 |
|
|
1687 |
|
|
1688 |
static void do_task_process(HttpRequest req, HttpResponse res, Process_T p) { |
static void do_task_process(HttpRequest req, HttpResponse res, Service_T s) { |
1689 |
|
|
1690 |
int run= is_process_running(p); |
int run= is_process_running(s); |
1691 |
|
|
1692 |
out_print(res, |
out_print(res, |
1693 |
"<p><br><h3>Process status</h3><br>"); |
"<p><br><h3>Process status</h3><br>"); |
1694 |
out_print(res,"<table cellspacing=0 cellpadding=3 border=1 width=\"90%\">" |
out_print(res,"<table cellspacing=0 cellpadding=3 border=1 width=\"90%\">" |
1695 |
"<tr><td width=\"30%\"><b>Parameter</b></td><td width=\"70%\"><b>Value</b></td></tr>"); |
"<tr><td width=\"30%\"><b>Parameter</b></td><td width=\"70%\"><b>Value</b></td></tr>"); |
1696 |
out_print(res, |
out_print(res, |
1697 |
"<tr><td>Name</a></td><td>%s</td></tr>", p->name); |
"<tr><td>Name</a></td><td>%s</td></tr>", s->name); |
1698 |
out_print(res, |
out_print(res, |
1699 |
"<tr><td>Group</a></td><td><font color='#0000ff'>%s</font></td></tr>", |
"<tr><td>Group</a></td><td><font color='#0000ff'>%s</font></td></tr>", |
1700 |
p->group?p->group:"(not defined)"); |
s->group?s->group:"(not defined)"); |
1701 |
out_print(res, |
out_print(res, |
1702 |
"<tr><td>Process id </a></td><td>%d</td></tr>", run); |
"<tr><td>Process id </a></td><td>%d</td></tr>", run); |
1703 |
out_print(res, |
out_print(res, |
1704 |
"<tr><td>Process status</a></td><td>%s %s</td></tr>", |
"<tr><td>Process status</a></td><td>%s %s</td></tr>", |
1705 |
run?"<font color='#00ff00'>Running</font>": |
run?"<font color='#00ff00'>Running</font>": |
1706 |
"<font color='#ff0000'>Not Running</font>", |
"<font color='#ff0000'>Not Running</font>", |
1707 |
p->has_checksum_error? |
s->has_checksum_error? |
1708 |
"<font color='#ff0000'><b>Checksum error!</b></font>":""); |
"<font color='#ff0000'><b>Checksum error!</b></font>":""); |
1709 |
out_print(res, |
out_print(res, |
1710 |
"<tr><td>Pid file</a></td><td>%s</td></tr>", |
"<tr><td>Pid file</a></td><td>%s</td></tr>", |
1711 |
p->path); |
s->path); |
1712 |
out_print(res, |
out_print(res, |
1713 |
"<tr><td>Monitoring mode</a></td><td>%s</td></tr>", |
"<tr><td>Monitoring mode</a></td><td>%s</td></tr>", |
1714 |
modenames[p->mode]); |
modenames[s->mode]); |
1715 |
out_print(res, |
out_print(res, |
1716 |
"<tr><td>Monitoring status</a></td><td>%s</td></tr>", |
"<tr><td>Monitoring status</a></td><td>%s</td></tr>", |
1717 |
statusnames[p->do_validate]); |
statusnames[s->do_validate]); |
1718 |
if(p->start) { |
if(s->start) { |
1719 |
int i = 0; |
int i = 0; |
1720 |
|
|
1721 |
out_print(res, "<tr><td>Start program</a></td><td>"); |
out_print(res, "<tr><td>Start program</a></td><td>"); |
1722 |
while(p->start->arg[i]) |
while(s->start->arg[i]) |
1723 |
out_print(res, "%s ", p->start->arg[i++]); |
out_print(res, "%s ", s->start->arg[i++]); |
1724 |
printf("</td></tr>"); |
printf("</td></tr>"); |
1725 |
} else { |
} else { |
1726 |
out_print(res, |
out_print(res, |
1727 |
"<tr><td>Start program</a></td><td>(not defined)</td></tr>"); |
"<tr><td>Start program</a></td><td>(not defined)</td></tr>"); |
1728 |
} |
} |
1729 |
if(p->stop) { |
if(s->stop) { |
1730 |
int i = 0; |
int i = 0; |
1731 |
|
|
1732 |
out_print(res, "<tr><td>Stop program</a></td><td>"); |
out_print(res, "<tr><td>Stop program</a></td><td>"); |
1733 |
while(p->stop->arg[i]) |
while(s->stop->arg[i]) |
1734 |
out_print(res, "%s ", p->stop->arg[i++]); |
out_print(res, "%s ", s->stop->arg[i++]); |
1735 |
printf("</td></tr>"); |
printf("</td></tr>"); |
1736 |
} else { |
} else { |
1737 |
out_print(res, |
out_print(res, |
1739 |
} |
} |
1740 |
{ |
{ |
1741 |
struct mychecksum *c; |
struct mychecksum *c; |
1742 |
for(c= p->checksumlist; c; c= c->next) |
for(c= s->checksumlist; c; c= c->next) |
1743 |
out_print(res, "<tr><td>Associated checksum</a></td><td>%s %s</td>" |
out_print(res, "<tr><td>Associated checksum</a></td><td>%s %s</td>" |
1744 |
"</tr>", c->md5, c->file); |
"</tr>", c->md5, c->file); |
1745 |
} |
} |
1746 |
{ |
{ |
1747 |
Dependant_T d; |
Dependant_T d; |
1748 |
|
|
1749 |
for(d= p->dependantlist; d; d= d->next) { |
for(d= s->dependantlist; d; d= d->next) { |
1750 |
if(d->dependant != NULL) { |
if(d->dependant != NULL) { |
1751 |
out_print(res,"<tr><td>Depends on Task </a></td>" |
out_print(res,"<tr><td>Depends on Task </a></td>" |
1752 |
"<td> <a href=%s> %s </a></td></tr>", |
"<td> <a href=%s> %s </a></td></tr>", |
1755 |
} |
} |
1756 |
} |
} |
1757 |
if ( Run.doprocess ) { |
if ( Run.doprocess ) { |
1758 |
ProcInfo_T pi= p->procinfo; |
ProcInfo_T pi= s->procinfo; |
1759 |
|
|
1760 |
out_print(res, |
out_print(res, |
1761 |
"<tr><td>CPU usage</a></td><td>%.1f%%</td></tr>", |
"<tr><td>CPU usage</a></td><td>%.1f%%</td></tr>", |
1772 |
} |
} |
1773 |
{ |
{ |
1774 |
Port_T n; |
Port_T n; |
1775 |
for(n= p->portlist; n; n= n->next) { |
for(n= s->portlist; n; n= n->next) { |
1776 |
|
|
1777 |
if ( n->family == AF_INET ) { |
if ( n->family == AF_INET ) { |
1778 |
|
|
1812 |
} |
} |
1813 |
{ |
{ |
1814 |
struct mytimestamp *t; |
struct mytimestamp *t; |
1815 |
for(t= p->timestamplist; t; t= t->next) |
for(t= s->timestamplist; t; t= t->next) |
1816 |
out_print(res, |
out_print(res, |
1817 |
"<tr><td>Associated timestamp</a></td>" |
"<tr><td>Associated timestamp</a></td>" |
1818 |
"<td>If %s %s %d second(s) then %s</td></tr>", |
"<td>If %s %s %d second(s) then %s</td></tr>", |
1821 |
{ |
{ |
1822 |
Resource_T q; |
Resource_T q; |
1823 |
|
|
1824 |
for (q= p->resourcelist; q; q= q->next) { |
for (q= s->resourcelist; q; q= q->next) { |
1825 |
switch (q->resource_id) { |
switch (q->resource_id) { |
1826 |
|
|
1827 |
case RESOURCE_ID_CPU_PERCENT: |
case RESOURCE_ID_CPU_PERCENT: |
1906 |
} |
} |
1907 |
out_print(res, |
out_print(res, |
1908 |
"<tr><td>Check task</a></td><td>Every %d cycle</td></tr>", |
"<tr><td>Check task</a></td><td>Every %d cycle</td></tr>", |
1909 |
p->every?p->every:1); |
s->every?s->every:1); |
1910 |
out_print(res, |
out_print(res, |
1911 |
"<tr><td>Timeout</a></td><td>Timeout if %d restart within %d cycles" |
"<tr><td>Timeout</a></td><td>Timeout if %d restart within %d cycles" |
1912 |
"</td></tr>", p->to_start, p->to_cycle); |
"</td></tr>", s->to_start, s->to_cycle); |
1913 |
{ |
{ |
1914 |
Mail_T r; |
Mail_T r; |
1915 |
for(r= p->maillist; r; r= r->next) { |
for(r= s->maillist; r; r= r->next) { |
1916 |
out_print(res, |
out_print(res, |
1917 |
"<tr bgcolor=\"#EFEFEF\"><td>Alert mail to</a></td><td>%s</td></tr>", |
"<tr bgcolor=\"#EFEFEF\"><td>Alert mail to</a></td><td>%s</td></tr>", |
1918 |
r->to?r->to:""); |
r->to?r->to:""); |
1948 |
out_print(res, "</table>"); |
out_print(res, "</table>"); |
1949 |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
1950 |
/* Start program */ |
/* Start program */ |
1951 |
if(p->start) |
if(s->start) |
1952 |
out_print(res, |
out_print(res, |
1953 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1954 |
"<input type=hidden value='start' name=action>" |
"<input type=hidden value='start' name=action>" |
1955 |
"<input type=submit value='Start program' style='font-size: 12pt'></font>" |
"<input type=submit value='Start program' style='font-size: 12pt'></font>" |
1956 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1957 |
/* Stop program */ |
/* Stop program */ |
1958 |
if(p->stop) |
if(s->stop) |
1959 |
out_print(res, |
out_print(res, |
1960 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1961 |
"<input type=hidden value='stop' name=action>" |
"<input type=hidden value='stop' name=action>" |
1962 |
"<input type=submit value='Stop program' style='font-size: 12pt'></font>" |
"<input type=submit value='Stop program' style='font-size: 12pt'></font>" |
1963 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1964 |
if(p->start && p->stop) |
if(s->start && s->stop) |
1965 |
out_print(res, |
out_print(res, |
1966 |
"<td><form method=GET action=/%s>" |
"<td><form method=GET action=/%s>" |
1967 |
"<input type=hidden value='restart' name=action>" |
"<input type=hidden value='restart' name=action>" |
1968 |
"<input type=submit value='Restart program' style='font-size: 12pt'></font>" |
"<input type=submit value='Restart program' style='font-size: 12pt'></font>" |
1969 |
"</form></td>", p->name); |
"</form></td>", s->name); |
1970 |
out_print(res, "</tr></table>"); |
out_print(res, "</tr></table>"); |
1971 |
|
|
1972 |
} |
} |