101 |
static void do_service_process(HttpRequest, HttpResponse, Service_T); |
static void do_service_process(HttpRequest, HttpResponse, Service_T); |
102 |
static void do_service_host(HttpRequest, HttpResponse, Service_T); |
static void do_service_host(HttpRequest, HttpResponse, Service_T); |
103 |
static void print_alerts(HttpResponse res, Service_T s); |
static void print_alerts(HttpResponse res, Service_T s); |
104 |
|
static void print_action_buttons(HttpResponse res, Service_T s); |
105 |
|
static void print_depend(HttpResponse res, Service_T s); |
106 |
|
static void print_service_common_params(HttpResponse res, Service_T s); |
107 |
|
|
108 |
|
|
109 |
/** |
/** |
1258 |
"<b>Value</b></td></tr>"); |
"<b>Value</b></td></tr>"); |
1259 |
out_print(res, |
out_print(res, |
1260 |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
1261 |
if(s->group) |
|
|
out_print(res, |
|
|
"<tr><td>Group</td><td><font color='#0000ff'>%s" |
|
|
"</font></td></tr>", s->group); |
|
1262 |
out_print(res, |
out_print(res, |
1263 |
"<tr><td>Device status</td><td>%s</td></tr>", |
"<tr><td>Device status</td><td>%s</td></tr>", |
1264 |
(s->perm&&s->perm->has_error)? |
(s->perm&&s->perm->has_error)? |
1273 |
out_print(res, |
out_print(res, |
1274 |
"<tr><td>Path</td><td>%s</td></tr>", |
"<tr><td>Path</td><td>%s</td></tr>", |
1275 |
s->path); |
s->path); |
1276 |
out_print(res, |
|
1277 |
"<tr><td>Monitoring mode</td><td>%s</td></tr>", |
print_service_common_params(res, s); |
1278 |
modenames[s->mode]); |
|
|
out_print(res, |
|
|
"<tr><td>Monitoring status</td><td><font color='#ff8800'>%s" |
|
|
"</font></td></tr>", |
|
|
statusnames[s->do_monitor]); |
|
|
if(s->start) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Start program</td><td>"); |
|
|
while(s->start->arg[i]) |
|
|
out_print(res, "%s ", s->start->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
|
if(s->stop) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Stop program</td><td>"); |
|
|
while(s->stop->arg[i]) |
|
|
out_print(res, "%s ", s->stop->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
1279 |
if(s->perm) |
if(s->perm) |
1280 |
out_print(res, "<tr><td>Associated permission</td><td>if failed %o then %s</td></tr>", |
out_print(res, "<tr><td>Associated permission</td>" |
1281 |
s->perm->perm, actionnames[s->perm->action]); |
"<td>if failed %o then %s</td></tr>", |
1282 |
|
s->perm->perm, actionnames[s->perm->action]); |
1283 |
if(s->uid) |
if(s->uid) |
1284 |
out_print(res, "<tr><td>Associated UID</td><td>if failed %d then %s</td></tr>", |
out_print(res, "<tr><td>Associated UID</td><td>if failed %d then %s</td>" |
1285 |
(int)s->uid->uid, actionnames[s->uid->action]); |
"</tr>", (int)s->uid->uid, actionnames[s->uid->action]); |
1286 |
if(s->gid) |
if(s->gid) |
1287 |
out_print(res, "<tr><td>Associated GID</td><td>if failed %d then %s</td></tr>", |
out_print(res, "<tr><td>Associated GID</td><td>if failed %d then %s</td>" |
1288 |
(int)s->gid->gid, actionnames[s->gid->action]); |
"</tr>", (int)s->gid->gid, actionnames[s->gid->action]); |
1289 |
out_print(res, |
out_print(res, |
1290 |
"<tr><td>Permission</td><td>%s%o</font></td></tr>", |
"<tr><td>Permission</td><td>%s%o</font></td></tr>", |
1291 |
(s->perm&&s->perm->has_error)? |
(s->perm&&s->perm->has_error)? |
1304 |
"<font color='#ff0000'>": |
"<font color='#ff0000'>": |
1305 |
"<font>", |
"<font>", |
1306 |
(int)stat_buf.st_gid); |
(int)stat_buf.st_gid); |
1307 |
{ |
|
1308 |
Dependant_T d; |
print_depend(res, s); |
1309 |
|
|
|
for(d= s->dependantlist; d; d= d->next) { |
|
|
if(d->dependant != NULL) { |
|
|
out_print(res,"<tr><td>Depends on service </td>" |
|
|
"<td> <a href=%s> %s </a></td></tr>", |
|
|
d->dependant, d->dependant); |
|
|
} |
|
|
} |
|
|
} |
|
|
out_print(res, |
|
|
"<tr><td>Check service</td><td>Every %d cycle</td></tr>", |
|
|
s->every?s->every:1); |
|
|
if(s->def_timeout) { |
|
|
out_print(res, |
|
|
"<tr><td>Timeout</td><td>" |
|
|
"Timeout if %d restart within %d cycles</td></tr>", |
|
|
s->to_start, s->to_cycle); |
|
|
} |
|
1310 |
{ |
{ |
1311 |
|
|
1312 |
Device_T dl; |
Device_T dl; |
1391 |
print_alerts(res, s); |
print_alerts(res, s); |
1392 |
|
|
1393 |
out_print(res, "</table>"); |
out_print(res, "</table>"); |
1394 |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
|
1395 |
/* Start program */ |
print_action_buttons(res, s); |
|
if(s->start) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='start' name=action>" |
|
|
"<input type=submit value='Start service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Stop program */ |
|
|
if(s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='stop' name=action>" |
|
|
"<input type=submit value='Stop service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Restart program */ |
|
|
if(s->start && s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='restart' name=action>" |
|
|
"<input type=submit value='Restart service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* (un)monitor */ |
|
|
{ |
|
|
char *action[]= {"monitor", "unmonitor"}; |
|
|
char *label[]= {"Enable monitoring", "Disable monitoring"}; |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='%s' name=action>" |
|
|
"<input type=submit value='%s' style='font-size: 12pt'>" |
|
|
"</form></td></tr></table>", |
|
|
s->name, action[s->do_monitor], label[s->do_monitor]); |
|
|
} |
|
1396 |
|
|
1397 |
} |
} |
1398 |
|
|
1410 |
"<td width=\"70%\"><b>Value</b></td></tr>"); |
"<td width=\"70%\"><b>Value</b></td></tr>"); |
1411 |
out_print(res, |
out_print(res, |
1412 |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
1413 |
if(s->group) |
|
|
out_print(res, |
|
|
"<tr><td>Group</td><td><font color='#0000ff'>%s" |
|
|
"</font></td></tr>", s->group); |
|
1414 |
out_print(res, |
out_print(res, |
1415 |
"<tr><td>Directory status</td><td>%s</td></tr>", |
"<tr><td>Directory status</td><td>%s</td></tr>", |
1416 |
(s->perm&&s->perm->has_error)? |
(s->perm&&s->perm->has_error)? |
1425 |
out_print(res, |
out_print(res, |
1426 |
"<tr><td>Path</td><td>%s</td></tr>", |
"<tr><td>Path</td><td>%s</td></tr>", |
1427 |
s->path); |
s->path); |
1428 |
out_print(res, |
|
1429 |
"<tr><td>Monitoring mode</td><td>%s</td></tr>", |
print_service_common_params(res, s); |
1430 |
modenames[s->mode]); |
print_depend(res, s); |
1431 |
out_print(res, |
|
|
"<tr><td>Monitoring status</td><td><font color='#ff8800'>%s" |
|
|
"</font></td></tr>", |
|
|
statusnames[s->do_monitor]); |
|
|
if(s->start) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Start program</td><td>"); |
|
|
while(s->start->arg[i]) |
|
|
out_print(res, "%s ", s->start->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
|
if(s->stop) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Stop program</td><td>"); |
|
|
while(s->stop->arg[i]) |
|
|
out_print(res, "%s ", s->stop->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
|
{ |
|
|
Dependant_T d; |
|
|
|
|
|
for(d= s->dependantlist; d; d= d->next) { |
|
|
if(d->dependant != NULL) { |
|
|
out_print(res,"<tr><td>Depends on service </td>" |
|
|
"<td> <a href=%s> %s </a></td></tr>", |
|
|
d->dependant, d->dependant); |
|
|
} |
|
|
} |
|
|
} |
|
1432 |
{ |
{ |
1433 |
struct mytimestamp *t; |
struct mytimestamp *t; |
1434 |
for(t= s->timestamplist; t; t= t->next) { |
for(t= s->timestamplist; t; t= t->next) { |
1460 |
"if failed %d then %s</td></tr>", |
"if failed %d then %s</td></tr>", |
1461 |
(int)s->gid->gid, actionnames[s->gid->action]); |
(int)s->gid->gid, actionnames[s->gid->action]); |
1462 |
out_print(res, |
out_print(res, |
|
"<tr><td>Check service</td><td>Every %d cycle</td></tr>", |
|
|
s->every?s->every:1); |
|
|
if(s->def_timeout) { |
|
|
out_print(res, |
|
|
"<tr><td>Timeout</td><td>" |
|
|
"Timeout if %d restart within %d cycles</td></tr>", |
|
|
s->to_start, s->to_cycle); |
|
|
} |
|
|
out_print(res, |
|
1463 |
"<tr><td>Permission</td><td>%s%o</font></td></tr>", |
"<tr><td>Permission</td><td>%s%o</font></td></tr>", |
1464 |
(s->perm&&s->perm->has_error)? |
(s->perm&&s->perm->has_error)? |
1465 |
"<font color='#ff0000'>": |
"<font color='#ff0000'>": |
1481 |
print_alerts(res, s); |
print_alerts(res, s); |
1482 |
|
|
1483 |
out_print(res, "</table>"); |
out_print(res, "</table>"); |
1484 |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
|
1485 |
/* Start program */ |
print_action_buttons(res, s); |
|
if(s->start) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='start' name=action>" |
|
|
"<input type=submit value='Start service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Stop program */ |
|
|
if(s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='stop' name=action>" |
|
|
"<input type=submit value='Stop service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Restart program */ |
|
|
if(s->start && s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='restart' name=action>" |
|
|
"<input type=submit value='Restart service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* (un)monitor */ |
|
|
{ |
|
|
char *action[]= {"monitor", "unmonitor"}; |
|
|
char *label[]= {"Enable monitoring", "Disable monitoring"}; |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='%s' name=action>" |
|
|
"<input type=submit value='%s' style='font-size: 12pt'>" |
|
|
"</form></td></tr></table>", |
|
|
s->name, action[s->do_monitor], label[s->do_monitor]); |
|
|
} |
|
1486 |
|
|
1487 |
} |
} |
1488 |
|
|
1499 |
"<b>Value</b></td></tr>"); |
"<b>Value</b></td></tr>"); |
1500 |
out_print(res, |
out_print(res, |
1501 |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
|
if(s->group) |
|
|
out_print(res, |
|
|
"<tr><td>Group</td><td><font color='#0000ff'>%s" |
|
|
"</font></td></tr>", s->group); |
|
1502 |
out_print(res, |
out_print(res, |
1503 |
"<tr><td>File status</td><td>%s</td></tr>", |
"<tr><td>File status</td><td>%s</td></tr>", |
1504 |
(s->perm&&s->perm->has_error)? |
(s->perm&&s->perm->has_error)? |
1513 |
out_print(res, |
out_print(res, |
1514 |
"<tr><td>Path</td><td>%s</td></tr>", |
"<tr><td>Path</td><td>%s</td></tr>", |
1515 |
s->path); |
s->path); |
1516 |
out_print(res, |
|
1517 |
"<tr><td>Monitoring mode</td><td>%s</td></tr>", |
print_service_common_params(res,s); |
1518 |
modenames[s->mode]); |
print_depend(res, s); |
1519 |
out_print(res, |
|
|
"<tr><td>Monitoring status</td><td><font color='#ff8800'>%s" |
|
|
"</font></td></tr>", statusnames[s->do_monitor]); |
|
|
if(s->start) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Start program</td><td>"); |
|
|
while(s->start->arg[i]) |
|
|
out_print(res, "%s ", s->start->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
|
if(s->stop) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Stop program</td><td>"); |
|
|
while(s->stop->arg[i]) |
|
|
out_print(res, "%s ", s->stop->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
|
{ |
|
|
Dependant_T d; |
|
|
|
|
|
for(d= s->dependantlist; d; d= d->next) { |
|
|
if(d->dependant != NULL) { |
|
|
out_print(res,"<tr><td>Depends on service</td>" |
|
|
"<td> <a href=%s> %s </a></td></tr>", |
|
|
d->dependant, d->dependant); |
|
|
} |
|
|
} |
|
|
} |
|
1520 |
{ |
{ |
1521 |
struct mytimestamp *t; |
struct mytimestamp *t; |
1522 |
for(t= s->timestamplist; t; t= t->next) { |
for(t= s->timestamplist; t; t= t->next) { |
1568 |
"if failed %d then %s</td></tr>", |
"if failed %d then %s</td></tr>", |
1569 |
(int)s->gid->gid, actionnames[s->gid->action]); |
(int)s->gid->gid, actionnames[s->gid->action]); |
1570 |
out_print(res, |
out_print(res, |
|
"<tr><td>Check service</td><td>Every %d cycle</td></tr>", |
|
|
s->every?s->every:1); |
|
|
if(s->def_timeout) { |
|
|
out_print(res, |
|
|
"<tr><td>Timeout</td><td>" |
|
|
"Timeout if %d restart within %d cycles</td></tr>", |
|
|
s->to_start, s->to_cycle); |
|
|
} |
|
|
out_print(res, |
|
1571 |
"<tr><td>Size</td><td>%lu B</td></tr>", |
"<tr><td>Size</td><td>%lu B</td></tr>", |
1572 |
(unsigned long)stat_buf.st_size); |
(unsigned long)stat_buf.st_size); |
1573 |
out_print(res, |
out_print(res, |
1592 |
print_alerts(res, s); |
print_alerts(res, s); |
1593 |
|
|
1594 |
out_print(res, "</table>"); |
out_print(res, "</table>"); |
1595 |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
|
1596 |
/* Start program */ |
print_action_buttons(res, s); |
|
if(s->start) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='start' name=action>" |
|
|
"<input type=submit value='Start service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Stop program */ |
|
|
if(s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='stop' name=action>" |
|
|
"<input type=submit value='Stop service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Restart program */ |
|
|
if(s->start && s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='restart' name=action>" |
|
|
"<input type=submit value='Restart service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* (un)monitor */ |
|
|
{ |
|
|
char *action[]= {"monitor", "unmonitor"}; |
|
|
char *label[]= {"Enable monitoring", "Disable monitoring"}; |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='%s' name=action>" |
|
|
"<input type=submit value='%s' style='font-size: 12pt'>" |
|
|
"</form></td></tr></table>", |
|
|
s->name, action[s->do_monitor], label[s->do_monitor]); |
|
|
} |
|
1597 |
|
|
1598 |
} |
} |
1599 |
|
|
1609 |
"<td width=\"70%\"><b>Value</b></td></tr>"); |
"<td width=\"70%\"><b>Value</b></td></tr>"); |
1610 |
out_print(res, |
out_print(res, |
1611 |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
|
if(s->group) |
|
|
out_print(res, |
|
|
"<tr><td>Group</td><td><font color='#0000ff'>%s" |
|
|
"</font></td></tr>", s->group); |
|
1612 |
out_print(res, |
out_print(res, |
1613 |
"<tr><td>Process id </td><td>%d</td></tr>", run); |
"<tr><td>Process id </td><td>%d</td></tr>", run); |
1614 |
out_print(res, |
out_print(res, |
1618 |
out_print(res, |
out_print(res, |
1619 |
"<tr><td>Pid file</td><td>%s</td></tr>", |
"<tr><td>Pid file</td><td>%s</td></tr>", |
1620 |
s->path); |
s->path); |
1621 |
out_print(res, |
|
1622 |
"<tr><td>Monitoring mode</td><td>%s</td></tr>", |
print_service_common_params(res, s); |
1623 |
modenames[s->mode]); |
print_depend(res, s); |
1624 |
out_print(res, |
|
|
"<tr><td>Monitoring status</td><td><font color='#ff8800'>%s" |
|
|
"</font></td></tr>", |
|
|
statusnames[s->do_monitor]); |
|
|
if(s->start) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Start program</td><td>"); |
|
|
while(s->start->arg[i]) |
|
|
out_print(res, "%s ", s->start->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
|
if(s->stop) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Stop program</td><td>"); |
|
|
while(s->stop->arg[i]) |
|
|
out_print(res, "%s ", s->stop->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
|
{ |
|
|
Dependant_T d; |
|
|
|
|
|
for(d= s->dependantlist; d; d= d->next) { |
|
|
if(d->dependant != NULL) { |
|
|
out_print(res,"<tr><td>Depends on service </td>" |
|
|
"<td> <a href=%s> %s </a></td></tr>", |
|
|
d->dependant, d->dependant); |
|
|
} |
|
|
} |
|
|
} |
|
1625 |
if(Run.doprocess) { |
if(Run.doprocess) { |
1626 |
ProcInfo_T pi= s->procinfo; |
ProcInfo_T pi= s->procinfo; |
1627 |
|
|
1756 |
} |
} |
1757 |
} |
} |
1758 |
} |
} |
|
out_print(res, |
|
|
"<tr><td>Check service</td><td>Every %d cycle</td></tr>", |
|
|
s->every?s->every:1); |
|
|
if(s->def_timeout) { |
|
|
out_print(res, |
|
|
"<tr><td>Timeout</td><td>" |
|
|
"Timeout if %d restart within %d cycles</td></tr>", |
|
|
s->to_start, s->to_cycle); |
|
|
} |
|
1759 |
|
|
1760 |
print_alerts(res, s); |
print_alerts(res, s); |
1761 |
|
|
1762 |
out_print(res, "</table>"); |
out_print(res, "</table>"); |
|
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
|
|
/* Start program */ |
|
|
if(s->start) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='start' name=action>" |
|
|
"<input type=submit value='Start service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Stop program */ |
|
|
if(s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='stop' name=action>" |
|
|
"<input type=submit value='Stop service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Restart program */ |
|
|
if(s->start && s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='restart' name=action>" |
|
|
"<input type=submit value='Restart service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* (un)monitor */ |
|
|
{ |
|
|
char *action[]= {"monitor", "unmonitor"}; |
|
|
char *label[]= {"Enable monitoring", "Disable monitoring"}; |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='%s' name=action>" |
|
|
"<input type=submit value='%s' style='font-size: 12pt'>" |
|
|
"</form></td></tr></table>", |
|
|
s->name, action[s->do_monitor], label[s->do_monitor]); |
|
|
} |
|
1763 |
|
|
1764 |
|
print_action_buttons(res, s); |
1765 |
|
|
1766 |
} |
} |
1767 |
|
|
1768 |
|
|
1785 |
"<td width=\"70%\"><b>Value</b></td></tr>"); |
"<td width=\"70%\"><b>Value</b></td></tr>"); |
1786 |
out_print(res, |
out_print(res, |
1787 |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
"<tr><td>Name</td><td>%s</td></tr>", s->name); |
|
if(s->group) |
|
|
out_print(res, |
|
|
"<tr><td>Group</td><td><font color='#0000ff'>%s" |
|
|
"</font></td></tr>", s->group); |
|
1788 |
out_print(res, |
out_print(res, |
1789 |
"<tr><td>Remote status</td><td>%s</td></tr>", |
"<tr><td>Remote status</td><td>%s</td></tr>", |
1790 |
available?"<font color='#00ff00'>Available</font>": |
available?"<font color='#00ff00'>Available</font>": |
1791 |
"<font color='#ff0000'>Not available</font>"); |
"<font color='#ff0000'>Not available</font>"); |
1792 |
out_print(res, |
|
1793 |
"<tr><td>Monitoring mode</td><td>%s</td></tr>", |
print_service_common_params(res, s); |
1794 |
modenames[s->mode]); |
print_depend(res, s); |
1795 |
out_print(res, |
|
|
"<tr><td>Monitoring status</td><td><font color='#ff8800'>%s" |
|
|
"</font></td></tr>", |
|
|
statusnames[s->do_monitor]); |
|
|
if(s->start) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Start program</td><td>"); |
|
|
while(s->start->arg[i]) |
|
|
out_print(res, "%s ", s->start->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
|
if(s->stop) { |
|
|
int i = 0; |
|
|
|
|
|
out_print(res, "<tr><td>Stop program</td><td>"); |
|
|
while(s->stop->arg[i]) |
|
|
out_print(res, "%s ", s->stop->arg[i++]); |
|
|
out_print(res, "</td></tr>"); |
|
|
} |
|
|
{ |
|
|
Dependant_T d; |
|
|
|
|
|
for(d= s->dependantlist; d; d= d->next) { |
|
|
if(d->dependant != NULL) { |
|
|
out_print(res,"<tr><td>Depends on service </td>" |
|
|
"<td> <a href=%s> %s </a></td></tr>", |
|
|
d->dependant, d->dependant); |
|
|
} |
|
|
} |
|
|
} |
|
1796 |
{ |
{ |
1797 |
Port_T n; |
Port_T n; |
1798 |
for(n= s->portlist; n; n= n->next) { |
for(n= s->portlist; n; n= n->next) { |
1824 |
} |
} |
1825 |
} |
} |
1826 |
} |
} |
|
out_print(res, |
|
|
"<tr><td>Check service</td><td>Every %d cycle</td></tr>", |
|
|
s->every?s->every:1); |
|
|
if(s->def_timeout) { |
|
|
out_print(res, |
|
|
"<tr><td>Timeout</td><td>" |
|
|
"Timeout if %d restart within %d cycles</td></tr>", |
|
|
s->to_start, s->to_cycle); |
|
|
} |
|
1827 |
|
|
1828 |
print_alerts(res, s); |
print_alerts(res, s); |
1829 |
|
|
1830 |
out_print(res, "</table>"); |
out_print(res, "</table>"); |
1831 |
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
|
1832 |
/* Start program */ |
print_action_buttons(res, s); |
|
if(s->start) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='start' name=action>" |
|
|
"<input type=submit value='Start service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Stop program */ |
|
|
if(s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='stop' name=action>" |
|
|
"<input type=submit value='Stop service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* Restart program */ |
|
|
if(s->start && s->stop) |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='restart' name=action>" |
|
|
"<input type=submit value='Restart service' style='font-size: " |
|
|
"12pt'></form></td>", s->name); |
|
|
/* (un)monitor */ |
|
|
{ |
|
|
char *action[]= {"monitor", "unmonitor"}; |
|
|
char *label[]= {"Enable monitoring", "Disable monitoring"}; |
|
|
out_print(res, |
|
|
"<td><form method=GET action=/%s>" |
|
|
"<input type=hidden value='%s' name=action>" |
|
|
"<input type=submit value='%s' style='font-size: 12pt'>" |
|
|
"</form></td></tr></table>", |
|
|
s->name, action[s->do_monitor], label[s->do_monitor]); |
|
|
} |
|
1833 |
|
|
1834 |
} |
} |
1835 |
|
|
1885 |
} |
} |
1886 |
|
|
1887 |
} |
} |
1888 |
|
|
1889 |
|
|
1890 |
|
static void print_action_buttons(HttpResponse res, Service_T s) { |
1891 |
|
|
1892 |
|
char *action[]= {"monitor", "unmonitor"}; |
1893 |
|
char *label[]= {"Enable monitoring", "Disable monitoring"}; |
1894 |
|
|
1895 |
|
out_print(res, "<table cellspacing=16><tr nowrap><td><font size=+1>"); |
1896 |
|
/* Start program */ |
1897 |
|
if(s->start) |
1898 |
|
out_print(res, |
1899 |
|
"<td><form method=GET action=/%s>" |
1900 |
|
"<input type=hidden value='start' name=action>" |
1901 |
|
"<input type=submit value='Start service' style='font-size: " |
1902 |
|
"12pt'></form></td>", s->name); |
1903 |
|
/* Stop program */ |
1904 |
|
if(s->stop) |
1905 |
|
out_print(res, |
1906 |
|
"<td><form method=GET action=/%s>" |
1907 |
|
"<input type=hidden value='stop' name=action>" |
1908 |
|
"<input type=submit value='Stop service' style='font-size: " |
1909 |
|
"12pt'></form></td>", s->name); |
1910 |
|
/* Restart program */ |
1911 |
|
if(s->start && s->stop) |
1912 |
|
out_print(res, |
1913 |
|
"<td><form method=GET action=/%s>" |
1914 |
|
"<input type=hidden value='restart' name=action>" |
1915 |
|
"<input type=submit value='Restart service' style='font-size: " |
1916 |
|
"12pt'></form></td>", s->name); |
1917 |
|
/* (un)monitor */ |
1918 |
|
out_print(res, |
1919 |
|
"<td><form method=GET action=/%s>" |
1920 |
|
"<input type=hidden value='%s' name=action>" |
1921 |
|
"<input type=submit value='%s' style='font-size: 12pt'>" |
1922 |
|
"</form></td></tr></table>", |
1923 |
|
s->name, action[s->do_monitor], label[s->do_monitor]); |
1924 |
|
|
1925 |
|
} |
1926 |
|
|
1927 |
|
|
1928 |
|
static void print_depend(HttpResponse res, Service_T s) { |
1929 |
|
|
1930 |
|
Dependant_T d; |
1931 |
|
|
1932 |
|
for(d= s->dependantlist; d; d= d->next) { |
1933 |
|
if(d->dependant != NULL) { |
1934 |
|
out_print(res,"<tr><td>Depends on service </td>" |
1935 |
|
"<td> <a href=%s> %s </a></td></tr>", |
1936 |
|
d->dependant, d->dependant); |
1937 |
|
} |
1938 |
|
} |
1939 |
|
|
1940 |
|
} |
1941 |
|
|
1942 |
|
|
1943 |
|
static void print_service_common_params(HttpResponse res, Service_T s) { |
1944 |
|
|
1945 |
|
if(s->group) |
1946 |
|
out_print(res, |
1947 |
|
"<tr><td>Group</td><td><font color='#0000ff'>%s" |
1948 |
|
"</font></td></tr>", s->group); |
1949 |
|
|
1950 |
|
out_print(res, |
1951 |
|
"<tr><td>Monitoring mode</td><td>%s</td></tr>", |
1952 |
|
modenames[s->mode]); |
1953 |
|
|
1954 |
|
out_print(res, |
1955 |
|
"<tr><td>Monitoring status</td><td><font color='#ff8800'>%s" |
1956 |
|
"</font></td></tr>", |
1957 |
|
statusnames[s->do_monitor]); |
1958 |
|
|
1959 |
|
if(s->start) { |
1960 |
|
int i= 0; |
1961 |
|
out_print(res, "<tr><td>Start program</td><td>"); |
1962 |
|
while(s->start->arg[i]) |
1963 |
|
out_print(res, "%s ", s->start->arg[i++]); |
1964 |
|
out_print(res, "</td></tr>"); |
1965 |
|
} |
1966 |
|
|
1967 |
|
if(s->stop) { |
1968 |
|
int i= 0; |
1969 |
|
out_print(res, "<tr><td>Stop program</td><td>"); |
1970 |
|
while(s->stop->arg[i]) |
1971 |
|
out_print(res, "%s ", s->stop->arg[i++]); |
1972 |
|
out_print(res, "</td></tr>"); |
1973 |
|
} |
1974 |
|
|
1975 |
|
out_print(res, |
1976 |
|
"<tr><td>Check service</td><td>Every %d cycle</td></tr>", |
1977 |
|
s->every?s->every:1); |
1978 |
|
|
1979 |
|
if(s->def_timeout) { |
1980 |
|
out_print(res, |
1981 |
|
"<tr><td>Timeout</td><td>" |
1982 |
|
"Timeout if %d restart within %d cycles</td></tr>", |
1983 |
|
s->to_start, s->to_cycle); |
1984 |
|
} |
1985 |
|
|
1986 |
|
} |