203
206
/* left column of the first row */
204
207
printf("<td align=left valign=top width=33%%>\n");
206
if(display_type==DISPLAY_HOST_INFO)
207
snprintf(temp_buffer,sizeof(temp_buffer)-1,"Host Information");
208
else if(display_type==DISPLAY_SERVICE_INFO)
209
snprintf(temp_buffer,sizeof(temp_buffer)-1,"Service Information");
210
else if(display_type==DISPLAY_COMMENTS)
211
snprintf(temp_buffer,sizeof(temp_buffer)-1,"All Host and Service Comments");
212
else if(display_type==DISPLAY_PERFORMANCE)
213
snprintf(temp_buffer,sizeof(temp_buffer)-1,"Performance Information");
214
else if(display_type==DISPLAY_HOSTGROUP_INFO)
215
snprintf(temp_buffer,sizeof(temp_buffer)-1,"Hostgroup Information");
216
else if(display_type==DISPLAY_SERVICEGROUP_INFO)
217
snprintf(temp_buffer,sizeof(temp_buffer)-1,"Servicegroup Information");
218
else if(display_type==DISPLAY_DOWNTIME)
219
snprintf(temp_buffer,sizeof(temp_buffer)-1,"All Host and Service Scheduled Downtime");
220
else if(display_type==DISPLAY_SCHEDULING_QUEUE)
221
snprintf(temp_buffer,sizeof(temp_buffer)-1,"Check Scheduling Queue");
209
if(display_type == DISPLAY_HOST_INFO)
210
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "Host Information");
211
else if(display_type == DISPLAY_SERVICE_INFO)
212
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "Service Information");
213
else if(display_type == DISPLAY_COMMENTS)
214
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "All Host and Service Comments");
215
else if(display_type == DISPLAY_PERFORMANCE)
216
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "Performance Information");
217
else if(display_type == DISPLAY_HOSTGROUP_INFO)
218
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "Hostgroup Information");
219
else if(display_type == DISPLAY_SERVICEGROUP_INFO)
220
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "Servicegroup Information");
221
else if(display_type == DISPLAY_DOWNTIME)
222
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "All Host and Service Scheduled Downtime");
223
else if(display_type == DISPLAY_SCHEDULING_QUEUE)
224
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "Check Scheduling Queue");
223
snprintf(temp_buffer,sizeof(temp_buffer)-1,"Nagios Process Information");
224
temp_buffer[sizeof(temp_buffer)-1]='\x0';
225
display_info_table(temp_buffer,TRUE,¤t_authdata);
226
snprintf(temp_buffer, sizeof(temp_buffer) - 1, "Nagios Process Information");
227
temp_buffer[sizeof(temp_buffer) - 1] = '\x0';
228
display_info_table(temp_buffer, TRUE, ¤t_authdata);
227
230
/* find the host */
228
if(display_type==DISPLAY_HOST_INFO || display_type==DISPLAY_SERVICE_INFO){
230
temp_host=find_host(host_name);
231
grab_host_macros(temp_host);
233
if(display_type==DISPLAY_SERVICE_INFO){
234
temp_service=find_service(host_name,service_desc);
235
grab_service_macros(temp_service);
231
if(display_type == DISPLAY_HOST_INFO || display_type == DISPLAY_SERVICE_INFO) {
233
temp_host = find_host(host_name);
234
grab_host_macros_r(mac, temp_host);
236
if(display_type == DISPLAY_SERVICE_INFO) {
237
temp_service = find_service(host_name, service_desc);
238
grab_service_macros_r(mac, temp_service);
238
241
/* write some Javascript helper functions */
242
if(temp_host != NULL) {
240
243
printf("<SCRIPT LANGUAGE=\"JavaScript\">\n<!--\n");
241
244
printf("function nagios_get_host_name()\n{\n");
242
printf("return \"%s\";\n",temp_host->name);
245
printf("return \"%s\";\n", temp_host->name);
244
247
printf("function nagios_get_host_address()\n{\n");
245
printf("return \"%s\";\n",temp_host->address);
248
printf("return \"%s\";\n", temp_host->address);
247
if(temp_service!=NULL){
250
if(temp_service != NULL) {
248
251
printf("function nagios_get_service_description()\n{\n");
249
printf("return \"%s\";\n",temp_service->description);
252
printf("return \"%s\";\n", temp_service->description);
252
255
printf("//-->\n</SCRIPT>\n");
256
259
/* find the hostgroup */
257
else if(display_type==DISPLAY_HOSTGROUP_INFO){
258
temp_hostgroup=find_hostgroup(hostgroup_name);
259
grab_hostgroup_macros(temp_hostgroup);
260
else if(display_type == DISPLAY_HOSTGROUP_INFO) {
261
temp_hostgroup = find_hostgroup(hostgroup_name);
262
grab_hostgroup_macros_r(mac, temp_hostgroup);
262
265
/* find the servicegroup */
263
else if(display_type==DISPLAY_SERVICEGROUP_INFO){
264
temp_servicegroup=find_servicegroup(servicegroup_name);
265
grab_servicegroup_macros(temp_servicegroup);
266
else if(display_type == DISPLAY_SERVICEGROUP_INFO) {
267
temp_servicegroup = find_servicegroup(servicegroup_name);
268
grab_servicegroup_macros_r(mac, temp_servicegroup);
268
if((display_type==DISPLAY_HOST_INFO && temp_host!=NULL) || (display_type==DISPLAY_SERVICE_INFO && temp_host!=NULL && temp_service!=NULL) || (display_type==DISPLAY_HOSTGROUP_INFO && temp_hostgroup!=NULL) || (display_type==DISPLAY_SERVICEGROUP_INFO && temp_servicegroup!=NULL)){
271
if((display_type == DISPLAY_HOST_INFO && temp_host != NULL) || (display_type == DISPLAY_SERVICE_INFO && temp_host != NULL && temp_service != NULL) || (display_type == DISPLAY_HOSTGROUP_INFO && temp_hostgroup != NULL) || (display_type == DISPLAY_SERVICEGROUP_INFO && temp_servicegroup != NULL)) {
269
272
printf("<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 CLASS='linkBox'>\n");
270
273
printf("<TR><TD CLASS='linkBox'>\n");
271
if(display_type==DISPLAY_SERVICE_INFO)
272
printf("<A HREF='%s?type=%d&host=%s'>View Information For This Host</A><br>\n",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(host_name));
273
if(display_type==DISPLAY_SERVICE_INFO || display_type==DISPLAY_HOST_INFO)
274
printf("<A HREF='%s?host=%s'>View Status Detail For This Host</A><BR>\n",STATUS_CGI,url_encode(host_name));
275
if(display_type==DISPLAY_HOST_INFO){
276
printf("<A HREF='%s?host=%s'>View Alert History For This Host</A><BR>\n",HISTORY_CGI,url_encode(host_name));
278
printf("<A HREF='%s?host=%s'>View Trends For This Host</A><BR>\n",TRENDS_CGI,url_encode(host_name));
281
printf("<A HREF='%s?host=%s'>View Alert Histogram For This Host</A><BR>\n",HISTOGRAM_CGI,url_encode(host_name));
283
printf("<A HREF='%s?host=%s&show_log_entries'>View Availability Report For This Host</A><BR>\n",AVAIL_CGI,url_encode(host_name));
284
printf("<A HREF='%s?host=%s'>View Notifications For This Host</A>\n",NOTIFICATIONS_CGI,url_encode(host_name));
286
else if(display_type==DISPLAY_SERVICE_INFO){
287
printf("<A HREF='%s?host=%s&",HISTORY_CGI,url_encode(host_name));
288
printf("service=%s'>View Alert History For This Service</A><BR>\n",url_encode(service_desc));
290
printf("<A HREF='%s?host=%s&",TRENDS_CGI,url_encode(host_name));
291
printf("service=%s'>View Trends For This Service</A><BR>\n",url_encode(service_desc));
294
printf("<A HREF='%s?host=%s&",HISTOGRAM_CGI,url_encode(host_name));
295
printf("service=%s'>View Alert Histogram For This Service</A><BR>\n",url_encode(service_desc));
297
printf("<A HREF='%s?host=%s&",AVAIL_CGI,url_encode(host_name));
298
printf("service=%s&show_log_entries'>View Availability Report For This Service</A><BR>\n",url_encode(service_desc));
299
printf("<A HREF='%s?host=%s&",NOTIFICATIONS_CGI,url_encode(host_name));
300
printf("service=%s'>View Notifications For This Service</A>\n",url_encode(service_desc));
302
else if(display_type==DISPLAY_HOSTGROUP_INFO){
303
printf("<A HREF='%s?hostgroup=%s&style=detail'>View Status Detail For This Hostgroup</A><BR>\n",STATUS_CGI,url_encode(hostgroup_name));
304
printf("<A HREF='%s?hostgroup=%s&style=overview'>View Status Overview For This Hostgroup</A><BR>\n",STATUS_CGI,url_encode(hostgroup_name));
305
printf("<A HREF='%s?hostgroup=%s&style=grid'>View Status Grid For This Hostgroup</A><BR>\n",STATUS_CGI,url_encode(hostgroup_name));
306
printf("<A HREF='%s?hostgroup=%s'>View Availability For This Hostgroup</A><BR>\n",AVAIL_CGI,url_encode(hostgroup_name));
308
else if(display_type==DISPLAY_SERVICEGROUP_INFO){
309
printf("<A HREF='%s?servicegroup=%s&style=detail'>View Status Detail For This Servicegroup</A><BR>\n",STATUS_CGI,url_encode(servicegroup_name));
310
printf("<A HREF='%s?servicegroup=%s&style=overview'>View Status Overview For This Servicegroup</A><BR>\n",STATUS_CGI,url_encode(servicegroup_name));
311
printf("<A HREF='%s?servicegroup=%s&style=grid'>View Status Grid For This Servicegroup</A><BR>\n",STATUS_CGI,url_encode(servicegroup_name));
312
printf("<A HREF='%s?servicegroup=%s'>View Availability For This Servicegroup</A><BR>\n",AVAIL_CGI,url_encode(servicegroup_name));
274
if(display_type == DISPLAY_SERVICE_INFO)
275
printf("<A HREF='%s?type=%d&host=%s'>View Information For This Host</A><br>\n", EXTINFO_CGI, DISPLAY_HOST_INFO, url_encode(host_name));
276
if(display_type == DISPLAY_SERVICE_INFO || display_type == DISPLAY_HOST_INFO)
277
printf("<A HREF='%s?host=%s'>View Status Detail For This Host</A><BR>\n", STATUS_CGI, url_encode(host_name));
278
if(display_type == DISPLAY_HOST_INFO) {
279
printf("<A HREF='%s?host=%s'>View Alert History For This Host</A><BR>\n", HISTORY_CGI, url_encode(host_name));
281
printf("<A HREF='%s?host=%s'>View Trends For This Host</A><BR>\n", TRENDS_CGI, url_encode(host_name));
284
printf("<A HREF='%s?host=%s'>View Alert Histogram For This Host</A><BR>\n", HISTOGRAM_CGI, url_encode(host_name));
286
printf("<A HREF='%s?host=%s&show_log_entries'>View Availability Report For This Host</A><BR>\n", AVAIL_CGI, url_encode(host_name));
287
printf("<A HREF='%s?host=%s'>View Notifications For This Host</A>\n", NOTIFICATIONS_CGI, url_encode(host_name));
289
else if(display_type == DISPLAY_SERVICE_INFO) {
290
printf("<A HREF='%s?host=%s&", HISTORY_CGI, url_encode(host_name));
291
printf("service=%s'>View Alert History For This Service</A><BR>\n", url_encode(service_desc));
293
printf("<A HREF='%s?host=%s&", TRENDS_CGI, url_encode(host_name));
294
printf("service=%s'>View Trends For This Service</A><BR>\n", url_encode(service_desc));
297
printf("<A HREF='%s?host=%s&", HISTOGRAM_CGI, url_encode(host_name));
298
printf("service=%s'>View Alert Histogram For This Service</A><BR>\n", url_encode(service_desc));
300
printf("<A HREF='%s?host=%s&", AVAIL_CGI, url_encode(host_name));
301
printf("service=%s&show_log_entries'>View Availability Report For This Service</A><BR>\n", url_encode(service_desc));
302
printf("<A HREF='%s?host=%s&", NOTIFICATIONS_CGI, url_encode(host_name));
303
printf("service=%s'>View Notifications For This Service</A>\n", url_encode(service_desc));
305
else if(display_type == DISPLAY_HOSTGROUP_INFO) {
306
printf("<A HREF='%s?hostgroup=%s&style=detail'>View Status Detail For This Hostgroup</A><BR>\n", STATUS_CGI, url_encode(hostgroup_name));
307
printf("<A HREF='%s?hostgroup=%s&style=overview'>View Status Overview For This Hostgroup</A><BR>\n", STATUS_CGI, url_encode(hostgroup_name));
308
printf("<A HREF='%s?hostgroup=%s&style=grid'>View Status Grid For This Hostgroup</A><BR>\n", STATUS_CGI, url_encode(hostgroup_name));
309
printf("<A HREF='%s?hostgroup=%s'>View Availability For This Hostgroup</A><BR>\n", AVAIL_CGI, url_encode(hostgroup_name));
311
else if(display_type == DISPLAY_SERVICEGROUP_INFO) {
312
printf("<A HREF='%s?servicegroup=%s&style=detail'>View Status Detail For This Servicegroup</A><BR>\n", STATUS_CGI, url_encode(servicegroup_name));
313
printf("<A HREF='%s?servicegroup=%s&style=overview'>View Status Overview For This Servicegroup</A><BR>\n", STATUS_CGI, url_encode(servicegroup_name));
314
printf("<A HREF='%s?servicegroup=%s&style=grid'>View Status Grid For This Servicegroup</A><BR>\n", STATUS_CGI, url_encode(servicegroup_name));
315
printf("<A HREF='%s?servicegroup=%s'>View Availability For This Servicegroup</A><BR>\n", AVAIL_CGI, url_encode(servicegroup_name));
314
317
printf("</TD></TR>\n");
315
318
printf("</TABLE>\n");
318
321
printf("</td>\n");
320
323
/* middle column of top row */
321
324
printf("<td align=center valign=middle width=33%%>\n");
323
if((display_type==DISPLAY_HOST_INFO && temp_host!=NULL) || (display_type==DISPLAY_SERVICE_INFO && temp_host!=NULL && temp_service!=NULL) || (display_type==DISPLAY_HOSTGROUP_INFO && temp_hostgroup!=NULL) || (display_type==DISPLAY_SERVICEGROUP_INFO && temp_servicegroup!=NULL)){
326
if((display_type == DISPLAY_HOST_INFO && temp_host != NULL) || (display_type == DISPLAY_SERVICE_INFO && temp_host != NULL && temp_service != NULL) || (display_type == DISPLAY_HOSTGROUP_INFO && temp_hostgroup != NULL) || (display_type == DISPLAY_SERVICEGROUP_INFO && temp_servicegroup != NULL)) {
325
if(display_type==DISPLAY_HOST_INFO){
328
if(display_type == DISPLAY_HOST_INFO) {
326
329
printf("<DIV CLASS='data'>Host</DIV>\n");
327
printf("<DIV CLASS='dataTitle'>%s</DIV>\n",temp_host->alias);
328
printf("<DIV CLASS='dataTitle'>(%s)</DIV><BR>\n",temp_host->name);
330
printf("<DIV CLASS='dataTitle'>%s</DIV>\n", temp_host->alias);
331
printf("<DIV CLASS='dataTitle'>(%s)</DIV><BR>\n", temp_host->name);
330
if (temp_host->parent_hosts != NULL) {
333
if(temp_host->parent_hosts != NULL) {
331
334
/* print all parent hosts */
332
335
printf("<DIV CLASS='data'>Parents:</DIV>\n");
333
for(temp_parenthost=temp_host->parent_hosts;temp_parenthost!=NULL;temp_parenthost=temp_parenthost->next)
334
printf("<DIV CLASS='dataTitle'><A HREF='%s?host=%s'>%s</A></DIV>\n",STATUS_CGI, url_encode(temp_parenthost->host_name),temp_parenthost->host_name);
336
for(temp_parenthost = temp_host->parent_hosts; temp_parenthost != NULL; temp_parenthost = temp_parenthost->next)
337
printf("<DIV CLASS='dataTitle'><A HREF='%s?host=%s'>%s</A></DIV>\n", STATUS_CGI, url_encode(temp_parenthost->host_name), temp_parenthost->host_name);
338
341
printf("<DIV CLASS='data'>Member of</DIV><DIV CLASS='dataTitle'>");
339
for(temp_hostgroup=hostgroup_list;temp_hostgroup!=NULL;temp_hostgroup=temp_hostgroup->next){
340
if(is_host_member_of_hostgroup(temp_hostgroup,temp_host)==TRUE){
343
printf("<A HREF='%s?hostgroup=%s&style=overview'>%s</A>",STATUS_CGI,url_encode(temp_hostgroup->group_name),temp_hostgroup->group_name);
342
for(temp_hostgroup = hostgroup_list; temp_hostgroup != NULL; temp_hostgroup = temp_hostgroup->next) {
343
if(is_host_member_of_hostgroup(temp_hostgroup, temp_host) == TRUE) {
346
printf("<A HREF='%s?hostgroup=%s&style=overview'>%s</A>", STATUS_CGI, url_encode(temp_hostgroup->group_name), temp_hostgroup->group_name);
349
352
printf("No hostgroups");
350
353
printf("</DIV><BR>\n");
351
printf("<DIV CLASS='data'>%s</DIV>\n",temp_host->address);
353
if(display_type==DISPLAY_SERVICE_INFO){
354
printf("<DIV CLASS='data'>Service</DIV><DIV CLASS='dataTitle'>%s</DIV><DIV CLASS='data'>On Host</DIV>\n",service_desc);
355
printf("<DIV CLASS='dataTitle'>%s</DIV>\n",temp_host->alias);
356
printf("<DIV CLASS='dataTitle'>(<A HREF='%s?type=%d&host=%s'>%s</a>)</DIV><BR>\n",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(temp_host->name),temp_host->name);
357
printf("<DIV CLASS='data'>Member of</DIV><DIV CLASS='dataTitle'>");
358
for(temp_servicegroup=servicegroup_list;temp_servicegroup!=NULL;temp_servicegroup=temp_servicegroup->next){
359
if(is_service_member_of_servicegroup(temp_servicegroup,temp_service)==TRUE){
354
printf("<DIV CLASS='data'>%s</DIV>\n", temp_host->address);
356
if(display_type == DISPLAY_SERVICE_INFO) {
357
printf("<DIV CLASS='data'>Service</DIV><DIV CLASS='dataTitle'>%s</DIV><DIV CLASS='data'>On Host</DIV>\n", service_desc);
358
printf("<DIV CLASS='dataTitle'>%s</DIV>\n", temp_host->alias);
359
printf("<DIV CLASS='dataTitle'>(<A HREF='%s?type=%d&host=%s'>%s</a>)</DIV><BR>\n", EXTINFO_CGI, DISPLAY_HOST_INFO, url_encode(temp_host->name), temp_host->name);
360
printf("<DIV CLASS='data'>Member of</DIV><DIV CLASS='dataTitle'>");
361
for(temp_servicegroup = servicegroup_list; temp_servicegroup != NULL; temp_servicegroup = temp_servicegroup->next) {
362
if(is_service_member_of_servicegroup(temp_servicegroup, temp_service) == TRUE) {
362
printf("<A HREF='%s?servicegroup=%s&style=overview'>%s</A>",STATUS_CGI,url_encode(temp_servicegroup->group_name),temp_servicegroup->group_name);
365
printf("<A HREF='%s?servicegroup=%s&style=overview'>%s</A>", STATUS_CGI, url_encode(temp_servicegroup->group_name), temp_servicegroup->group_name);
368
371
printf("No servicegroups.");
369
printf("</DIV><BR>\n");
372
printf("</DIV><BR>\n");
371
printf("<DIV CLASS='data'>%s</DIV>\n",temp_host->address);
374
printf("<DIV CLASS='data'>%s</DIV>\n", temp_host->address);
373
if(display_type==DISPLAY_HOSTGROUP_INFO){
376
if(display_type == DISPLAY_HOSTGROUP_INFO) {
374
377
printf("<DIV CLASS='data'>Hostgroup</DIV>\n");
375
printf("<DIV CLASS='dataTitle'>%s</DIV>\n",temp_hostgroup->alias);
376
printf("<DIV CLASS='dataTitle'>(%s)</DIV>\n",temp_hostgroup->group_name);
377
if(temp_hostgroup->notes!=NULL){
378
process_macros(temp_hostgroup->notes,&processed_string,0);
379
printf("<p>%s</p>",processed_string);
378
printf("<DIV CLASS='dataTitle'>%s</DIV>\n", temp_hostgroup->alias);
379
printf("<DIV CLASS='dataTitle'>(%s)</DIV>\n", temp_hostgroup->group_name);
380
if(temp_hostgroup->notes != NULL) {
381
process_macros_r(mac, temp_hostgroup->notes, &processed_string, 0);
382
printf("<p>%s</p>", processed_string);
380
383
free(processed_string);
383
if(display_type==DISPLAY_SERVICEGROUP_INFO){
386
if(display_type == DISPLAY_SERVICEGROUP_INFO) {
384
387
printf("<DIV CLASS='data'>Servicegroup</DIV>\n");
385
printf("<DIV CLASS='dataTitle'>%s</DIV>\n",temp_servicegroup->alias);
386
printf("<DIV CLASS='dataTitle'>(%s)</DIV>\n",temp_servicegroup->group_name);
387
if(temp_servicegroup->notes!=NULL){
388
process_macros(temp_servicegroup->notes,&processed_string,0);
389
printf("<p>%s</p>",processed_string);
390
free(processed_string);
394
if(display_type==DISPLAY_SERVICE_INFO){
395
if(temp_service->icon_image!=NULL){
396
printf("<img src='%s",url_logo_images_path);
397
process_macros(temp_service->icon_image,&processed_string,0);
398
printf("%s",processed_string);
399
free(processed_string);
400
printf("' border=0 alt='%s' title='%s'><BR CLEAR=ALL>",(temp_service->icon_image_alt==NULL)?"":temp_service->icon_image_alt,(temp_service->icon_image_alt==NULL)?"":temp_service->icon_image_alt);
402
if(temp_service->icon_image_alt!=NULL)
403
printf("<font size=-1><i>( %s )</i></font>\n",temp_service->icon_image_alt);
404
if(temp_service->notes!=NULL){
405
process_macros(temp_service->notes,&processed_string,0);
406
printf("<p>%s</p>\n",processed_string);
407
free(processed_string);
411
if(display_type==DISPLAY_HOST_INFO){
412
if(temp_host->icon_image!=NULL){
413
printf("<img src='%s",url_logo_images_path);
414
process_macros(temp_host->icon_image,&processed_string,0);
415
printf("%s",processed_string);
416
free(processed_string);
417
printf("' border=0 alt='%s' title='%s'><BR CLEAR=ALL>",(temp_host->icon_image_alt==NULL)?"":temp_host->icon_image_alt,(temp_host->icon_image_alt==NULL)?"":temp_host->icon_image_alt);
419
if(temp_host->icon_image_alt!=NULL)
420
printf("<font size=-1><i>( %s )</i><font>\n",temp_host->icon_image_alt);
421
if(temp_host->notes!=NULL){
422
process_macros(temp_host->notes,&processed_string,0);
423
printf("<p>%s</p>\n",processed_string);
424
free(processed_string);
388
printf("<DIV CLASS='dataTitle'>%s</DIV>\n", temp_servicegroup->alias);
389
printf("<DIV CLASS='dataTitle'>(%s)</DIV>\n", temp_servicegroup->group_name);
390
if(temp_servicegroup->notes != NULL) {
391
process_macros_r(mac, temp_servicegroup->notes, &processed_string, 0);
392
printf("<p>%s</p>", processed_string);
393
free(processed_string);
397
if(display_type == DISPLAY_SERVICE_INFO) {
398
if(temp_service->icon_image != NULL) {
399
printf("<img src='%s", url_logo_images_path);
400
process_macros_r(mac, temp_service->icon_image, &processed_string, 0);
401
printf("%s", processed_string);
402
free(processed_string);
403
printf("' border=0 alt='%s' title='%s'><BR CLEAR=ALL>", (temp_service->icon_image_alt == NULL) ? "" : temp_service->icon_image_alt, (temp_service->icon_image_alt == NULL) ? "" : temp_service->icon_image_alt);
405
if(temp_service->icon_image_alt != NULL)
406
printf("<font size=-1><i>( %s )</i></font>\n", temp_service->icon_image_alt);
407
if(temp_service->notes != NULL) {
408
process_macros_r(mac, temp_service->notes, &processed_string, 0);
409
printf("<p>%s</p>\n", processed_string);
410
free(processed_string);
414
if(display_type == DISPLAY_HOST_INFO) {
415
if(temp_host->icon_image != NULL) {
416
printf("<img src='%s", url_logo_images_path);
417
process_macros_r(mac, temp_host->icon_image, &processed_string, 0);
418
printf("%s", processed_string);
419
free(processed_string);
420
printf("' border=0 alt='%s' title='%s'><BR CLEAR=ALL>", (temp_host->icon_image_alt == NULL) ? "" : temp_host->icon_image_alt, (temp_host->icon_image_alt == NULL) ? "" : temp_host->icon_image_alt);
422
if(temp_host->icon_image_alt != NULL)
423
printf("<font size=-1><i>( %s )</i><font>\n", temp_host->icon_image_alt);
424
if(temp_host->notes != NULL) {
425
process_macros_r(mac, temp_host->notes, &processed_string, 0);
426
printf("<p>%s</p>\n", processed_string);
427
free(processed_string);
429
432
printf("</td>\n");
431
434
/* right column of top row */
432
435
printf("<td align=right valign=bottom width=33%%>\n");
434
if(display_type==DISPLAY_HOST_INFO && temp_host!=NULL){
437
if(display_type == DISPLAY_HOST_INFO && temp_host != NULL) {
435
438
printf("<TABLE BORDER='0'>\n");
436
if(temp_host->action_url!=NULL && strcmp(temp_host->action_url,"")){
439
if(temp_host->action_url != NULL && strcmp(temp_host->action_url, "")) {
437
440
printf("<TR><TD ALIGN='right'>\n");
438
441
printf("<A HREF='");
439
process_macros(temp_host->action_url,&processed_string,0);
440
printf("%s",processed_string);
442
process_macros_r(mac, temp_host->action_url, &processed_string, 0);
443
printf("%s", processed_string);
441
444
free(processed_string);
442
printf("' TARGET='%s'><img src='%s%s' border=0 alt='Perform Additional Actions On This Host' title='Perform Additional Actions On This Host'></A>\n",(action_url_target==NULL)?"_blank":action_url_target,url_images_path,ACTION_ICON);
445
printf("' TARGET='%s'><img src='%s%s' border=0 alt='Perform Additional Actions On This Host' title='Perform Additional Actions On This Host'></A>\n", (action_url_target == NULL) ? "_blank" : action_url_target, url_images_path, ACTION_ICON);
443
446
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Actions</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
444
447
printf("</TD></TR>\n");
446
if(temp_host->notes_url!=NULL && strcmp(temp_host->notes_url,"")){
449
if(temp_host->notes_url != NULL && strcmp(temp_host->notes_url, "")) {
447
450
printf("<TR><TD ALIGN='right'>\n");
448
451
printf("<A HREF='");
449
process_macros(temp_host->notes_url,&processed_string,0);
450
printf("%s",processed_string);
452
process_macros_r(mac, temp_host->notes_url, &processed_string, 0);
453
printf("%s", processed_string);
451
454
free(processed_string);
452
455
/*print_extra_host_url(temp_host->name,temp_host->notes_url);*/
453
printf("' TARGET='%s'><img src='%s%s' border=0 alt='View Additional Notes For This Host' title='View Additional Notes For This Host'></A>\n",(notes_url_target==NULL)?"_blank":notes_url_target,url_images_path,NOTES_ICON);
456
printf("' TARGET='%s'><img src='%s%s' border=0 alt='View Additional Notes For This Host' title='View Additional Notes For This Host'></A>\n", (notes_url_target == NULL) ? "_blank" : notes_url_target, url_images_path, NOTES_ICON);
454
457
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Notes</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
455
458
printf("</TD></TR>\n");
457
460
printf("</TABLE>\n");
460
else if(display_type==DISPLAY_SERVICE_INFO && temp_service!=NULL){
463
else if(display_type == DISPLAY_SERVICE_INFO && temp_service != NULL) {
461
464
printf("<TABLE BORDER='0'><TR><TD ALIGN='right'>\n");
462
if(temp_service->action_url!=NULL && strcmp(temp_service->action_url,"")){
465
if(temp_service->action_url != NULL && strcmp(temp_service->action_url, "")) {
463
466
printf("<A HREF='");
464
process_macros(temp_service->action_url,&processed_string,0);
465
printf("%s",processed_string);
467
process_macros_r(mac, temp_service->action_url, &processed_string, 0);
468
printf("%s", processed_string);
466
469
free(processed_string);
467
printf("' TARGET='%s'><img src='%s%s' border=0 alt='Perform Additional Actions On This Service' title='Perform Additional Actions On This Service'></A>\n",(action_url_target==NULL)?"_blank":action_url_target,url_images_path,ACTION_ICON);
470
printf("' TARGET='%s'><img src='%s%s' border=0 alt='Perform Additional Actions On This Service' title='Perform Additional Actions On This Service'></A>\n", (action_url_target == NULL) ? "_blank" : action_url_target, url_images_path, ACTION_ICON);
468
471
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Actions</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
470
if(temp_service->notes_url!=NULL && strcmp(temp_service->notes_url,"")){
473
if(temp_service->notes_url != NULL && strcmp(temp_service->notes_url, "")) {
471
474
printf("<A HREF='");
472
process_macros(temp_service->notes_url,&processed_string,0);
473
printf("%s",processed_string);
475
process_macros_r(mac, temp_service->notes_url, &processed_string, 0);
476
printf("%s", processed_string);
474
477
free(processed_string);
475
printf("' TARGET='%s'><img src='%s%s' border=0 alt='View Additional Notes For This Service' title='View Additional Notes For This Service'></A>\n",(notes_url_target==NULL)?"_blank":notes_url_target,url_images_path,NOTES_ICON);
478
printf("' TARGET='%s'><img src='%s%s' border=0 alt='View Additional Notes For This Service' title='View Additional Notes For This Service'></A>\n", (notes_url_target == NULL) ? "_blank" : notes_url_target, url_images_path, NOTES_ICON);
476
479
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Notes</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
478
481
printf("</TD></TR></TABLE>\n");
481
if(display_type==DISPLAY_HOSTGROUP_INFO && temp_hostgroup!=NULL){
482
printf("<TABLE BORDER='0'>\n");
483
if(temp_hostgroup->action_url!=NULL && strcmp(temp_hostgroup->action_url,"")){
484
printf("<TR><TD ALIGN='right'>\n");
486
print_extra_hostgroup_url(temp_hostgroup->group_name,temp_hostgroup->action_url);
487
printf("' TARGET='%s'><img src='%s%s' border=0 alt='Perform Additional Actions On This Hostgroup' title='Perform Additional Actions On This Hostgroup'></A>\n",(action_url_target==NULL)?"_blank":action_url_target,url_images_path,ACTION_ICON);
488
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Actions</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
489
printf("</TD></TR>\n");
491
if(temp_hostgroup->notes_url!=NULL && strcmp(temp_hostgroup->notes_url,"")){
492
printf("<TR><TD ALIGN='right'>\n");
494
print_extra_hostgroup_url(temp_hostgroup->group_name,temp_hostgroup->notes_url);
495
printf("' TARGET='%s'><img src='%s%s' border=0 alt='View Additional Notes For This Hostgroup' title='View Additional Notes For This Hostgroup'></A>\n",(notes_url_target==NULL)?"_blank":notes_url_target,url_images_path,NOTES_ICON);
496
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Notes</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
497
printf("</TD></TR>\n");
499
printf("</TABLE>\n");
502
else if(display_type==DISPLAY_SERVICEGROUP_INFO && temp_servicegroup!=NULL){
503
printf("<TABLE BORDER='0'>\n");
504
if(temp_servicegroup->action_url!=NULL && strcmp(temp_servicegroup->action_url,"")){
506
print_extra_servicegroup_url(temp_servicegroup->group_name,temp_servicegroup->action_url);
507
printf("' TARGET='%s'><img src='%s%s' border=0 alt='Perform Additional Actions On This Servicegroup' title='Perform Additional Actions On This Servicegroup'></A>\n",(action_url_target==NULL)?"_blank":action_url_target,url_images_path,ACTION_ICON);
508
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Actions</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
510
if(temp_servicegroup->notes_url!=NULL && strcmp(temp_servicegroup->notes_url,"")){
512
print_extra_servicegroup_url(temp_servicegroup->group_name,temp_servicegroup->notes_url);
513
printf("' TARGET='%s'><img src='%s%s' border=0 alt='View Additional Notes For This Servicegroup' title='View Additional Notes For This Servicegroup'></A>\n",(notes_url_target==NULL)?"_blank":notes_url_target,url_images_path,NOTES_ICON);
514
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Notes</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
516
printf("</TABLE>\n");
484
if(display_type == DISPLAY_HOSTGROUP_INFO && temp_hostgroup != NULL) {
485
printf("<TABLE BORDER='0'>\n");
486
if(temp_hostgroup->action_url != NULL && strcmp(temp_hostgroup->action_url, "")) {
487
printf("<TR><TD ALIGN='right'>\n");
489
print_extra_hostgroup_url(temp_hostgroup->group_name, temp_hostgroup->action_url);
490
printf("' TARGET='%s'><img src='%s%s' border=0 alt='Perform Additional Actions On This Hostgroup' title='Perform Additional Actions On This Hostgroup'></A>\n", (action_url_target == NULL) ? "_blank" : action_url_target, url_images_path, ACTION_ICON);
491
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Actions</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
492
printf("</TD></TR>\n");
494
if(temp_hostgroup->notes_url != NULL && strcmp(temp_hostgroup->notes_url, "")) {
495
printf("<TR><TD ALIGN='right'>\n");
497
print_extra_hostgroup_url(temp_hostgroup->group_name, temp_hostgroup->notes_url);
498
printf("' TARGET='%s'><img src='%s%s' border=0 alt='View Additional Notes For This Hostgroup' title='View Additional Notes For This Hostgroup'></A>\n", (notes_url_target == NULL) ? "_blank" : notes_url_target, url_images_path, NOTES_ICON);
499
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Notes</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
500
printf("</TD></TR>\n");
502
printf("</TABLE>\n");
505
else if(display_type == DISPLAY_SERVICEGROUP_INFO && temp_servicegroup != NULL) {
506
printf("<TABLE BORDER='0'>\n");
507
if(temp_servicegroup->action_url != NULL && strcmp(temp_servicegroup->action_url, "")) {
509
print_extra_servicegroup_url(temp_servicegroup->group_name, temp_servicegroup->action_url);
510
printf("' TARGET='%s'><img src='%s%s' border=0 alt='Perform Additional Actions On This Servicegroup' title='Perform Additional Actions On This Servicegroup'></A>\n", (action_url_target == NULL) ? "_blank" : action_url_target, url_images_path, ACTION_ICON);
511
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Actions</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
513
if(temp_servicegroup->notes_url != NULL && strcmp(temp_servicegroup->notes_url, "")) {
515
print_extra_servicegroup_url(temp_servicegroup->group_name, temp_servicegroup->notes_url);
516
printf("' TARGET='%s'><img src='%s%s' border=0 alt='View Additional Notes For This Servicegroup' title='View Additional Notes For This Servicegroup'></A>\n", (notes_url_target == NULL) ? "_blank" : notes_url_target, url_images_path, NOTES_ICON);
517
printf("<BR CLEAR=ALL><FONT SIZE=-1><I>Extra Notes</I></FONT><BR CLEAR=ALL><BR CLEAR=ALL>\n");
519
printf("</TABLE>\n");
519
522
/* display context-sensitive help */
520
if(display_type==DISPLAY_HOST_INFO)
523
if(display_type == DISPLAY_HOST_INFO)
521
524
display_context_help(CONTEXTHELP_EXT_HOST);
522
else if(display_type==DISPLAY_SERVICE_INFO)
525
else if(display_type == DISPLAY_SERVICE_INFO)
523
526
display_context_help(CONTEXTHELP_EXT_SERVICE);
524
else if(display_type==DISPLAY_HOSTGROUP_INFO)
527
else if(display_type == DISPLAY_HOSTGROUP_INFO)
525
528
display_context_help(CONTEXTHELP_EXT_HOSTGROUP);
526
else if(display_type==DISPLAY_SERVICEGROUP_INFO)
529
else if(display_type == DISPLAY_SERVICEGROUP_INFO)
527
530
display_context_help(CONTEXTHELP_EXT_SERVICEGROUP);
528
else if(display_type==DISPLAY_PROCESS_INFO)
531
else if(display_type == DISPLAY_PROCESS_INFO)
529
532
display_context_help(CONTEXTHELP_EXT_PROCESS);
530
else if(display_type==DISPLAY_PERFORMANCE)
533
else if(display_type == DISPLAY_PERFORMANCE)
531
534
display_context_help(CONTEXTHELP_EXT_PERFORMANCE);
532
else if(display_type==DISPLAY_COMMENTS)
535
else if(display_type == DISPLAY_COMMENTS)
533
536
display_context_help(CONTEXTHELP_EXT_COMMENTS);
534
else if(display_type==DISPLAY_DOWNTIME)
537
else if(display_type == DISPLAY_DOWNTIME)
535
538
display_context_help(CONTEXTHELP_EXT_DOWNTIME);
536
else if(display_type==DISPLAY_SCHEDULING_QUEUE)
539
else if(display_type == DISPLAY_SCHEDULING_QUEUE)
537
540
display_context_help(CONTEXTHELP_EXT_QUEUE);
539
542
printf("</td>\n");
573
576
free_downtime_data();
580
void document_header(int use_stylesheet){
583
void document_header(int use_stylesheet) {
581
584
char date_time[MAX_DATETIME_LENGTH];
582
585
time_t current_time;
583
586
time_t expire_time;
585
588
printf("Cache-Control: no-store\r\n");
586
589
printf("Pragma: no-cache\r\n");
587
printf("Refresh: %d\r\n",refresh_rate);
590
printf("Refresh: %d\r\n", refresh_rate);
589
592
time(¤t_time);
590
get_time_string(¤t_time,date_time,(int)sizeof(date_time),HTTP_DATE_TIME);
591
printf("Last-Modified: %s\r\n",date_time);
593
get_time_string(¤t_time, date_time, (int)sizeof(date_time), HTTP_DATE_TIME);
594
printf("Last-Modified: %s\r\n", date_time);
593
expire_time=(time_t)0L;
594
get_time_string(&expire_time,date_time,(int)sizeof(date_time),HTTP_DATE_TIME);
595
printf("Expires: %s\r\n",date_time);
596
expire_time = (time_t)0L;
597
get_time_string(&expire_time, date_time, (int)sizeof(date_time), HTTP_DATE_TIME);
598
printf("Expires: %s\r\n", date_time);
597
600
printf("Content-type: text/html\r\n\r\n");
602
605
printf("<html>\n");
603
606
printf("<head>\n");
604
printf("<link rel=\"shortcut icon\" href=\"%sfavicon.ico\" type=\"image/ico\">\n",url_images_path);
607
printf("<link rel=\"shortcut icon\" href=\"%sfavicon.ico\" type=\"image/ico\">\n", url_images_path);
605
608
printf("<title>\n");
606
609
printf("Extended Information\n");
607
610
printf("</title>\n");
609
if(use_stylesheet==TRUE){
610
printf("<LINK REL='stylesheet' TYPE='text/css' HREF='%s%s'>",url_stylesheets_path,COMMON_CSS);
611
printf("<LINK REL='stylesheet' TYPE='text/css' HREF='%s%s'>",url_stylesheets_path,EXTINFO_CSS);
612
if(use_stylesheet == TRUE) {
613
printf("<LINK REL='stylesheet' TYPE='text/css' HREF='%s%s'>", url_stylesheets_path, COMMON_CSS);
614
printf("<LINK REL='stylesheet' TYPE='text/css' HREF='%s%s'>", url_stylesheets_path, EXTINFO_CSS);
613
616
printf("</head>\n");
615
618
printf("<body CLASS='extinfo'>\n");
617
620
/* include user SSI header */
618
include_ssi_files(EXTINFO_CGI,SSI_HEADER);
621
include_ssi_files(EXTINFO_CGI, SSI_HEADER);
624
void document_footer(void){
627
void document_footer(void) {
629
632
/* include user SSI footer */
630
include_ssi_files(EXTINFO_CGI,SSI_FOOTER);
633
include_ssi_files(EXTINFO_CGI, SSI_FOOTER);
632
635
printf("</body>\n");
633
636
printf("</html>\n");
639
int process_cgivars(void){
642
int process_cgivars(void) {
640
643
char **variables;
645
variables=getcgivars();
648
variables = getcgivars();
647
for(x=0;variables[x]!=NULL;x++){
650
for(x = 0; variables[x] != NULL; x++) {
649
652
/* do some basic length checking on the variable identifier to prevent buffer overflows */
650
if(strlen(variables[x])>=MAX_INPUT_BUFFER-1){
653
if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
655
658
/* we found the display type */
656
else if(!strcmp(variables[x],"type")){
659
else if(!strcmp(variables[x], "type")) {
658
if(variables[x]==NULL){
661
if(variables[x] == NULL) {
662
temp_type=atoi(variables[x]);
663
if(temp_type==DISPLAY_HOST_INFO)
664
display_type=DISPLAY_HOST_INFO;
665
else if(temp_type==DISPLAY_SERVICE_INFO)
666
display_type=DISPLAY_SERVICE_INFO;
667
else if(temp_type==DISPLAY_COMMENTS)
668
display_type=DISPLAY_COMMENTS;
669
else if(temp_type==DISPLAY_PERFORMANCE)
670
display_type=DISPLAY_PERFORMANCE;
671
else if(temp_type==DISPLAY_HOSTGROUP_INFO)
672
display_type=DISPLAY_HOSTGROUP_INFO;
673
else if(temp_type==DISPLAY_SERVICEGROUP_INFO)
674
display_type=DISPLAY_SERVICEGROUP_INFO;
675
else if(temp_type==DISPLAY_DOWNTIME)
676
display_type=DISPLAY_DOWNTIME;
677
else if(temp_type==DISPLAY_SCHEDULING_QUEUE)
678
display_type=DISPLAY_SCHEDULING_QUEUE;
665
temp_type = atoi(variables[x]);
666
if(temp_type == DISPLAY_HOST_INFO)
667
display_type = DISPLAY_HOST_INFO;
668
else if(temp_type == DISPLAY_SERVICE_INFO)
669
display_type = DISPLAY_SERVICE_INFO;
670
else if(temp_type == DISPLAY_COMMENTS)
671
display_type = DISPLAY_COMMENTS;
672
else if(temp_type == DISPLAY_PERFORMANCE)
673
display_type = DISPLAY_PERFORMANCE;
674
else if(temp_type == DISPLAY_HOSTGROUP_INFO)
675
display_type = DISPLAY_HOSTGROUP_INFO;
676
else if(temp_type == DISPLAY_SERVICEGROUP_INFO)
677
display_type = DISPLAY_SERVICEGROUP_INFO;
678
else if(temp_type == DISPLAY_DOWNTIME)
679
display_type = DISPLAY_DOWNTIME;
680
else if(temp_type == DISPLAY_SCHEDULING_QUEUE)
681
display_type = DISPLAY_SCHEDULING_QUEUE;
680
display_type=DISPLAY_PROCESS_INFO;
683
display_type = DISPLAY_PROCESS_INFO;
683
686
/* we found the host name */
684
else if(!strcmp(variables[x],"host")){
687
else if(!strcmp(variables[x], "host")) {
686
if(variables[x]==NULL){
689
if(variables[x] == NULL) {
691
host_name=strdup(variables[x]);
694
host_name = strdup(variables[x]);
695
if(host_name == NULL)
694
697
strip_html_brackets(host_name);
697
700
/* we found the hostgroup name */
698
else if(!strcmp(variables[x],"hostgroup")){
701
else if(!strcmp(variables[x], "hostgroup")) {
700
if(variables[x]==NULL){
703
if(variables[x] == NULL) {
705
hostgroup_name=strdup(variables[x]);
706
if(hostgroup_name==NULL)
708
hostgroup_name = strdup(variables[x]);
709
if(hostgroup_name == NULL)
708
711
strip_html_brackets(hostgroup_name);
711
714
/* we found the service name */
712
else if(!strcmp(variables[x],"service")){
715
else if(!strcmp(variables[x], "service")) {
714
if(variables[x]==NULL){
717
if(variables[x] == NULL) {
719
service_desc=strdup(variables[x]);
720
if(service_desc==NULL)
722
service_desc = strdup(variables[x]);
723
if(service_desc == NULL)
722
725
strip_html_brackets(service_desc);
725
728
/* we found the servicegroup name */
726
else if(!strcmp(variables[x],"servicegroup")){
729
else if(!strcmp(variables[x], "servicegroup")) {
728
if(variables[x]==NULL){
731
if(variables[x] == NULL) {
733
servicegroup_name=strdup(variables[x]);
734
if(servicegroup_name==NULL)
735
servicegroup_name="";
736
servicegroup_name = strdup(variables[x]);
737
if(servicegroup_name == NULL)
738
servicegroup_name = "";
736
739
strip_html_brackets(servicegroup_name);
739
742
/* we found the sort type argument */
740
else if(!strcmp(variables[x],"sorttype")){
743
else if(!strcmp(variables[x], "sorttype")) {
742
if(variables[x]==NULL){
745
if(variables[x] == NULL) {
747
sort_type=atoi(variables[x]);
750
sort_type = atoi(variables[x]);
750
753
/* we found the sort option argument */
751
else if(!strcmp(variables[x],"sortoption")){
754
else if(!strcmp(variables[x], "sortoption")) {
753
if(variables[x]==NULL){
756
if(variables[x] == NULL) {
758
sort_option=atoi(variables[x]);
761
sort_option = atoi(variables[x]);
761
764
/* we found the embed option */
762
else if(!strcmp(variables[x],"embedded"))
765
else if(!strcmp(variables[x], "embedded"))
765
768
/* we found the noheader option */
766
else if(!strcmp(variables[x],"noheader"))
767
display_header=FALSE;
769
else if(!strcmp(variables[x], "noheader"))
770
display_header = FALSE;
770
773
/* free memory allocated to the CGI variables */
771
774
free_cgivars(variables);
778
void show_process_info(void){
781
void show_process_info(void) {
779
782
char date_time[MAX_DATETIME_LENGTH];
780
783
time_t current_time;
781
784
unsigned long run_time;
782
785
char run_time_string[24];
788
791
/* make sure the user has rights to view system information */
789
if(is_authorized_for_system_information(¤t_authdata)==FALSE){
792
if(is_authorized_for_system_information(¤t_authdata) == FALSE) {
791
794
printf("<P><DIV CLASS='errorMessage'>It appears as though you do not have permission to view process information...</DIV></P>\n");
792
795
printf("<P><DIV CLASS='errorDescription'>If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI<br>");
793
796
printf("and check the authorization options in your CGI configuration file.</DIV></P>\n");
798
801
printf("<BR />\n");
799
802
printf("<DIV ALIGN=CENTER>\n");
808
811
printf("<TABLE BORDER=0>\n");
810
813
/* program version */
811
printf("<TR><TD CLASS='dataVar'>Program Version:</TD><TD CLASS='dataVal'>%s</TD></TR>\n",PROGRAM_VERSION);
814
printf("<TR><TD CLASS='dataVar'>Program Version:</TD><TD CLASS='dataVal'>%s</TD></TR>\n", PROGRAM_VERSION);
813
816
/* program start time */
814
get_time_string(&program_start,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
815
printf("<TR><TD CLASS='dataVar'>Program Start Time:</TD><TD CLASS='dataVal'>%s</TD></TR>\n",date_time);
817
get_time_string(&program_start, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
818
printf("<TR><TD CLASS='dataVar'>Program Start Time:</TD><TD CLASS='dataVal'>%s</TD></TR>\n", date_time);
817
820
/* total running time */
818
821
time(¤t_time);
819
run_time=(unsigned long)(current_time-program_start);
820
get_time_breakdown(run_time,&days,&hours,&minutes,&seconds);
821
sprintf(run_time_string,"%dd %dh %dm %ds",days,hours,minutes,seconds);
822
printf("<TR><TD CLASS='dataVar'>Total Running Time:</TD><TD CLASS='dataVal'>%s</TD></TR>\n",run_time_string);
822
run_time = (unsigned long)(current_time - program_start);
823
get_time_breakdown(run_time, &days, &hours, &minutes, &seconds);
824
sprintf(run_time_string, "%dd %dh %dm %ds", days, hours, minutes, seconds);
825
printf("<TR><TD CLASS='dataVar'>Total Running Time:</TD><TD CLASS='dataVal'>%s</TD></TR>\n", run_time_string);
824
827
/* last external check */
825
get_time_string(&last_command_check,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
826
printf("<TR><TD CLASS='dataVar'>Last External Command Check:</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(last_command_check==(time_t)0)?"N/A":date_time);
828
get_time_string(&last_command_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
829
printf("<TR><TD CLASS='dataVar'>Last External Command Check:</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (last_command_check == (time_t)0) ? "N/A" : date_time);
828
831
/* last log file rotation */
829
get_time_string(&last_log_rotation,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
830
printf("<TR><TD CLASS='dataVar'>Last Log File Rotation:</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(last_log_rotation==(time_t)0)?"N/A":date_time);
832
get_time_string(&last_log_rotation, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
833
printf("<TR><TD CLASS='dataVar'>Last Log File Rotation:</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (last_log_rotation == (time_t)0) ? "N/A" : date_time);
833
printf("<TR><TD CLASS='dataVar'>Nagios PID</TD><TD CLASS='dataval'>%d</TD></TR>\n",nagios_pid);
836
printf("<TR><TD CLASS='dataVar'>Nagios PID</TD><TD CLASS='dataVal'>%d</TD></TR>\n", nagios_pid);
835
838
/* notifications enabled */
836
printf("<TR><TD CLASS='dataVar'>Notifications Enabled?</TD><TD CLASS='dataVal'><DIV CLASS='notifications%s'> %s </DIV></TD></TR>\n",(enable_notifications==TRUE)?"ENABLED":"DISABLED",(enable_notifications==TRUE)?"YES":"NO");
839
printf("<TR><TD CLASS='dataVar'>Notifications Enabled?</TD><TD CLASS='dataVal'><DIV CLASS='notifications%s'> %s </DIV></TD></TR>\n", (enable_notifications == TRUE) ? "ENABLED" : "DISABLED", (enable_notifications == TRUE) ? "YES" : "NO");
838
841
/* service check execution enabled */
839
printf("<TR><TD CLASS='dataVar'>Service Checks Being Executed?</TD><TD CLASS='dataVal'><DIV CLASS='checks%s'> %s </DIV></TD></TR>\n",(execute_service_checks==TRUE)?"ENABLED":"DISABLED",(execute_service_checks==TRUE)?"YES":"NO");
842
printf("<TR><TD CLASS='dataVar'>Service Checks Being Executed?</TD><TD CLASS='dataVal'><DIV CLASS='checks%s'> %s </DIV></TD></TR>\n", (execute_service_checks == TRUE) ? "ENABLED" : "DISABLED", (execute_service_checks == TRUE) ? "YES" : "NO");
841
844
/* passive service check acceptance */
842
printf("<TR><TD CLASS='dataVar'>Passive Service Checks Being Accepted?</TD><TD CLASS='dataVal'><DIV CLASS='checks%s'> %s </DIV></TD></TR>\n",(accept_passive_service_checks==TRUE)?"ENABLED":"DISABLED",(accept_passive_service_checks==TRUE)?"YES":"NO");
845
printf("<TR><TD CLASS='dataVar'>Passive Service Checks Being Accepted?</TD><TD CLASS='dataVal'><DIV CLASS='checks%s'> %s </DIV></TD></TR>\n", (accept_passive_service_checks == TRUE) ? "ENABLED" : "DISABLED", (accept_passive_service_checks == TRUE) ? "YES" : "NO");
844
847
/* host check execution enabled */
845
printf("<TR><TD CLASS='dataVar'>Host Checks Being Executed?</TD><TD CLASS='dataVal'><DIV CLASS='checks%s'> %s </DIV></TD></TR>\n",(execute_host_checks==TRUE)?"ENABLED":"DISABLED",(execute_host_checks==TRUE)?"YES":"NO");
848
printf("<TR><TD CLASS='dataVar'>Host Checks Being Executed?</TD><TD CLASS='dataVal'><DIV CLASS='checks%s'> %s </DIV></TD></TR>\n", (execute_host_checks == TRUE) ? "ENABLED" : "DISABLED", (execute_host_checks == TRUE) ? "YES" : "NO");
847
850
/* passive host check acceptance */
848
printf("<TR><TD CLASS='dataVar'>Passive Host Checks Being Accepted?</TD><TD CLASS='dataVal'><DIV CLASS='checks%s'> %s </DIV></TD></TR>\n",(accept_passive_host_checks==TRUE)?"ENABLED":"DISABLED",(accept_passive_host_checks==TRUE)?"YES":"NO");
851
printf("<TR><TD CLASS='dataVar'>Passive Host Checks Being Accepted?</TD><TD CLASS='dataVal'><DIV CLASS='checks%s'> %s </DIV></TD></TR>\n", (accept_passive_host_checks == TRUE) ? "ENABLED" : "DISABLED", (accept_passive_host_checks == TRUE) ? "YES" : "NO");
850
853
/* event handlers enabled */
851
printf("<TR><TD CLASS='dataVar'>Event Handlers Enabled?</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(enable_event_handlers==TRUE)?"Yes":"No");
854
printf("<TR><TD CLASS='dataVar'>Event Handlers Enabled?</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (enable_event_handlers == TRUE) ? "Yes" : "No");
853
856
/* obsessing over services */
854
printf("<TR><TD CLASS='dataVar'>Obsessing Over Services?</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(obsess_over_services==TRUE)?"Yes":"No");
857
printf("<TR><TD CLASS='dataVar'>Obsessing Over Services?</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (obsess_over_services == TRUE) ? "Yes" : "No");
856
859
/* obsessing over hosts */
857
printf("<TR><TD CLASS='dataVar'>Obsessing Over Hosts?</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(obsess_over_hosts==TRUE)?"Yes":"No");
860
printf("<TR><TD CLASS='dataVar'>Obsessing Over Hosts?</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (obsess_over_hosts == TRUE) ? "Yes" : "No");
859
862
/* flap detection enabled */
860
printf("<TR><TD CLASS='dataVar'>Flap Detection Enabled?</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(enable_flap_detection==TRUE)?"Yes":"No");
863
printf("<TR><TD CLASS='dataVar'>Flap Detection Enabled?</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (enable_flap_detection == TRUE) ? "Yes" : "No");
862
865
#ifdef PREDICT_FAILURES
863
866
/* failure prediction enabled */
864
printf("<TR><TD CLASS='dataVar'>Failure Prediction Enabled?</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(enable_failure_prediction==TRUE)?"Yes":"No");
867
printf("<TR><TD CLASS='dataVar'>Failure Prediction Enabled?</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (enable_failure_prediction == TRUE) ? "Yes" : "No");
867
870
/* process performance data */
868
printf("<TR><TD CLASS='dataVar'>Performance Data Being Processed?</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(process_performance_data==TRUE)?"Yes":"No");
871
printf("<TR><TD CLASS='dataVar'>Performance Data Being Processed?</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (process_performance_data == TRUE) ? "Yes" : "No");
870
873
#ifdef USE_OLDCRUD
871
874
/* daemon mode */
872
printf("<TR><TD CLASS='dataVar'>Running As A Daemon?</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(daemon_mode==TRUE)?"Yes":"No");
875
printf("<TR><TD CLASS='dataVar'>Running As A Daemon?</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (daemon_mode == TRUE) ? "Yes" : "No");
875
878
printf("</TABLE>\n");
884
887
printf("<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 CLASS='command'>\n");
885
888
printf("<TR><TD>\n");
887
if(nagios_process_state==STATE_OK){
890
if(nagios_process_state == STATE_OK) {
888
891
printf("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 CLASS='command'>\n");
890
893
#ifndef DUMMY_INSTALL
891
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Shutdown the Nagios Process' TITLE='Shutdown the Nagios Process'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Shutdown the Nagios process</a></td></tr>\n",url_images_path,STOP_ICON,COMMAND_CGI,CMD_SHUTDOWN_PROCESS);
892
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Restart the Nagios Process' TITLE='Restart the Nagios Process'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Restart the Nagios process</a></td></tr>\n",url_images_path,RESTART_ICON,COMMAND_CGI,CMD_RESTART_PROCESS);
894
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Shutdown the Nagios Process' TITLE='Shutdown the Nagios Process'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Shutdown the Nagios process</a></td></tr>\n", url_images_path, STOP_ICON, COMMAND_CGI, CMD_SHUTDOWN_PROCESS);
895
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Restart the Nagios Process' TITLE='Restart the Nagios Process'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Restart the Nagios process</a></td></tr>\n", url_images_path, RESTART_ICON, COMMAND_CGI, CMD_RESTART_PROCESS);
895
if(enable_notifications==TRUE)
896
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Notifications' TITLE='Disable Notifications'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable notifications</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_NOTIFICATIONS);
898
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Notifications' TITLE='Enable Notifications'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable notifications</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_NOTIFICATIONS);
900
if(execute_service_checks==TRUE)
901
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Executing Service Checks' TITLE='Stop Executing Service Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop executing service checks</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_STOP_EXECUTING_SVC_CHECKS);
903
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Executing Service Checks' TITLE='Start Executing Service Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start executing service checks</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_START_EXECUTING_SVC_CHECKS);
905
if(accept_passive_service_checks==TRUE)
906
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Accepting Passive Service Checks' TITLE='Stop Accepting Passive Service Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop accepting passive service checks</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_STOP_ACCEPTING_PASSIVE_SVC_CHECKS);
908
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Accepting Passive Service Checks' TITLE='Start Accepting Passive Service Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start accepting passive service checks</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_START_ACCEPTING_PASSIVE_SVC_CHECKS);
910
if(execute_host_checks==TRUE)
911
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Executing Host Checks' TITLE='Stop Executing Host Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop executing host checks</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_STOP_EXECUTING_HOST_CHECKS);
913
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Executing Host Checks' TITLE='Start Executing Host Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start executing host checks</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_START_EXECUTING_HOST_CHECKS);
915
if(accept_passive_host_checks==TRUE)
916
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Accepting Passive Host Checks' TITLE='Stop Accepting Passive Host Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop accepting passive host checks</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_STOP_ACCEPTING_PASSIVE_HOST_CHECKS);
918
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Accepting Passive Host Checks' TITLE='Start Accepting Passive Host Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start accepting passive host checks</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_START_ACCEPTING_PASSIVE_HOST_CHECKS);
920
if(enable_event_handlers==TRUE)
921
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Event Handlers' TITLE='Disable Event Handlers'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable event handlers</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_EVENT_HANDLERS);
923
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Event Handlers' TITLE='Enable Event Handlers'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable event handlers</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_EVENT_HANDLERS);
925
if(obsess_over_services==TRUE)
926
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Obsessing Over Services' TITLE='Stop Obsessing Over Services'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop obsessing over services</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_STOP_OBSESSING_OVER_SVC_CHECKS);
928
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Obsessing Over Services' TITLE='Start Obsessing Over Services'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start obsessing over services</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_START_OBSESSING_OVER_SVC_CHECKS);
930
if(obsess_over_hosts==TRUE)
931
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Obsessing Over Hosts' TITLE='Stop Obsessing Over Hosts'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop obsessing over hosts</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_STOP_OBSESSING_OVER_HOST_CHECKS);
933
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Obsessing Over Hosts' TITLE='Start Obsessing Over Hosts'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start obsessing over hosts</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_START_OBSESSING_OVER_HOST_CHECKS);
935
if(enable_flap_detection==TRUE)
936
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Flap Detection' TITLE='Disable Flap Detection'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable flap detection</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_FLAP_DETECTION);
938
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Flap Detection' TITLE='Enable Flap Detection'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable flap detection</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_FLAP_DETECTION);
898
if(enable_notifications == TRUE)
899
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Notifications' TITLE='Disable Notifications'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable notifications</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_NOTIFICATIONS);
901
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Notifications' TITLE='Enable Notifications'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable notifications</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_NOTIFICATIONS);
903
if(execute_service_checks == TRUE)
904
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Executing Service Checks' TITLE='Stop Executing Service Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop executing service checks</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_STOP_EXECUTING_SVC_CHECKS);
906
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Executing Service Checks' TITLE='Start Executing Service Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start executing service checks</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_START_EXECUTING_SVC_CHECKS);
908
if(accept_passive_service_checks == TRUE)
909
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Accepting Passive Service Checks' TITLE='Stop Accepting Passive Service Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop accepting passive service checks</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_STOP_ACCEPTING_PASSIVE_SVC_CHECKS);
911
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Accepting Passive Service Checks' TITLE='Start Accepting Passive Service Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start accepting passive service checks</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_START_ACCEPTING_PASSIVE_SVC_CHECKS);
913
if(execute_host_checks == TRUE)
914
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Executing Host Checks' TITLE='Stop Executing Host Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop executing host checks</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_STOP_EXECUTING_HOST_CHECKS);
916
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Executing Host Checks' TITLE='Start Executing Host Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start executing host checks</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_START_EXECUTING_HOST_CHECKS);
918
if(accept_passive_host_checks == TRUE)
919
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Accepting Passive Host Checks' TITLE='Stop Accepting Passive Host Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop accepting passive host checks</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_STOP_ACCEPTING_PASSIVE_HOST_CHECKS);
921
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Accepting Passive Host Checks' TITLE='Start Accepting Passive Host Checks'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start accepting passive host checks</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_START_ACCEPTING_PASSIVE_HOST_CHECKS);
923
if(enable_event_handlers == TRUE)
924
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Event Handlers' TITLE='Disable Event Handlers'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable event handlers</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_EVENT_HANDLERS);
926
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Event Handlers' TITLE='Enable Event Handlers'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable event handlers</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_EVENT_HANDLERS);
928
if(obsess_over_services == TRUE)
929
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Obsessing Over Services' TITLE='Stop Obsessing Over Services'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop obsessing over services</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_STOP_OBSESSING_OVER_SVC_CHECKS);
931
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Obsessing Over Services' TITLE='Start Obsessing Over Services'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start obsessing over services</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_START_OBSESSING_OVER_SVC_CHECKS);
933
if(obsess_over_hosts == TRUE)
934
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Stop Obsessing Over Hosts' TITLE='Stop Obsessing Over Hosts'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Stop obsessing over hosts</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_STOP_OBSESSING_OVER_HOST_CHECKS);
936
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Start Obsessing Over Hosts' TITLE='Start Obsessing Over Hosts'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Start obsessing over hosts</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_START_OBSESSING_OVER_HOST_CHECKS);
938
if(enable_flap_detection == TRUE)
939
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Flap Detection' TITLE='Disable Flap Detection'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable flap detection</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_FLAP_DETECTION);
941
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Flap Detection' TITLE='Enable Flap Detection'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable flap detection</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_FLAP_DETECTION);
940
943
#ifdef PREDICT_FAILURES
941
if(enable_failure_prediction==TRUE)
942
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Failure Prediction' TITLE='Disable Failure Prediction'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable failure prediction</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_FAILURE_PREDICTION);
944
if(enable_failure_prediction == TRUE)
945
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Failure Prediction' TITLE='Disable Failure Prediction'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable failure prediction</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_FAILURE_PREDICTION);
944
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Failure Prediction' TITLE='Enable Failure Prediction'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable failure prediction</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_FAILURE_PREDICTION);
947
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Failure Prediction' TITLE='Enable Failure Prediction'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable failure prediction</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_FAILURE_PREDICTION);
946
if(process_performance_data==TRUE)
947
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Performance Data' TITLE='Disable Performance Data'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable performance data</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_PERFORMANCE_DATA);
949
if(process_performance_data == TRUE)
950
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Disable Performance Data' TITLE='Disable Performance Data'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Disable performance data</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_PERFORMANCE_DATA);
949
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Performance Data' TITLE='Enable Performance Data'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable performance data</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_PERFORMANCE_DATA);
952
printf("<TR CLASS='command'><TD><img src='%s%s' border=0 ALT='Enable Performance Data' TITLE='Enable Performance Data'></td><td CLASS='command'><a href='%s?cmd_typ=%d'>Enable performance data</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_PERFORMANCE_DATA);
951
954
printf("</TABLE>\n");
954
957
printf("<DIV ALIGN=CENTER CLASS='infoMessage'>It appears as though Nagios is not running, so commands are temporarily unavailable...\n");
955
if(!strcmp(nagios_check_command,"")){
958
if(!strcmp(nagios_check_command, "")) {
956
959
printf("<BR><BR>\n");
957
960
printf("Hint: It looks as though you have not defined a command for checking the process state by supplying a value for the <b>nagios_check_command</b> option in the CGI configuration file.<BR>\n");
958
961
printf("Read the documentation for more information on checking the status of the Nagios process in the CGIs.\n");
960
963
printf("</DIV>\n");
963
966
printf("</TD></TR>\n");
964
967
printf("</TABLE>\n");
966
969
printf("</TD></TR></TABLE>\n");
967
970
printf("</DIV>\n");
969
#ifdef REMOVED_081203
971
printf("<DIV ALIGN=CENTER>\n");
973
printf("<DIV CLASS='dataTitle'>Process Status Information</DIV>\n");
975
printf("<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 CLASS='data'>\n");
976
printf("<TR><TD class='stateInfoTable2'>\n");
977
printf("<TABLE BORDER=0>\n");
979
if(nagios_process_state==STATE_OK){
980
strcpy(state_string,"OK");
981
state_class="processOK";
983
else if(nagios_process_state==STATE_WARNING){
984
strcpy(state_string,"WARNING");
985
state_class="processWARNING";
987
else if(nagios_process_state==STATE_CRITICAL){
988
strcpy(state_string,"CRITICAL");
989
state_class="processCRITICAL";
992
strcpy(state_string,"UNKNOWN");
993
state_class="processUNKNOWN";
997
printf("<TR><TD CLASS='dataVar'>Process Status:</TD><TD CLASS='dataVal'><DIV CLASS='%s'> %s </DIV></TD></TR>\n",state_class,state_string);
999
/* process check command result */
1000
printf("<TR><TD CLASS='dataVar'>Check Command Output: </TD><TD CLASS='dataVal'>%s </TD></TR>\n",nagios_process_info);
1002
printf("</TABLE>\n");
1003
printf("</TD></TR>\n");
1004
printf("</TABLE>\n");
1014
void show_host_info(void){
974
void show_host_info(void) {
1015
975
hoststatus *temp_hoststatus;
1016
976
host *temp_host;
1017
977
char date_time[MAX_DATETIME_LENGTH];
1018
978
char state_duration[48];
1019
979
char status_age[48];
1020
980
char state_string[MAX_INPUT_BUFFER];
1027
987
time_t current_time;
1029
int duration_error=FALSE;
989
int duration_error = FALSE;
1032
992
/* get host info */
1033
temp_host=find_host(host_name);
993
temp_host = find_host(host_name);
1035
995
/* make sure the user has rights to view host information */
1036
if(is_authorized_for_host(temp_host,¤t_authdata)==FALSE){
996
if(is_authorized_for_host(temp_host, ¤t_authdata) == FALSE) {
1038
998
printf("<P><DIV CLASS='errorMessage'>It appears as though you do not have permission to view information for this host...</DIV></P>\n");
1039
999
printf("<P><DIV CLASS='errorDescription'>If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI<br>");
1040
1000
printf("and check the authorization options in your CGI configuration file.</DIV></P>\n");
1045
1005
/* get host status info */
1046
temp_hoststatus=find_hoststatus(host_name);
1006
temp_hoststatus = find_hoststatus(host_name);
1048
1008
/* make sure host information exists */
1049
if(temp_host==NULL){
1009
if(temp_host == NULL) {
1050
1010
printf("<P><DIV CLASS='errorMessage'>Error: Host Not Found!</DIV></P>>");
1053
if(temp_hoststatus==NULL){
1013
if(temp_hoststatus == NULL) {
1054
1014
printf("<P><DIV CLASS='errorMessage'>Error: Host Status Information Not Found!</DIV></P");
1076
1036
printf("<TR><TD class='stateInfoTable1'>\n");
1077
1037
printf("<TABLE BORDER=0>\n");
1079
current_time=time(NULL);
1081
duration_error=FALSE;
1082
if(temp_hoststatus->last_state_change==(time_t)0){
1083
if(program_start>current_time)
1084
duration_error=TRUE;
1086
t=current_time-program_start;
1089
if(temp_hoststatus->last_state_change>current_time)
1090
duration_error=TRUE;
1092
t=current_time-temp_hoststatus->last_state_change;
1094
get_time_breakdown((unsigned long)t,&days,&hours,&minutes,&seconds);
1095
if(duration_error==TRUE)
1096
snprintf(state_duration,sizeof(state_duration)-1,"???");
1039
current_time = time(NULL);
1041
duration_error = FALSE;
1042
if(temp_hoststatus->last_state_change == (time_t)0) {
1043
if(program_start > current_time)
1044
duration_error = TRUE;
1046
t = current_time - program_start;
1049
if(temp_hoststatus->last_state_change > current_time)
1050
duration_error = TRUE;
1052
t = current_time - temp_hoststatus->last_state_change;
1054
get_time_breakdown((unsigned long)t, &days, &hours, &minutes, &seconds);
1055
if(duration_error == TRUE)
1056
snprintf(state_duration, sizeof(state_duration) - 1, "???");
1098
snprintf(state_duration,sizeof(state_duration)-1,"%2dd %2dh %2dm %2ds%s",days,hours,minutes,seconds,(temp_hoststatus->last_state_change==(time_t)0)?"+":"");
1099
state_duration[sizeof(state_duration)-1]='\x0';
1101
if(temp_hoststatus->status==HOST_UP){
1102
strcpy(state_string,"UP");
1105
else if(temp_hoststatus->status==HOST_DOWN){
1106
strcpy(state_string,"DOWN");
1107
bg_class="hostDOWN";
1109
else if(temp_hoststatus->status==HOST_UNREACHABLE){
1110
strcpy(state_string,"UNREACHABLE");
1111
bg_class="hostUNREACHABLE";
1114
printf("<TR><TD CLASS='dataVar'>Host Status:</td><td CLASS='dataVal'><DIV CLASS='%s'> %s </DIV> (for %s)%s</td></tr>\n",bg_class,state_string,state_duration,(temp_hoststatus->problem_has_been_acknowledged==TRUE)?" (Has been acknowledged)":"");
1116
printf("<TR><TD CLASS='dataVar' VALIGN='top'>Status Information:</td><td CLASS='dataVal'>%s",(temp_hoststatus->plugin_output==NULL)?"":html_encode(temp_hoststatus->plugin_output,TRUE));
1117
if(enable_splunk_integration==TRUE){
1058
snprintf(state_duration, sizeof(state_duration) - 1, "%2dd %2dh %2dm %2ds%s", days, hours, minutes, seconds, (temp_hoststatus->last_state_change == (time_t)0) ? "+" : "");
1059
state_duration[sizeof(state_duration) - 1] = '\x0';
1061
if(temp_hoststatus->status == HOST_UP) {
1062
strcpy(state_string, "UP");
1063
bg_class = "hostUP";
1065
else if(temp_hoststatus->status == HOST_DOWN) {
1066
strcpy(state_string, "DOWN");
1067
bg_class = "hostDOWN";
1069
else if(temp_hoststatus->status == HOST_UNREACHABLE) {
1070
strcpy(state_string, "UNREACHABLE");
1071
bg_class = "hostUNREACHABLE";
1074
printf("<TR><TD CLASS='dataVar'>Host Status:</td><td CLASS='dataVal'><DIV CLASS='%s'> %s </DIV> (for %s)%s</td></tr>\n", bg_class, state_string, state_duration, (temp_hoststatus->problem_has_been_acknowledged == TRUE) ? " (Has been acknowledged)" : "");
1076
printf("<TR><TD CLASS='dataVar' VALIGN='top'>Status Information:</td><td CLASS='dataVal'>%s", (temp_hoststatus->plugin_output == NULL) ? "" : html_encode(temp_hoststatus->plugin_output, TRUE));
1077
if(enable_splunk_integration == TRUE) {
1118
1078
printf(" ");
1119
asprintf(&buf,"%s %s",temp_host->name,temp_hoststatus->plugin_output);
1120
display_splunk_generic_url(buf,1);
1079
asprintf(&buf, "%s %s", temp_host->name, temp_hoststatus->plugin_output);
1080
display_splunk_generic_url(buf, 1);
1123
if(temp_hoststatus->long_plugin_output!=NULL)
1124
printf("<BR>%s",html_encode(temp_hoststatus->long_plugin_output,TRUE));
1083
if(temp_hoststatus->long_plugin_output != NULL)
1084
printf("<BR>%s", html_encode(temp_hoststatus->long_plugin_output, TRUE));
1125
1085
printf("</TD></TR>\n");
1127
printf("<TR><TD CLASS='dataVar' VALIGN='top'>Performance Data:</td><td CLASS='dataVal'>%s</td></tr>\n",(temp_hoststatus->perf_data==NULL)?"":html_encode(temp_hoststatus->perf_data,TRUE));
1129
printf("<TR><TD CLASS='dataVar'>Current Attempt:</TD><TD CLASS='dataVal'>%d/%d",temp_hoststatus->current_attempt,temp_hoststatus->max_attempts);
1130
printf(" (%s state)</TD></TR>\n",(temp_hoststatus->state_type==HARD_STATE)?"HARD":"SOFT");
1132
get_time_string(&temp_hoststatus->last_check,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1133
printf("<TR><TD CLASS='dataVar'>Last Check Time:</td><td CLASS='dataVal'>%s</td></tr>\n",date_time);
1135
printf("<TR><TD CLASS='dataVar'>Check Type:</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(temp_hoststatus->check_type==HOST_CHECK_ACTIVE)?"ACTIVE":"PASSIVE");
1087
printf("<TR><TD CLASS='dataVar' VALIGN='top'>Performance Data:</td><td CLASS='dataVal'>%s</td></tr>\n", (temp_hoststatus->perf_data == NULL) ? "" : html_encode(temp_hoststatus->perf_data, TRUE));
1089
printf("<TR><TD CLASS='dataVar'>Current Attempt:</TD><TD CLASS='dataVal'>%d/%d", temp_hoststatus->current_attempt, temp_hoststatus->max_attempts);
1090
printf(" (%s state)</TD></TR>\n", (temp_hoststatus->state_type == HARD_STATE) ? "HARD" : "SOFT");
1092
get_time_string(&temp_hoststatus->last_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1093
printf("<TR><TD CLASS='dataVar'>Last Check Time:</td><td CLASS='dataVal'>%s</td></tr>\n", date_time);
1095
printf("<TR><TD CLASS='dataVar'>Check Type:</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (temp_hoststatus->check_type == HOST_CHECK_ACTIVE) ? "ACTIVE" : "PASSIVE");
1137
1097
printf("<TR><TD CLASS='dataVar' NOWRAP>Check Latency / Duration:</TD><TD CLASS='dataVal'>");
1138
if(temp_hoststatus->check_type==HOST_CHECK_ACTIVE)
1139
printf("%.3f",temp_hoststatus->latency);
1098
if(temp_hoststatus->check_type == HOST_CHECK_ACTIVE)
1099
printf("%.3f", temp_hoststatus->latency);
1142
printf(" / %.3f seconds",temp_hoststatus->execution_time);
1102
printf(" / %.3f seconds", temp_hoststatus->execution_time);
1143
1103
printf("</TD></TR>\n");
1145
get_time_string(&temp_hoststatus->next_check,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1146
printf("<TR><TD CLASS='dataVar'>Next Scheduled Active Check: </TD><TD CLASS='dataVal'>%s</TD></TR>\n",(temp_hoststatus->checks_enabled && temp_hoststatus->next_check!=(time_t)0 && temp_hoststatus->should_be_scheduled==TRUE)?date_time:"N/A");
1148
get_time_string(&temp_hoststatus->last_state_change,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1149
printf("<TR><TD CLASS='dataVar'>Last State Change:</td><td CLASS='dataVal'>%s</td></tr>\n",(temp_hoststatus->last_state_change==(time_t)0)?"N/A":date_time);
1151
get_time_string(&temp_hoststatus->last_notification,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1152
printf("<TR><TD CLASS='dataVar'>Last Notification:</td><td CLASS='dataVal'>%s (notification %d)</td></tr>\n",(temp_hoststatus->last_notification==(time_t)0)?"N/A":date_time,temp_hoststatus->current_notification_number);
1105
get_time_string(&temp_hoststatus->next_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1106
printf("<TR><TD CLASS='dataVar'>Next Scheduled Active Check: </TD><TD CLASS='dataVal'>%s</TD></TR>\n", (temp_hoststatus->checks_enabled && temp_hoststatus->next_check != (time_t)0 && temp_hoststatus->should_be_scheduled == TRUE) ? date_time : "N/A");
1108
get_time_string(&temp_hoststatus->last_state_change, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1109
printf("<TR><TD CLASS='dataVar'>Last State Change:</td><td CLASS='dataVal'>%s</td></tr>\n", (temp_hoststatus->last_state_change == (time_t)0) ? "N/A" : date_time);
1111
get_time_string(&temp_hoststatus->last_notification, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1112
printf("<TR><TD CLASS='dataVar'>Last Notification:</td><td CLASS='dataVal'>%s (notification %d)</td></tr>\n", (temp_hoststatus->last_notification == (time_t)0) ? "N/A" : date_time, temp_hoststatus->current_notification_number);
1154
1114
printf("<TR><TD CLASS='dataVar'>Is This Host Flapping?</td><td CLASS='dataVal'>");
1155
if(temp_hoststatus->flap_detection_enabled==FALSE || enable_flap_detection==FALSE)
1115
if(temp_hoststatus->flap_detection_enabled == FALSE || enable_flap_detection == FALSE)
1158
printf("<DIV CLASS='%sflapping'> %s </DIV> (%3.2f%% state change)",(temp_hoststatus->is_flapping==TRUE)?"":"not",(temp_hoststatus->is_flapping==TRUE)?"YES":"NO",temp_hoststatus->percent_state_change);
1118
printf("<DIV CLASS='%sflapping'> %s </DIV> (%3.2f%% state change)", (temp_hoststatus->is_flapping == TRUE) ? "" : "not", (temp_hoststatus->is_flapping == TRUE) ? "YES" : "NO", temp_hoststatus->percent_state_change);
1159
1119
printf("</td></tr>\n");
1161
printf("<TR><TD CLASS='dataVar'>In Scheduled Downtime?</td><td CLASS='dataVal'><DIV CLASS='downtime%s'> %s </DIV></td></tr>\n",(temp_hoststatus->scheduled_downtime_depth>0)?"ACTIVE":"INACTIVE",(temp_hoststatus->scheduled_downtime_depth>0)?"YES":"NO");
1164
duration_error=FALSE;
1165
if(temp_hoststatus->last_check>current_time)
1166
duration_error=TRUE;
1168
/*t=current_time-temp_hoststatus->last_check;*/
1169
t=current_time-temp_hoststatus->last_update;
1170
get_time_breakdown((unsigned long)t,&days,&hours,&minutes,&seconds);
1171
if(duration_error==TRUE)
1172
snprintf(status_age,sizeof(status_age)-1,"???");
1173
else if(temp_hoststatus->last_check==(time_t)0)
1174
snprintf(status_age,sizeof(status_age)-1,"N/A");
1176
snprintf(status_age,sizeof(status_age)-1,"%2dd %2dh %2dm %2ds",days,hours,minutes,seconds);
1177
status_age[sizeof(status_age)-1]='\x0';
1179
get_time_string(&temp_hoststatus->last_update,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1180
printf("<TR><TD CLASS='dataVar'>Last Update:</td><td CLASS='dataVal'>%s (%s ago)</td></tr>\n",(temp_hoststatus->last_update==(time_t)0)?"N/A":date_time,status_age);
1121
printf("<TR><TD CLASS='dataVar'>In Scheduled Downtime?</td><td CLASS='dataVal'><DIV CLASS='downtime%s'> %s </DIV></td></tr>\n", (temp_hoststatus->scheduled_downtime_depth > 0) ? "ACTIVE" : "INACTIVE", (temp_hoststatus->scheduled_downtime_depth > 0) ? "YES" : "NO");
1124
duration_error = FALSE;
1125
if(temp_hoststatus->last_check > current_time)
1126
duration_error = TRUE;
1128
/*t=current_time-temp_hoststatus->last_check;*/
1129
t = current_time - temp_hoststatus->last_update;
1130
get_time_breakdown((unsigned long)t, &days, &hours, &minutes, &seconds);
1131
if(duration_error == TRUE)
1132
snprintf(status_age, sizeof(status_age) - 1, "???");
1133
else if(temp_hoststatus->last_check == (time_t)0)
1134
snprintf(status_age, sizeof(status_age) - 1, "N/A");
1136
snprintf(status_age, sizeof(status_age) - 1, "%2dd %2dh %2dm %2ds", days, hours, minutes, seconds);
1137
status_age[sizeof(status_age) - 1] = '\x0';
1139
get_time_string(&temp_hoststatus->last_update, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1140
printf("<TR><TD CLASS='dataVar'>Last Update:</td><td CLASS='dataVal'>%s (%s ago)</td></tr>\n", (temp_hoststatus->last_update == (time_t)0) ? "N/A" : date_time, status_age);
1182
1142
printf("</TABLE>\n");
1183
1143
printf("</TD></TR>\n");
1222
1182
printf("<TABLE BORDER='1' CELLPADDING=0 CELLSPACING=0><TR><TD>\n");
1224
if(nagios_process_state==STATE_OK && is_authorized_for_read_only(¤t_authdata)==FALSE){
1184
if(nagios_process_state == STATE_OK && is_authorized_for_read_only(¤t_authdata) == FALSE) {
1226
1186
printf("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 CLASS='command'>\n");
1227
1187
#ifdef USE_STATUSMAP
1228
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Locate Host On Map' TITLE='Locate Host On Map'></td><td CLASS='command'><a href='%s?host=%s'>Locate host on map</a></td></tr>\n",url_images_path,STATUSMAP_ICON,STATUSMAP_CGI,url_encode(host_name));
1188
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Locate Host On Map' TITLE='Locate Host On Map'></td><td CLASS='command'><a href='%s?host=%s'>Locate host on map</a></td></tr>\n", url_images_path, STATUSMAP_ICON, STATUSMAP_CGI, url_encode(host_name));
1230
if(temp_hoststatus->checks_enabled==TRUE){
1231
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Active Checks Of This Host' TITLE='Disable Active Checks Of This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable active checks of this host</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_HOST_CHECK,url_encode(host_name));
1234
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Active Checks Of This Host' TITLE='Enable Active Checks Of This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable active checks of this host</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_HOST_CHECK,url_encode(host_name));
1235
printf("<tr CLASS='data'><td><img src='%s%s' border=0 ALT='Re-schedule Next Host Check' TITLE='Re-schedule Next Host Check'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s%s'>Re-schedule the next check of this host</a></td></tr>\n",url_images_path,DELAY_ICON,COMMAND_CGI,CMD_SCHEDULE_HOST_CHECK,url_encode(host_name),(temp_hoststatus->checks_enabled==TRUE)?"&force_check":"");
1237
if(temp_hoststatus->accept_passive_host_checks==TRUE){
1238
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Submit Passive Check Result For This Host' TITLE='Submit Passive Check Result For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Submit passive check result for this host</a></td></tr>\n",url_images_path,PASSIVE_ICON,COMMAND_CGI,CMD_PROCESS_HOST_CHECK_RESULT,url_encode(host_name));
1239
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Stop Accepting Passive Checks For This Host' TITLE='Stop Accepting Passive Checks For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Stop accepting passive checks for this host</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_PASSIVE_HOST_CHECKS,url_encode(host_name));
1242
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Start Accepting Passive Checks For This Host' TITLE='Start Accepting Passive Checks For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Start accepting passive checks for this host</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_PASSIVE_HOST_CHECKS,url_encode(host_name));
1244
if(temp_hoststatus->obsess_over_host==TRUE)
1245
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Stop Obsessing Over This Host' TITLE='Stop Obsessing Over This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Stop obsessing over this host</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_STOP_OBSESSING_OVER_HOST,url_encode(host_name));
1247
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Start Obsessing Over This Host' TITLE='Start Obsessing Over This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Start obsessing over this host</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_START_OBSESSING_OVER_HOST,url_encode(host_name));
1249
if(temp_hoststatus->status==HOST_DOWN || temp_hoststatus->status==HOST_UNREACHABLE){
1250
if(temp_hoststatus->problem_has_been_acknowledged==FALSE)
1251
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Acknowledge This Host Problem' TITLE='Acknowledge This Host Problem'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Acknowledge this host problem</a></td></tr>\n",url_images_path,ACKNOWLEDGEMENT_ICON,COMMAND_CGI,CMD_ACKNOWLEDGE_HOST_PROBLEM,url_encode(host_name));
1190
if(temp_hoststatus->checks_enabled == TRUE) {
1191
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Active Checks Of This Host' TITLE='Disable Active Checks Of This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable active checks of this host</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_HOST_CHECK, url_encode(host_name));
1194
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Active Checks Of This Host' TITLE='Enable Active Checks Of This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable active checks of this host</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_HOST_CHECK, url_encode(host_name));
1195
printf("<tr CLASS='data'><td><img src='%s%s' border=0 ALT='Re-schedule Next Host Check' TITLE='Re-schedule Next Host Check'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s%s'>Re-schedule the next check of this host</a></td></tr>\n", url_images_path, DELAY_ICON, COMMAND_CGI, CMD_SCHEDULE_HOST_CHECK, url_encode(host_name), (temp_hoststatus->checks_enabled == TRUE) ? "&force_check" : "");
1197
if(temp_hoststatus->accept_passive_host_checks == TRUE) {
1198
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Submit Passive Check Result For This Host' TITLE='Submit Passive Check Result For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Submit passive check result for this host</a></td></tr>\n", url_images_path, PASSIVE_ICON, COMMAND_CGI, CMD_PROCESS_HOST_CHECK_RESULT, url_encode(host_name));
1199
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Stop Accepting Passive Checks For This Host' TITLE='Stop Accepting Passive Checks For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Stop accepting passive checks for this host</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_PASSIVE_HOST_CHECKS, url_encode(host_name));
1202
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Start Accepting Passive Checks For This Host' TITLE='Start Accepting Passive Checks For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Start accepting passive checks for this host</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_PASSIVE_HOST_CHECKS, url_encode(host_name));
1204
if(temp_hoststatus->obsess_over_host == TRUE)
1205
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Stop Obsessing Over This Host' TITLE='Stop Obsessing Over This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Stop obsessing over this host</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_STOP_OBSESSING_OVER_HOST, url_encode(host_name));
1207
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Start Obsessing Over This Host' TITLE='Start Obsessing Over This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Start obsessing over this host</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_START_OBSESSING_OVER_HOST, url_encode(host_name));
1209
if(temp_hoststatus->status == HOST_DOWN || temp_hoststatus->status == HOST_UNREACHABLE) {
1210
if(temp_hoststatus->problem_has_been_acknowledged == FALSE)
1211
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Acknowledge This Host Problem' TITLE='Acknowledge This Host Problem'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Acknowledge this host problem</a></td></tr>\n", url_images_path, ACKNOWLEDGEMENT_ICON, COMMAND_CGI, CMD_ACKNOWLEDGE_HOST_PROBLEM, url_encode(host_name));
1253
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Remove Problem Acknowledgement' TITLE='Remove Problem Acknowledgement'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Remove problem acknowledgement</a></td></tr>\n",url_images_path,REMOVE_ACKNOWLEDGEMENT_ICON,COMMAND_CGI,CMD_REMOVE_HOST_ACKNOWLEDGEMENT,url_encode(host_name));
1256
if(temp_hoststatus->notifications_enabled==TRUE)
1257
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Notifications For This Host' TITLE='Disable Notifications For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable notifications for this host</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_HOST_NOTIFICATIONS,url_encode(host_name));
1259
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Notifications For This Host' TITLE='Enable Notifications For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable notifications for this host</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_HOST_NOTIFICATIONS,url_encode(host_name));
1261
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Send Custom Notification' TITLE='Send Custom Notification'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Send custom host notification</a></td></tr>\n",url_images_path,NOTIFICATION_ICON,COMMAND_CGI,CMD_SEND_CUSTOM_HOST_NOTIFICATION,url_encode(host_name));
1263
if(temp_hoststatus->status!=HOST_UP)
1264
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Delay Next Host Notification' TITLE='Delay Next Host Notification'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Delay next host notification</a></td></tr>\n",url_images_path,DELAY_ICON,COMMAND_CGI,CMD_DELAY_HOST_NOTIFICATION,url_encode(host_name));
1266
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Schedule Downtime For This Host' TITLE='Schedule Downtime For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Schedule downtime for this host</a></td></tr>\n",url_images_path,DOWNTIME_ICON,COMMAND_CGI,CMD_SCHEDULE_HOST_DOWNTIME,url_encode(host_name));
1268
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Schedule Downtime For All Services On This Host' TITLE='Schedule Downtime For All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Schedule downtime for all services on this host</a></td></tr>\n",url_images_path,DOWNTIME_ICON,COMMAND_CGI,CMD_SCHEDULE_HOST_SVC_DOWNTIME,url_encode(host_name));
1271
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Cancel Scheduled Downtime For This Host' TITLE='Cancel Scheduled Downtime For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Cancel scheduled downtime for this host</a></td></tr>\n",url_images_path,SCHEDULED_DOWNTIME_ICON,COMMAND_CGI,CMD_CANCEL_HOST_DOWNTIME,url_encode(host_name));
1274
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Notifications For All Services On This Host' TITLE='Disable Notifications For All Services On This Host'></td><td CLASS='command' NOWRAP><a href='%s?cmd_typ=%d&host=%s'>Disable notifications for all services on this host</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_HOST_SVC_NOTIFICATIONS,url_encode(host_name));
1276
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Notifications For All Services On This Host' TITLE='Enable Notifications For All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable notifications for all services on this host</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_HOST_SVC_NOTIFICATIONS,url_encode(host_name));
1278
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Schedule A Check Of All Services On This Host' TITLE='Schedule A Check Of All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Schedule a check of all services on this host</a></td></tr>\n",url_images_path,DELAY_ICON,COMMAND_CGI,CMD_SCHEDULE_HOST_SVC_CHECKS,url_encode(host_name));
1280
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Checks Of All Services On This Host' TITLE='Disable Checks Of All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable checks of all services on this host</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_HOST_SVC_CHECKS,url_encode(host_name));
1282
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Checks Of All Services On This Host' TITLE='Enable Checks Of All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable checks of all services on this host</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_HOST_SVC_CHECKS,url_encode(host_name));
1284
if(temp_hoststatus->event_handler_enabled==TRUE)
1285
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Event Handler For This Host' TITLE='Disable Event Handler For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable event handler for this host</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_HOST_EVENT_HANDLER,url_encode(host_name));
1287
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Event Handler For This Host' TITLE='Enable Event Handler For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable event handler for this host</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_HOST_EVENT_HANDLER,url_encode(host_name));
1288
if(temp_hoststatus->flap_detection_enabled==TRUE)
1289
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Flap Detection For This Host' TITLE='Disable Flap Detection For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable flap detection for this host</a></td></tr>\n",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_HOST_FLAP_DETECTION,url_encode(host_name));
1291
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Flap Detection For This Host' TITLE='Enable Flap Detection For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable flap detection for this host</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_HOST_FLAP_DETECTION,url_encode(host_name));
1213
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Remove Problem Acknowledgement' TITLE='Remove Problem Acknowledgement'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Remove problem acknowledgement</a></td></tr>\n", url_images_path, REMOVE_ACKNOWLEDGEMENT_ICON, COMMAND_CGI, CMD_REMOVE_HOST_ACKNOWLEDGEMENT, url_encode(host_name));
1216
if(temp_hoststatus->notifications_enabled == TRUE)
1217
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Notifications For This Host' TITLE='Disable Notifications For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable notifications for this host</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_HOST_NOTIFICATIONS, url_encode(host_name));
1219
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Notifications For This Host' TITLE='Enable Notifications For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable notifications for this host</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_HOST_NOTIFICATIONS, url_encode(host_name));
1221
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Send Custom Notification' TITLE='Send Custom Notification'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Send custom host notification</a></td></tr>\n", url_images_path, NOTIFICATION_ICON, COMMAND_CGI, CMD_SEND_CUSTOM_HOST_NOTIFICATION, url_encode(host_name));
1223
if(temp_hoststatus->status != HOST_UP)
1224
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Delay Next Host Notification' TITLE='Delay Next Host Notification'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Delay next host notification</a></td></tr>\n", url_images_path, DELAY_ICON, COMMAND_CGI, CMD_DELAY_HOST_NOTIFICATION, url_encode(host_name));
1226
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Schedule Downtime For This Host' TITLE='Schedule Downtime For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Schedule downtime for this host</a></td></tr>\n", url_images_path, DOWNTIME_ICON, COMMAND_CGI, CMD_SCHEDULE_HOST_DOWNTIME, url_encode(host_name));
1228
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Schedule Downtime For All Services On This Host' TITLE='Schedule Downtime For All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Schedule downtime for all services on this host</a></td></tr>\n", url_images_path, DOWNTIME_ICON, COMMAND_CGI, CMD_SCHEDULE_HOST_SVC_DOWNTIME, url_encode(host_name));
1230
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Notifications For All Services On This Host' TITLE='Disable Notifications For All Services On This Host'></td><td CLASS='command' NOWRAP><a href='%s?cmd_typ=%d&host=%s'>Disable notifications for all services on this host</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_HOST_SVC_NOTIFICATIONS, url_encode(host_name));
1232
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Notifications For All Services On This Host' TITLE='Enable Notifications For All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable notifications for all services on this host</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_HOST_SVC_NOTIFICATIONS, url_encode(host_name));
1234
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Schedule A Check Of All Services On This Host' TITLE='Schedule A Check Of All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Schedule a check of all services on this host</a></td></tr>\n", url_images_path, DELAY_ICON, COMMAND_CGI, CMD_SCHEDULE_HOST_SVC_CHECKS, url_encode(host_name));
1236
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Checks Of All Services On This Host' TITLE='Disable Checks Of All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable checks of all services on this host</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_HOST_SVC_CHECKS, url_encode(host_name));
1238
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Checks Of All Services On This Host' TITLE='Enable Checks Of All Services On This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable checks of all services on this host</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_HOST_SVC_CHECKS, url_encode(host_name));
1240
if(temp_hoststatus->event_handler_enabled == TRUE)
1241
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Event Handler For This Host' TITLE='Disable Event Handler For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable event handler for this host</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_HOST_EVENT_HANDLER, url_encode(host_name));
1243
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Event Handler For This Host' TITLE='Enable Event Handler For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable event handler for this host</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_HOST_EVENT_HANDLER, url_encode(host_name));
1244
if(temp_hoststatus->flap_detection_enabled == TRUE)
1245
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Flap Detection For This Host' TITLE='Disable Flap Detection For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable flap detection for this host</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_HOST_FLAP_DETECTION, url_encode(host_name));
1247
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Flap Detection For This Host' TITLE='Enable Flap Detection For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable flap detection for this host</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_HOST_FLAP_DETECTION, url_encode(host_name));
1293
1249
printf("</TABLE>\n");
1295
else if (is_authorized_for_read_only(¤t_authdata)==TRUE){
1296
printf("<DIV ALIGN=CENTER CLASS='infoMessage'>Your account does not have permissions to execute commands.<br>\n");
1251
else if(is_authorized_for_read_only(¤t_authdata) == TRUE) {
1252
printf("<DIV ALIGN=CENTER CLASS='infoMessage'>Your account does not have permissions to execute commands.<br>\n");
1299
1255
printf("<DIV ALIGN=CENTER CLASS='infoMessage'>It appears as though Nagios is not running, so commands are temporarily unavailable...<br>\n");
1300
printf("Click <a href='%s?type=%d'>here</a> to view Nagios process information</DIV>\n",EXTINFO_CGI,DISPLAY_PROCESS_INFO);
1256
printf("Click <a href='%s?type=%d'>here</a> to view Nagios process information</DIV>\n", EXTINFO_CGI, DISPLAY_PROCESS_INFO);
1302
1258
printf("</TD></TR></TABLE>\n");
1304
1260
printf("</TD>\n");
1390
1346
printf("<TABLE BORDER=0>\n");
1393
current_time=time(NULL);
1395
duration_error=FALSE;
1396
if(temp_svcstatus->last_state_change==(time_t)0){
1397
if(program_start>current_time)
1398
duration_error=TRUE;
1400
t=current_time-program_start;
1403
if(temp_svcstatus->last_state_change>current_time)
1404
duration_error=TRUE;
1406
t=current_time-temp_svcstatus->last_state_change;
1408
get_time_breakdown((unsigned long)t,&days,&hours,&minutes,&seconds);
1409
if(duration_error==TRUE)
1410
snprintf(state_duration,sizeof(state_duration)-1,"???");
1349
current_time = time(NULL);
1351
duration_error = FALSE;
1352
if(temp_svcstatus->last_state_change == (time_t)0) {
1353
if(program_start > current_time)
1354
duration_error = TRUE;
1356
t = current_time - program_start;
1359
if(temp_svcstatus->last_state_change > current_time)
1360
duration_error = TRUE;
1362
t = current_time - temp_svcstatus->last_state_change;
1364
get_time_breakdown((unsigned long)t, &days, &hours, &minutes, &seconds);
1365
if(duration_error == TRUE)
1366
snprintf(state_duration, sizeof(state_duration) - 1, "???");
1412
snprintf(state_duration,sizeof(state_duration)-1,"%2dd %2dh %2dm %2ds%s",days,hours,minutes,seconds,(temp_svcstatus->last_state_change==(time_t)0)?"+":"");
1413
state_duration[sizeof(state_duration)-1]='\x0';
1415
if(temp_svcstatus->status==SERVICE_OK){
1416
strcpy(state_string,"OK");
1417
bg_class="serviceOK";
1419
else if(temp_svcstatus->status==SERVICE_WARNING){
1420
strcpy(state_string,"WARNING");
1421
bg_class="serviceWARNING";
1423
else if(temp_svcstatus->status==SERVICE_CRITICAL){
1424
strcpy(state_string,"CRITICAL");
1425
bg_class="serviceCRITICAL";
1428
strcpy(state_string,"UNKNOWN");
1429
bg_class="serviceUNKNOWN";
1431
printf("<TR><TD CLASS='dataVar'>Current Status:</TD><TD CLASS='dataVal'><DIV CLASS='%s'> %s </DIV> (for %s)%s</TD></TR>\n",bg_class,state_string,state_duration,(temp_svcstatus->problem_has_been_acknowledged==TRUE)?" (Has been acknowledged)":"");
1433
printf("<TR><TD CLASS='dataVar' VALIGN='top'>Status Information:</TD><TD CLASS='dataVal'>%s",(temp_svcstatus->plugin_output==NULL)?"":html_encode(temp_svcstatus->plugin_output,TRUE));
1434
if(enable_splunk_integration==TRUE){
1368
snprintf(state_duration, sizeof(state_duration) - 1, "%2dd %2dh %2dm %2ds%s", days, hours, minutes, seconds, (temp_svcstatus->last_state_change == (time_t)0) ? "+" : "");
1369
state_duration[sizeof(state_duration) - 1] = '\x0';
1371
if(temp_svcstatus->status == SERVICE_OK) {
1372
strcpy(state_string, "OK");
1373
bg_class = "serviceOK";
1375
else if(temp_svcstatus->status == SERVICE_WARNING) {
1376
strcpy(state_string, "WARNING");
1377
bg_class = "serviceWARNING";
1379
else if(temp_svcstatus->status == SERVICE_CRITICAL) {
1380
strcpy(state_string, "CRITICAL");
1381
bg_class = "serviceCRITICAL";
1384
strcpy(state_string, "UNKNOWN");
1385
bg_class = "serviceUNKNOWN";
1387
printf("<TR><TD CLASS='dataVar'>Current Status:</TD><TD CLASS='dataVal'><DIV CLASS='%s'> %s </DIV> (for %s)%s</TD></TR>\n", bg_class, state_string, state_duration, (temp_svcstatus->problem_has_been_acknowledged == TRUE) ? " (Has been acknowledged)" : "");
1389
printf("<TR><TD CLASS='dataVar' VALIGN='top'>Status Information:</TD><TD CLASS='dataVal'>%s", (temp_svcstatus->plugin_output == NULL) ? "" : html_encode(temp_svcstatus->plugin_output, TRUE));
1390
if(enable_splunk_integration == TRUE) {
1435
1391
printf(" ");
1436
asprintf(&buf,"%s %s %s",temp_service->host_name,temp_service->description,temp_svcstatus->plugin_output);
1437
display_splunk_generic_url(buf,1);
1392
asprintf(&buf, "%s %s %s", temp_service->host_name, temp_service->description, temp_svcstatus->plugin_output);
1393
display_splunk_generic_url(buf, 1);
1440
if(temp_svcstatus->long_plugin_output!=NULL)
1441
printf("<BR>%s",html_encode(temp_svcstatus->long_plugin_output,TRUE));
1396
if(temp_svcstatus->long_plugin_output != NULL)
1397
printf("<BR>%s", html_encode(temp_svcstatus->long_plugin_output, TRUE));
1442
1398
printf("</TD></TR>\n");
1444
printf("<TR><TD CLASS='dataVar' VALIGN='top'>Performance Data:</td><td CLASS='dataVal'>%s</td></tr>\n",(temp_svcstatus->perf_data==NULL)?"":html_encode(temp_svcstatus->perf_data,TRUE));
1446
printf("<TR><TD CLASS='dataVar'>Current Attempt:</TD><TD CLASS='dataVal'>%d/%d",temp_svcstatus->current_attempt,temp_svcstatus->max_attempts);
1447
printf(" (%s state)</TD></TR>\n",(temp_svcstatus->state_type==HARD_STATE)?"HARD":"SOFT");
1449
get_time_string(&temp_svcstatus->last_check,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1450
printf("<TR><TD CLASS='dataVar'>Last Check Time:</TD><TD CLASS='dataVal'>%s</TD></TR>\n",date_time);
1452
printf("<TR><TD CLASS='dataVar'>Check Type:</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(temp_svcstatus->check_type==SERVICE_CHECK_ACTIVE)?"ACTIVE":"PASSIVE");
1400
printf("<TR><TD CLASS='dataVar' VALIGN='top'>Performance Data:</td><td CLASS='dataVal'>%s</td></tr>\n", (temp_svcstatus->perf_data == NULL) ? "" : html_encode(temp_svcstatus->perf_data, TRUE));
1402
printf("<TR><TD CLASS='dataVar'>Current Attempt:</TD><TD CLASS='dataVal'>%d/%d", temp_svcstatus->current_attempt, temp_svcstatus->max_attempts);
1403
printf(" (%s state)</TD></TR>\n", (temp_svcstatus->state_type == HARD_STATE) ? "HARD" : "SOFT");
1405
get_time_string(&temp_svcstatus->last_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1406
printf("<TR><TD CLASS='dataVar'>Last Check Time:</TD><TD CLASS='dataVal'>%s</TD></TR>\n", date_time);
1408
printf("<TR><TD CLASS='dataVar'>Check Type:</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (temp_svcstatus->check_type == SERVICE_CHECK_ACTIVE) ? "ACTIVE" : "PASSIVE");
1454
1410
printf("<TR><TD CLASS='dataVar' NOWRAP>Check Latency / Duration:</TD><TD CLASS='dataVal'>");
1455
if(temp_svcstatus->check_type==SERVICE_CHECK_ACTIVE)
1456
printf("%.3f",temp_svcstatus->latency);
1411
if(temp_svcstatus->check_type == SERVICE_CHECK_ACTIVE)
1412
printf("%.3f", temp_svcstatus->latency);
1459
printf(" / %.3f seconds",temp_svcstatus->execution_time);
1415
printf(" / %.3f seconds", temp_svcstatus->execution_time);
1460
1416
printf("</TD></TR>\n");
1462
get_time_string(&temp_svcstatus->next_check,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1463
printf("<TR><TD CLASS='dataVar'>Next Scheduled Check: </TD><TD CLASS='dataVal'>%s</TD></TR>\n",(temp_svcstatus->checks_enabled && temp_svcstatus->next_check!=(time_t)0 && temp_svcstatus->should_be_scheduled==TRUE)?date_time:"N/A");
1465
get_time_string(&temp_svcstatus->last_state_change,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1466
printf("<TR><TD CLASS='dataVar'>Last State Change:</TD><TD CLASS='dataVal'>%s</TD></TR>\n",(temp_svcstatus->last_state_change==(time_t)0)?"N/A":date_time);
1468
get_time_string(&temp_svcstatus->last_notification,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1469
printf("<TR><TD CLASS='dataVar'>Last Notification:</TD><TD CLASS='dataVal'>%s (notification %d)</TD></TR>\n",(temp_svcstatus->last_notification==(time_t)0)?"N/A":date_time,temp_svcstatus->current_notification_number);
1418
get_time_string(&temp_svcstatus->next_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1419
printf("<TR><TD CLASS='dataVar'>Next Scheduled Check: </TD><TD CLASS='dataVal'>%s</TD></TR>\n", (temp_svcstatus->checks_enabled && temp_svcstatus->next_check != (time_t)0 && temp_svcstatus->should_be_scheduled == TRUE) ? date_time : "N/A");
1421
get_time_string(&temp_svcstatus->last_state_change, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1422
printf("<TR><TD CLASS='dataVar'>Last State Change:</TD><TD CLASS='dataVal'>%s</TD></TR>\n", (temp_svcstatus->last_state_change == (time_t)0) ? "N/A" : date_time);
1424
get_time_string(&temp_svcstatus->last_notification, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1425
printf("<TR><TD CLASS='dataVar'>Last Notification:</TD><TD CLASS='dataVal'>%s (notification %d)</TD></TR>\n", (temp_svcstatus->last_notification == (time_t)0) ? "N/A" : date_time, temp_svcstatus->current_notification_number);
1471
1427
printf("<TR><TD CLASS='dataVar'>Is This Service Flapping?</TD><TD CLASS='dataVal'>");
1472
if(temp_svcstatus->flap_detection_enabled==FALSE || enable_flap_detection==FALSE)
1428
if(temp_svcstatus->flap_detection_enabled == FALSE || enable_flap_detection == FALSE)
1475
printf("<DIV CLASS='%sflapping'> %s </DIV> (%3.2f%% state change)",(temp_svcstatus->is_flapping==TRUE)?"":"not",(temp_svcstatus->is_flapping==TRUE)?"YES":"NO",temp_svcstatus->percent_state_change);
1431
printf("<DIV CLASS='%sflapping'> %s </DIV> (%3.2f%% state change)", (temp_svcstatus->is_flapping == TRUE) ? "" : "not", (temp_svcstatus->is_flapping == TRUE) ? "YES" : "NO", temp_svcstatus->percent_state_change);
1476
1432
printf("</TD></TR>\n");
1478
printf("<TR><TD CLASS='dataVar'>In Scheduled Downtime?</TD><TD CLASS='dataVal'><DIV CLASS='downtime%s'> %s </DIV></TD></TR>\n",(temp_svcstatus->scheduled_downtime_depth>0)?"ACTIVE":"INACTIVE",(temp_svcstatus->scheduled_downtime_depth>0)?"YES":"NO");
1434
printf("<TR><TD CLASS='dataVar'>In Scheduled Downtime?</TD><TD CLASS='dataVal'><DIV CLASS='downtime%s'> %s </DIV></TD></TR>\n", (temp_svcstatus->scheduled_downtime_depth > 0) ? "ACTIVE" : "INACTIVE", (temp_svcstatus->scheduled_downtime_depth > 0) ? "YES" : "NO");
1481
duration_error=FALSE;
1482
if(temp_svcstatus->last_check>current_time)
1483
duration_error=TRUE;
1437
duration_error = FALSE;
1438
if(temp_svcstatus->last_check > current_time)
1439
duration_error = TRUE;
1485
1441
/*t=current_time-temp_svcstatus->last_check;*/
1486
t=current_time-temp_svcstatus->last_update;
1487
get_time_breakdown((unsigned long)t,&days,&hours,&minutes,&seconds);
1488
if(duration_error==TRUE)
1489
snprintf(status_age,sizeof(status_age)-1,"???");
1490
else if(temp_svcstatus->last_check==(time_t)0)
1491
snprintf(status_age,sizeof(status_age)-1,"N/A");
1442
t = current_time - temp_svcstatus->last_update;
1443
get_time_breakdown((unsigned long)t, &days, &hours, &minutes, &seconds);
1444
if(duration_error == TRUE)
1445
snprintf(status_age, sizeof(status_age) - 1, "???");
1446
else if(temp_svcstatus->last_check == (time_t)0)
1447
snprintf(status_age, sizeof(status_age) - 1, "N/A");
1493
snprintf(status_age,sizeof(status_age)-1,"%2dd %2dh %2dm %2ds",days,hours,minutes,seconds);
1494
status_age[sizeof(status_age)-1]='\x0';
1449
snprintf(status_age, sizeof(status_age) - 1, "%2dd %2dh %2dm %2ds", days, hours, minutes, seconds);
1450
status_age[sizeof(status_age) - 1] = '\x0';
1496
get_time_string(&temp_svcstatus->last_update,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
1497
printf("<TR><TD CLASS='dataVar'>Last Update:</TD><TD CLASS='dataVal'>%s (%s ago)</TD></TR>\n",(temp_svcstatus->last_update==(time_t)0)?"N/A":date_time,status_age);
1452
get_time_string(&temp_svcstatus->last_update, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1453
printf("<TR><TD CLASS='dataVar'>Last Update:</TD><TD CLASS='dataVal'>%s (%s ago)</TD></TR>\n", (temp_svcstatus->last_update == (time_t)0) ? "N/A" : date_time, status_age);
1500
1456
printf("</TABLE>\n");
1544
1500
printf("<TABLE BORDER='1' CELLSPACING=0 CELLPADDING=0>\n");
1545
1501
printf("<TR><TD>\n");
1547
if(nagios_process_state==STATE_OK && is_authorized_for_read_only(¤t_authdata)==FALSE){
1503
if(nagios_process_state == STATE_OK && is_authorized_for_read_only(¤t_authdata) == FALSE) {
1548
1504
printf("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 CLASS='command'>\n");
1550
if(temp_svcstatus->checks_enabled){
1552
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Active Checks Of This Service' TITLE='Disable Active Checks Of This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_SVC_CHECK,url_encode(host_name));
1553
printf("&service=%s'>Disable active checks of this service</a></td></tr>\n",url_encode(service_desc));
1556
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Active Checks Of This Service' TITLE='Enable Active Checks Of This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_SVC_CHECK,url_encode(host_name));
1557
printf("&service=%s'>Enable active checks of this service</a></td></tr>\n",url_encode(service_desc));
1559
printf("<tr CLASS='data'><td><img src='%s%s' border=0 ALT='Re-schedule Next Service Check' TITLE='Re-schedule Next Service Check'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,DELAY_ICON,COMMAND_CGI,CMD_SCHEDULE_SVC_CHECK,url_encode(host_name));
1560
printf("&service=%s%s'>Re-schedule the next check of this service</a></td></tr>\n",url_encode(service_desc),(temp_svcstatus->checks_enabled==TRUE)?"&force_check":"");
1562
if(temp_svcstatus->accept_passive_service_checks==TRUE){
1563
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Submit Passive Check Result For This Service' TITLE='Submit Passive Check Result For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,PASSIVE_ICON,COMMAND_CGI,CMD_PROCESS_SERVICE_CHECK_RESULT,url_encode(host_name));
1564
printf("&service=%s'>Submit passive check result for this service</a></td></tr>\n",url_encode(service_desc));
1566
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Stop Accepting Passive Checks For This Service' TITLE='Stop Accepting Passive Checks For This Service'></td><td CLASS='command' NOWRAP><a href='%s?cmd_typ=%d&host=%s",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_PASSIVE_SVC_CHECKS,url_encode(host_name));
1567
printf("&service=%s'>Stop accepting passive checks for this service</a></td></tr>\n",url_encode(service_desc));
1570
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Start Accepting Passive Checks For This Service' TITLE='Start Accepting Passive Checks For This Service'></td><td CLASS='command' NOWRAP><a href='%s?cmd_typ=%d&host=%s",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_PASSIVE_SVC_CHECKS,url_encode(host_name));
1571
printf("&service=%s'>Start accepting passive checks for this service</a></td></tr>\n",url_encode(service_desc));
1574
if(temp_svcstatus->obsess_over_service==TRUE){
1575
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Stop Obsessing Over This Service' TITLE='Stop Obsessing Over This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_STOP_OBSESSING_OVER_SVC,url_encode(host_name));
1576
printf("&service=%s'>Stop obsessing over this service</a></td></tr>\n",url_encode(service_desc));
1579
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Start Obsessing Over This Service' TITLE='Start Obsessing Over This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_START_OBSESSING_OVER_SVC,url_encode(host_name));
1580
printf("&service=%s'>Start obsessing over this service</a></td></tr>\n",url_encode(service_desc));
1583
if((temp_svcstatus->status==SERVICE_WARNING || temp_svcstatus->status==SERVICE_UNKNOWN || temp_svcstatus->status==SERVICE_CRITICAL) && temp_svcstatus->state_type==HARD_STATE){
1584
if(temp_svcstatus->problem_has_been_acknowledged==FALSE){
1585
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Acknowledge This Service Problem' TITLE='Acknowledge This Service Problem'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,ACKNOWLEDGEMENT_ICON,COMMAND_CGI,CMD_ACKNOWLEDGE_SVC_PROBLEM,url_encode(host_name));
1586
printf("&service=%s'>Acknowledge this service problem</a></td></tr>\n",url_encode(service_desc));
1589
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Remove Problem Acknowledgement' TITLE='Remove Problem Acknowledgement'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,REMOVE_ACKNOWLEDGEMENT_ICON,COMMAND_CGI,CMD_REMOVE_SVC_ACKNOWLEDGEMENT,url_encode(host_name));
1590
printf("&service=%s'>Remove problem acknowledgement</a></td></tr>\n",url_encode(service_desc));
1593
if(temp_svcstatus->notifications_enabled==TRUE){
1594
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Notifications For This Service' TITLE='Disable Notifications For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_SVC_NOTIFICATIONS,url_encode(host_name));
1595
printf("&service=%s'>Disable notifications for this service</a></td></tr>\n",url_encode(service_desc));
1596
if(temp_svcstatus->status!=SERVICE_OK){
1597
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Delay Next Service Notification' TITLE='Delay Next Service Notification'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,DELAY_ICON,COMMAND_CGI,CMD_DELAY_SVC_NOTIFICATION,url_encode(host_name));
1598
printf("&service=%s'>Delay next service notification</a></td></tr>\n",url_encode(service_desc));
1602
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Notifications For This Service' TITLE='Enable Notifications For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_SVC_NOTIFICATIONS,url_encode(host_name));
1603
printf("&service=%s'>Enable notifications for this service</a></td></tr>\n",url_encode(service_desc));
1606
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Send Custom Notification' TITLE='Send Custom Notification'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,NOTIFICATION_ICON,COMMAND_CGI,CMD_SEND_CUSTOM_SVC_NOTIFICATION,url_encode(host_name));
1607
printf("&service=%s'>Send custom service notification</a></td></tr>\n",url_encode(service_desc));
1609
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Schedule Downtime For This Service' TITLE='Schedule Downtime For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,DOWNTIME_ICON,COMMAND_CGI,CMD_SCHEDULE_SVC_DOWNTIME,url_encode(host_name));
1610
printf("&service=%s'>Schedule downtime for this service</a></td></tr>\n",url_encode(service_desc));
1506
if(temp_svcstatus->checks_enabled) {
1508
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Active Checks Of This Service' TITLE='Disable Active Checks Of This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_SVC_CHECK, url_encode(host_name));
1509
printf("&service=%s'>Disable active checks of this service</a></td></tr>\n", url_encode(service_desc));
1512
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Active Checks Of This Service' TITLE='Enable Active Checks Of This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_SVC_CHECK, url_encode(host_name));
1513
printf("&service=%s'>Enable active checks of this service</a></td></tr>\n", url_encode(service_desc));
1515
printf("<tr CLASS='data'><td><img src='%s%s' border=0 ALT='Re-schedule Next Service Check' TITLE='Re-schedule Next Service Check'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, DELAY_ICON, COMMAND_CGI, CMD_SCHEDULE_SVC_CHECK, url_encode(host_name));
1516
printf("&service=%s%s'>Re-schedule the next check of this service</a></td></tr>\n", url_encode(service_desc), (temp_svcstatus->checks_enabled == TRUE) ? "&force_check" : "");
1518
if(temp_svcstatus->accept_passive_service_checks == TRUE) {
1519
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Submit Passive Check Result For This Service' TITLE='Submit Passive Check Result For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, PASSIVE_ICON, COMMAND_CGI, CMD_PROCESS_SERVICE_CHECK_RESULT, url_encode(host_name));
1520
printf("&service=%s'>Submit passive check result for this service</a></td></tr>\n", url_encode(service_desc));
1522
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Stop Accepting Passive Checks For This Service' TITLE='Stop Accepting Passive Checks For This Service'></td><td CLASS='command' NOWRAP><a href='%s?cmd_typ=%d&host=%s", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_PASSIVE_SVC_CHECKS, url_encode(host_name));
1523
printf("&service=%s'>Stop accepting passive checks for this service</a></td></tr>\n", url_encode(service_desc));
1526
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Start Accepting Passive Checks For This Service' TITLE='Start Accepting Passive Checks For This Service'></td><td CLASS='command' NOWRAP><a href='%s?cmd_typ=%d&host=%s", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_PASSIVE_SVC_CHECKS, url_encode(host_name));
1527
printf("&service=%s'>Start accepting passive checks for this service</a></td></tr>\n", url_encode(service_desc));
1530
if(temp_svcstatus->obsess_over_service == TRUE) {
1531
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Stop Obsessing Over This Service' TITLE='Stop Obsessing Over This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_STOP_OBSESSING_OVER_SVC, url_encode(host_name));
1532
printf("&service=%s'>Stop obsessing over this service</a></td></tr>\n", url_encode(service_desc));
1535
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Start Obsessing Over This Service' TITLE='Start Obsessing Over This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_START_OBSESSING_OVER_SVC, url_encode(host_name));
1536
printf("&service=%s'>Start obsessing over this service</a></td></tr>\n", url_encode(service_desc));
1539
if((temp_svcstatus->status == SERVICE_WARNING || temp_svcstatus->status == SERVICE_UNKNOWN || temp_svcstatus->status == SERVICE_CRITICAL) && temp_svcstatus->state_type == HARD_STATE) {
1540
if(temp_svcstatus->problem_has_been_acknowledged == FALSE) {
1541
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Acknowledge This Service Problem' TITLE='Acknowledge This Service Problem'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, ACKNOWLEDGEMENT_ICON, COMMAND_CGI, CMD_ACKNOWLEDGE_SVC_PROBLEM, url_encode(host_name));
1542
printf("&service=%s'>Acknowledge this service problem</a></td></tr>\n", url_encode(service_desc));
1545
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Remove Problem Acknowledgement' TITLE='Remove Problem Acknowledgement'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, REMOVE_ACKNOWLEDGEMENT_ICON, COMMAND_CGI, CMD_REMOVE_SVC_ACKNOWLEDGEMENT, url_encode(host_name));
1546
printf("&service=%s'>Remove problem acknowledgement</a></td></tr>\n", url_encode(service_desc));
1549
if(temp_svcstatus->notifications_enabled == TRUE) {
1550
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Notifications For This Service' TITLE='Disable Notifications For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_SVC_NOTIFICATIONS, url_encode(host_name));
1551
printf("&service=%s'>Disable notifications for this service</a></td></tr>\n", url_encode(service_desc));
1552
if(temp_svcstatus->status != SERVICE_OK) {
1553
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Delay Next Service Notification' TITLE='Delay Next Service Notification'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, DELAY_ICON, COMMAND_CGI, CMD_DELAY_SVC_NOTIFICATION, url_encode(host_name));
1554
printf("&service=%s'>Delay next service notification</a></td></tr>\n", url_encode(service_desc));
1558
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Notifications For This Service' TITLE='Enable Notifications For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_SVC_NOTIFICATIONS, url_encode(host_name));
1559
printf("&service=%s'>Enable notifications for this service</a></td></tr>\n", url_encode(service_desc));
1562
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Send Custom Notification' TITLE='Send Custom Notification'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, NOTIFICATION_ICON, COMMAND_CGI, CMD_SEND_CUSTOM_SVC_NOTIFICATION, url_encode(host_name));
1563
printf("&service=%s'>Send custom service notification</a></td></tr>\n", url_encode(service_desc));
1565
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Schedule Downtime For This Service' TITLE='Schedule Downtime For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, DOWNTIME_ICON, COMMAND_CGI, CMD_SCHEDULE_SVC_DOWNTIME, url_encode(host_name));
1566
printf("&service=%s'>Schedule downtime for this service</a></td></tr>\n", url_encode(service_desc));
1613
1569
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Cancel Scheduled Downtime For This Service' TITLE='Cancel Scheduled Downtime For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,SCHEDULED_DOWNTIME_ICON,COMMAND_CGI,CMD_CANCEL_SVC_DOWNTIME,url_encode(host_name));
1614
1570
printf("&service=%s'>Cancel scheduled downtime for this service</a></td></tr>\n",url_encode(service_desc));
1617
if(temp_svcstatus->event_handler_enabled==TRUE){
1618
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Event Handler For This Service' TITLE='Disable Event Handler For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_SVC_EVENT_HANDLER,url_encode(host_name));
1619
printf("&service=%s'>Disable event handler for this service</a></td></tr>\n",url_encode(service_desc));
1622
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Event Handler For This Service' TITLE='Enable Event Handler For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_SVC_EVENT_HANDLER,url_encode(host_name));
1623
printf("&service=%s'>Enable event handler for this service</a></td></tr>\n",url_encode(service_desc));
1573
if(temp_svcstatus->event_handler_enabled == TRUE) {
1574
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Event Handler For This Service' TITLE='Disable Event Handler For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_SVC_EVENT_HANDLER, url_encode(host_name));
1575
printf("&service=%s'>Disable event handler for this service</a></td></tr>\n", url_encode(service_desc));
1578
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Event Handler For This Service' TITLE='Enable Event Handler For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_SVC_EVENT_HANDLER, url_encode(host_name));
1579
printf("&service=%s'>Enable event handler for this service</a></td></tr>\n", url_encode(service_desc));
1626
if(temp_svcstatus->flap_detection_enabled==TRUE){
1627
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Flap Detection For This Service' TITLE='Disable Flap Detection For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,DISABLED_ICON,COMMAND_CGI,CMD_DISABLE_SVC_FLAP_DETECTION,url_encode(host_name));
1628
printf("&service=%s'>Disable flap detection for this service</a></td></tr>\n",url_encode(service_desc));
1631
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Flap Detection For This Service' TITLE='Enable Flap Detection For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_SVC_FLAP_DETECTION,url_encode(host_name));
1632
printf("&service=%s'>Enable flap detection for this service</a></td></tr>\n",url_encode(service_desc));
1582
if(temp_svcstatus->flap_detection_enabled == TRUE) {
1583
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Flap Detection For This Service' TITLE='Disable Flap Detection For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_SVC_FLAP_DETECTION, url_encode(host_name));
1584
printf("&service=%s'>Disable flap detection for this service</a></td></tr>\n", url_encode(service_desc));
1587
printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Flap Detection For This Service' TITLE='Enable Flap Detection For This Service'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_SVC_FLAP_DETECTION, url_encode(host_name));
1588
printf("&service=%s'>Enable flap detection for this service</a></td></tr>\n", url_encode(service_desc));
1635
1591
printf("</table>\n");
1637
else if (is_authorized_for_read_only(¤t_authdata)==TRUE){
1638
printf("<DIV ALIGN=CENTER CLASS='infoMessage'>Your account does not have permissions to execute commands.<br>\n");
1593
else if(is_authorized_for_read_only(¤t_authdata) == TRUE) {
1594
printf("<DIV ALIGN=CENTER CLASS='infoMessage'>Your account does not have permissions to execute commands.<br>\n");
1641
1597
printf("<DIV CLASS='infoMessage'>It appears as though Nagios is not running, so commands are temporarily unavailable...<br>\n");
1642
printf("Click <a href='%s?type=%d'>here</a> to view Nagios process information</DIV>\n",EXTINFO_CGI,DISPLAY_PROCESS_INFO);
1598
printf("Click <a href='%s?type=%d'>here</a> to view Nagios process information</DIV>\n", EXTINFO_CGI, DISPLAY_PROCESS_INFO);
1645
1601
printf("</td></tr>\n");
1646
1602
printf("</table>\n");
1964
1920
printf("<TR CLASS='comment'><TH CLASS='comment'>Host Name</TH><TH CLASS='comment'>Service</TH><TH CLASS='comment'>Entry Time</TH><TH CLASS='comment'>Author</TH><TH CLASS='comment'>Comment</TH><TH CLASS='comment'>Comment ID</TH><TH CLASS='comment'>Persistent</TH><TH CLASS='comment'>Type</TH><TH CLASS='comment'>Expires</TH><TH CLASS='comment'>Actions</TH></TR>\n");
1966
1922
/* display all the service comments */
1967
for(temp_comment=comment_list,total_comments=0;temp_comment!=NULL;temp_comment=temp_comment->next){
1923
for(temp_comment = comment_list, total_comments = 0; temp_comment != NULL; temp_comment = temp_comment->next) {
1969
if(temp_comment->comment_type!=SERVICE_COMMENT)
1925
if(temp_comment->comment_type != SERVICE_COMMENT)
1972
temp_service=find_service(temp_comment->host_name,temp_comment->service_description);
1928
temp_service = find_service(temp_comment->host_name, temp_comment->service_description);
1974
1930
/* make sure the user has rights to view service information */
1975
if(is_authorized_for_service(temp_service,¤t_authdata)==FALSE)
1931
if(is_authorized_for_service(temp_service, ¤t_authdata) == FALSE)
1978
1934
total_comments++;
1982
bg_class="commentOdd";
1986
bg_class="commentEven";
1989
switch(temp_comment->entry_type){
1991
comment_type="User";
1993
case DOWNTIME_COMMENT:
1994
comment_type="Scheduled Downtime";
1996
case FLAPPING_COMMENT:
1997
comment_type="Flap Detection";
1999
case ACKNOWLEDGEMENT_COMMENT:
2000
comment_type="Acknowledgement";
2006
get_time_string(&temp_comment->entry_time,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
2007
get_time_string(&temp_comment->expire_time,expire_time,(int)sizeof(date_time),SHORT_DATE_TIME);
2008
printf("<tr CLASS='%s'>",bg_class);
2009
printf("<td CLASS='%s'><A HREF='%s?type=%d&host=%s'>%s</A></td>",bg_class,EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(temp_comment->host_name),temp_comment->host_name);
2010
printf("<td CLASS='%s'><A HREF='%s?type=%d&host=%s",bg_class,EXTINFO_CGI,DISPLAY_SERVICE_INFO,url_encode(temp_comment->host_name));
2011
printf("&service=%s'>%s</A></td>",url_encode(temp_comment->service_description),temp_comment->service_description);
2012
printf("<td CLASS='%s'>%s</td><td CLASS='%s'>%s</td><td CLASS='%s'>%s</td><td CLASS='%s'>%ld</td><td CLASS='%s'>%s</td><td CLASS='%s'>%s</td><td CLASS='%s'>%s</td>",bg_class,date_time,bg_class,temp_comment->author,bg_class,temp_comment->comment_data,bg_class,temp_comment->comment_id,bg_class,(temp_comment->persistent)?"Yes":"No",bg_class,comment_type,bg_class,(temp_comment->expires==TRUE)?expire_time:"N/A");
2013
printf("<td><a href='%s?cmd_typ=%d&com_id=%ld'><img src='%s%s' border=0 ALT='Delete This Comment' TITLE='Delete This Comment'></td>",COMMAND_CGI,CMD_DEL_SVC_COMMENT,temp_comment->comment_id,url_images_path,DELETE_ICON);
1938
bg_class = "commentOdd";
1942
bg_class = "commentEven";
1945
switch(temp_comment->entry_type) {
1947
comment_type = "User";
1949
case DOWNTIME_COMMENT:
1950
comment_type = "Scheduled Downtime";
1952
case FLAPPING_COMMENT:
1953
comment_type = "Flap Detection";
1955
case ACKNOWLEDGEMENT_COMMENT:
1956
comment_type = "Acknowledgement";
1962
get_time_string(&temp_comment->entry_time, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1963
get_time_string(&temp_comment->expire_time, expire_time, (int)sizeof(date_time), SHORT_DATE_TIME);
1964
printf("<tr CLASS='%s'>", bg_class);
1965
printf("<td CLASS='%s'><A HREF='%s?type=%d&host=%s'>%s</A></td>", bg_class, EXTINFO_CGI, DISPLAY_HOST_INFO, url_encode(temp_comment->host_name), temp_comment->host_name);
1966
printf("<td CLASS='%s'><A HREF='%s?type=%d&host=%s", bg_class, EXTINFO_CGI, DISPLAY_SERVICE_INFO, url_encode(temp_comment->host_name));
1967
printf("&service=%s'>%s</A></td>", url_encode(temp_comment->service_description), temp_comment->service_description);
1968
printf("<td CLASS='%s'>%s</td><td CLASS='%s'>%s</td><td CLASS='%s'>%s</td><td CLASS='%s'>%ld</td><td CLASS='%s'>%s</td><td CLASS='%s'>%s</td><td CLASS='%s'>%s</td>", bg_class, date_time, bg_class, temp_comment->author, bg_class, temp_comment->comment_data, bg_class, temp_comment->comment_id, bg_class, (temp_comment->persistent) ? "Yes" : "No", bg_class, comment_type, bg_class, (temp_comment->expires == TRUE) ? expire_time : "N/A");
1969
printf("<td><a href='%s?cmd_typ=%d&com_id=%ld'><img src='%s%s' border=0 ALT='Delete This Comment' TITLE='Delete This Comment'></td>", COMMAND_CGI, CMD_DEL_SVC_COMMENT, temp_comment->comment_id, url_images_path, DELETE_ICON);
2014
1970
printf("</tr>\n");
2017
if(total_comments==0)
1973
if(total_comments == 0)
2018
1974
printf("<TR CLASS='commentOdd'><TD CLASS='commentOdd' COLSPAN=10>There are no service comments</TD></TR>");
2020
1976
printf("</TABLE>\n");
2021
1977
printf("</DIV>\n");
2028
void show_performance_data(void){
2029
service *temp_service=NULL;
2030
servicestatus *temp_servicestatus=NULL;
2031
host *temp_host=NULL;
2032
hoststatus *temp_hoststatus=NULL;
2033
int total_active_service_checks=0;
2034
int total_passive_service_checks=0;
2035
double min_service_execution_time=0.0;
2036
double max_service_execution_time=0.0;
2037
double total_service_execution_time=0.0;
2038
int have_min_service_execution_time=FALSE;
2039
int have_max_service_execution_time=FALSE;
2040
double min_service_latency=0.0;
2041
double max_service_latency=0.0;
2042
double long total_service_latency=0.0;
2043
int have_min_service_latency=FALSE;
2044
int have_max_service_latency=FALSE;
2045
double min_host_latency=0.0;
2046
double max_host_latency=0.0;
2047
double total_host_latency=0.0;
2048
int have_min_host_latency=FALSE;
2049
int have_max_host_latency=FALSE;
2050
double min_service_percent_change_a=0.0;
2051
double max_service_percent_change_a=0.0;
2052
double total_service_percent_change_a=0.0;
2053
int have_min_service_percent_change_a=FALSE;
2054
int have_max_service_percent_change_a=FALSE;
2055
double min_service_percent_change_b=0.0;
2056
double max_service_percent_change_b=0.0;
2057
double total_service_percent_change_b=0.0;
2058
int have_min_service_percent_change_b=FALSE;
2059
int have_max_service_percent_change_b=FALSE;
2060
int active_service_checks_1min=0;
2061
int active_service_checks_5min=0;
2062
int active_service_checks_15min=0;
2063
int active_service_checks_1hour=0;
2064
int active_service_checks_start=0;
2065
int active_service_checks_ever=0;
2066
int passive_service_checks_1min=0;
2067
int passive_service_checks_5min=0;
2068
int passive_service_checks_15min=0;
2069
int passive_service_checks_1hour=0;
2070
int passive_service_checks_start=0;
2071
int passive_service_checks_ever=0;
2072
int total_active_host_checks=0;
2073
int total_passive_host_checks=0;
2074
double min_host_execution_time=0.0;
2075
double max_host_execution_time=0.0;
2076
double total_host_execution_time=0.0;
2077
int have_min_host_execution_time=FALSE;
2078
int have_max_host_execution_time=FALSE;
2079
double min_host_percent_change_a=0.0;
2080
double max_host_percent_change_a=0.0;
2081
double total_host_percent_change_a=0.0;
2082
int have_min_host_percent_change_a=FALSE;
2083
int have_max_host_percent_change_a=FALSE;
2084
double min_host_percent_change_b=0.0;
2085
double max_host_percent_change_b=0.0;
2086
double total_host_percent_change_b=0.0;
2087
int have_min_host_percent_change_b=FALSE;
2088
int have_max_host_percent_change_b=FALSE;
2089
int active_host_checks_1min=0;
2090
int active_host_checks_5min=0;
2091
int active_host_checks_15min=0;
2092
int active_host_checks_1hour=0;
2093
int active_host_checks_start=0;
2094
int active_host_checks_ever=0;
2095
int passive_host_checks_1min=0;
2096
int passive_host_checks_5min=0;
2097
int passive_host_checks_15min=0;
2098
int passive_host_checks_1hour=0;
2099
int passive_host_checks_start=0;
2100
int passive_host_checks_ever=0;
1984
void show_performance_data(void) {
1985
service *temp_service = NULL;
1986
servicestatus *temp_servicestatus = NULL;
1987
host *temp_host = NULL;
1988
hoststatus *temp_hoststatus = NULL;
1989
int total_active_service_checks = 0;
1990
int total_passive_service_checks = 0;
1991
double min_service_execution_time = 0.0;
1992
double max_service_execution_time = 0.0;
1993
double total_service_execution_time = 0.0;
1994
int have_min_service_execution_time = FALSE;
1995
int have_max_service_execution_time = FALSE;
1996
double min_service_latency = 0.0;
1997
double max_service_latency = 0.0;
1998
double long total_service_latency = 0.0;
1999
int have_min_service_latency = FALSE;
2000
int have_max_service_latency = FALSE;
2001
double min_host_latency = 0.0;
2002
double max_host_latency = 0.0;
2003
double total_host_latency = 0.0;
2004
int have_min_host_latency = FALSE;
2005
int have_max_host_latency = FALSE;
2006
double min_service_percent_change_a = 0.0;
2007
double max_service_percent_change_a = 0.0;
2008
double total_service_percent_change_a = 0.0;
2009
int have_min_service_percent_change_a = FALSE;
2010
int have_max_service_percent_change_a = FALSE;
2011
double min_service_percent_change_b = 0.0;
2012
double max_service_percent_change_b = 0.0;
2013
double total_service_percent_change_b = 0.0;
2014
int have_min_service_percent_change_b = FALSE;
2015
int have_max_service_percent_change_b = FALSE;
2016
int active_service_checks_1min = 0;
2017
int active_service_checks_5min = 0;
2018
int active_service_checks_15min = 0;
2019
int active_service_checks_1hour = 0;
2020
int active_service_checks_start = 0;
2021
int active_service_checks_ever = 0;
2022
int passive_service_checks_1min = 0;
2023
int passive_service_checks_5min = 0;
2024
int passive_service_checks_15min = 0;
2025
int passive_service_checks_1hour = 0;
2026
int passive_service_checks_start = 0;
2027
int passive_service_checks_ever = 0;
2028
int total_active_host_checks = 0;
2029
int total_passive_host_checks = 0;
2030
double min_host_execution_time = 0.0;
2031
double max_host_execution_time = 0.0;
2032
double total_host_execution_time = 0.0;
2033
int have_min_host_execution_time = FALSE;
2034
int have_max_host_execution_time = FALSE;
2035
double min_host_percent_change_a = 0.0;
2036
double max_host_percent_change_a = 0.0;
2037
double total_host_percent_change_a = 0.0;
2038
int have_min_host_percent_change_a = FALSE;
2039
int have_max_host_percent_change_a = FALSE;
2040
double min_host_percent_change_b = 0.0;
2041
double max_host_percent_change_b = 0.0;
2042
double total_host_percent_change_b = 0.0;
2043
int have_min_host_percent_change_b = FALSE;
2044
int have_max_host_percent_change_b = FALSE;
2045
int active_host_checks_1min = 0;
2046
int active_host_checks_5min = 0;
2047
int active_host_checks_15min = 0;
2048
int active_host_checks_1hour = 0;
2049
int active_host_checks_start = 0;
2050
int active_host_checks_ever = 0;
2051
int passive_host_checks_1min = 0;
2052
int passive_host_checks_5min = 0;
2053
int passive_host_checks_15min = 0;
2054
int passive_host_checks_1hour = 0;
2055
int passive_host_checks_start = 0;
2056
int passive_host_checks_ever = 0;
2101
2057
time_t current_time;
2104
2060
time(¤t_time);
2106
2062
/* check all services */
2107
for(temp_servicestatus=servicestatus_list;temp_servicestatus!=NULL;temp_servicestatus=temp_servicestatus->next){
2063
for(temp_servicestatus = servicestatus_list; temp_servicestatus != NULL; temp_servicestatus = temp_servicestatus->next) {
2109
2065
/* find the service */
2110
temp_service=find_service(temp_servicestatus->host_name,temp_servicestatus->description);
2066
temp_service = find_service(temp_servicestatus->host_name, temp_servicestatus->description);
2112
2068
/* make sure the user has rights to view service information */
2113
if(is_authorized_for_service(temp_service,¤t_authdata)==FALSE)
2069
if(is_authorized_for_service(temp_service, ¤t_authdata) == FALSE)
2116
2072
/* is this an active or passive check? */
2117
if(temp_servicestatus->check_type==SERVICE_CHECK_ACTIVE){
2073
if(temp_servicestatus->check_type == SERVICE_CHECK_ACTIVE) {
2119
2075
total_active_service_checks++;
2121
total_service_execution_time+=temp_servicestatus->execution_time;
2122
if(have_min_service_execution_time==FALSE || temp_servicestatus->execution_time<min_service_execution_time){
2123
have_min_service_execution_time=TRUE;
2124
min_service_execution_time=temp_servicestatus->execution_time;
2126
if(have_max_service_execution_time==FALSE || temp_servicestatus->execution_time>max_service_execution_time){
2127
have_max_service_execution_time=TRUE;
2128
max_service_execution_time=temp_servicestatus->execution_time;
2131
total_service_percent_change_a+=temp_servicestatus->percent_state_change;
2132
if(have_min_service_percent_change_a==FALSE || temp_servicestatus->percent_state_change<min_service_percent_change_a){
2133
have_min_service_percent_change_a=TRUE;
2134
min_service_percent_change_a=temp_servicestatus->percent_state_change;
2136
if(have_max_service_percent_change_a==FALSE || temp_servicestatus->percent_state_change>max_service_percent_change_a){
2137
have_max_service_percent_change_a=TRUE;
2138
max_service_percent_change_a=temp_servicestatus->percent_state_change;
2141
total_service_latency+=temp_servicestatus->latency;
2142
if(have_min_service_latency==FALSE || temp_servicestatus->latency<min_service_latency){
2143
have_min_service_latency=TRUE;
2144
min_service_latency=temp_servicestatus->latency;
2146
if(have_max_service_latency==FALSE || temp_servicestatus->latency>max_service_latency){
2147
have_max_service_latency=TRUE;
2148
max_service_latency=temp_servicestatus->latency;
2151
if(temp_servicestatus->last_check>=(current_time-60))
2077
total_service_execution_time += temp_servicestatus->execution_time;
2078
if(have_min_service_execution_time == FALSE || temp_servicestatus->execution_time < min_service_execution_time) {
2079
have_min_service_execution_time = TRUE;
2080
min_service_execution_time = temp_servicestatus->execution_time;
2082
if(have_max_service_execution_time == FALSE || temp_servicestatus->execution_time > max_service_execution_time) {
2083
have_max_service_execution_time = TRUE;
2084
max_service_execution_time = temp_servicestatus->execution_time;
2087
total_service_percent_change_a += temp_servicestatus->percent_state_change;
2088
if(have_min_service_percent_change_a == FALSE || temp_servicestatus->percent_state_change < min_service_percent_change_a) {
2089
have_min_service_percent_change_a = TRUE;
2090
min_service_percent_change_a = temp_servicestatus->percent_state_change;
2092
if(have_max_service_percent_change_a == FALSE || temp_servicestatus->percent_state_change > max_service_percent_change_a) {
2093
have_max_service_percent_change_a = TRUE;
2094
max_service_percent_change_a = temp_servicestatus->percent_state_change;
2097
total_service_latency += temp_servicestatus->latency;
2098
if(have_min_service_latency == FALSE || temp_servicestatus->latency < min_service_latency) {
2099
have_min_service_latency = TRUE;
2100
min_service_latency = temp_servicestatus->latency;
2102
if(have_max_service_latency == FALSE || temp_servicestatus->latency > max_service_latency) {
2103
have_max_service_latency = TRUE;
2104
max_service_latency = temp_servicestatus->latency;
2107
if(temp_servicestatus->last_check >= (current_time - 60))
2152
2108
active_service_checks_1min++;
2153
if(temp_servicestatus->last_check>=(current_time-300))
2109
if(temp_servicestatus->last_check >= (current_time - 300))
2154
2110
active_service_checks_5min++;
2155
if(temp_servicestatus->last_check>=(current_time-900))
2111
if(temp_servicestatus->last_check >= (current_time - 900))
2156
2112
active_service_checks_15min++;
2157
if(temp_servicestatus->last_check>=(current_time-3600))
2113
if(temp_servicestatus->last_check >= (current_time - 3600))
2158
2114
active_service_checks_1hour++;
2159
if(temp_servicestatus->last_check>=program_start)
2115
if(temp_servicestatus->last_check >= program_start)
2160
2116
active_service_checks_start++;
2161
if(temp_servicestatus->last_check!=(time_t)0)
2117
if(temp_servicestatus->last_check != (time_t)0)
2162
2118
active_service_checks_ever++;
2166
2122
total_passive_service_checks++;
2168
total_service_percent_change_b+=temp_servicestatus->percent_state_change;
2169
if(have_min_service_percent_change_b==FALSE || temp_servicestatus->percent_state_change<min_service_percent_change_b){
2170
have_min_service_percent_change_b=TRUE;
2171
min_service_percent_change_b=temp_servicestatus->percent_state_change;
2173
if(have_max_service_percent_change_b==FALSE || temp_servicestatus->percent_state_change>max_service_percent_change_b){
2174
have_max_service_percent_change_b=TRUE;
2175
max_service_percent_change_b=temp_servicestatus->percent_state_change;
2124
total_service_percent_change_b += temp_servicestatus->percent_state_change;
2125
if(have_min_service_percent_change_b == FALSE || temp_servicestatus->percent_state_change < min_service_percent_change_b) {
2126
have_min_service_percent_change_b = TRUE;
2127
min_service_percent_change_b = temp_servicestatus->percent_state_change;
2129
if(have_max_service_percent_change_b == FALSE || temp_servicestatus->percent_state_change > max_service_percent_change_b) {
2130
have_max_service_percent_change_b = TRUE;
2131
max_service_percent_change_b = temp_servicestatus->percent_state_change;
2178
if(temp_servicestatus->last_check>=(current_time-60))
2134
if(temp_servicestatus->last_check >= (current_time - 60))
2179
2135
passive_service_checks_1min++;
2180
if(temp_servicestatus->last_check>=(current_time-300))
2136
if(temp_servicestatus->last_check >= (current_time - 300))
2181
2137
passive_service_checks_5min++;
2182
if(temp_servicestatus->last_check>=(current_time-900))
2138
if(temp_servicestatus->last_check >= (current_time - 900))
2183
2139
passive_service_checks_15min++;
2184
if(temp_servicestatus->last_check>=(current_time-3600))
2140
if(temp_servicestatus->last_check >= (current_time - 3600))
2185
2141
passive_service_checks_1hour++;
2186
if(temp_servicestatus->last_check>=program_start)
2142
if(temp_servicestatus->last_check >= program_start)
2187
2143
passive_service_checks_start++;
2188
if(temp_servicestatus->last_check!=(time_t)0)
2144
if(temp_servicestatus->last_check != (time_t)0)
2189
2145
passive_service_checks_ever++;
2193
2149
/* check all hosts */
2194
for(temp_hoststatus=hoststatus_list;temp_hoststatus!=NULL;temp_hoststatus=temp_hoststatus->next){
2150
for(temp_hoststatus = hoststatus_list; temp_hoststatus != NULL; temp_hoststatus = temp_hoststatus->next) {
2196
2152
/* find the host */
2197
temp_host=find_host(temp_hoststatus->host_name);
2153
temp_host = find_host(temp_hoststatus->host_name);
2199
2155
/* make sure the user has rights to view host information */
2200
if(is_authorized_for_host(temp_host,¤t_authdata)==FALSE)
2156
if(is_authorized_for_host(temp_host, ¤t_authdata) == FALSE)
2203
2159
/* is this an active or passive check? */
2204
if(temp_hoststatus->check_type==HOST_CHECK_ACTIVE){
2160
if(temp_hoststatus->check_type == HOST_CHECK_ACTIVE) {
2206
2162
total_active_host_checks++;
2208
total_host_execution_time+=temp_hoststatus->execution_time;
2209
if(have_min_host_execution_time==FALSE || temp_hoststatus->execution_time<min_host_execution_time){
2210
have_min_host_execution_time=TRUE;
2211
min_host_execution_time=temp_hoststatus->execution_time;
2213
if(have_max_host_execution_time==FALSE || temp_hoststatus->execution_time>max_host_execution_time){
2214
have_max_host_execution_time=TRUE;
2215
max_host_execution_time=temp_hoststatus->execution_time;
2218
total_host_percent_change_a+=temp_hoststatus->percent_state_change;
2219
if(have_min_host_percent_change_a==FALSE || temp_hoststatus->percent_state_change<min_host_percent_change_a){
2220
have_min_host_percent_change_a=TRUE;
2221
min_host_percent_change_a=temp_hoststatus->percent_state_change;
2223
if(have_max_host_percent_change_a==FALSE || temp_hoststatus->percent_state_change>max_host_percent_change_a){
2224
have_max_host_percent_change_a=TRUE;
2225
max_host_percent_change_a=temp_hoststatus->percent_state_change;
2228
total_host_latency+=temp_hoststatus->latency;
2229
if(have_min_host_latency==FALSE || temp_hoststatus->latency<min_host_latency){
2230
have_min_host_latency=TRUE;
2231
min_host_latency=temp_hoststatus->latency;
2233
if(have_max_host_latency==FALSE || temp_hoststatus->latency>max_host_latency){
2234
have_max_host_latency=TRUE;
2235
max_host_latency=temp_hoststatus->latency;
2238
if(temp_hoststatus->last_check>=(current_time-60))
2164
total_host_execution_time += temp_hoststatus->execution_time;
2165
if(have_min_host_execution_time == FALSE || temp_hoststatus->execution_time < min_host_execution_time) {
2166
have_min_host_execution_time = TRUE;
2167
min_host_execution_time = temp_hoststatus->execution_time;
2169
if(have_max_host_execution_time == FALSE || temp_hoststatus->execution_time > max_host_execution_time) {
2170
have_max_host_execution_time = TRUE;
2171
max_host_execution_time = temp_hoststatus->execution_time;
2174
total_host_percent_change_a += temp_hoststatus->percent_state_change;
2175
if(have_min_host_percent_change_a == FALSE || temp_hoststatus->percent_state_change < min_host_percent_change_a) {
2176
have_min_host_percent_change_a = TRUE;
2177
min_host_percent_change_a = temp_hoststatus->percent_state_change;
2179
if(have_max_host_percent_change_a == FALSE || temp_hoststatus->percent_state_change > max_host_percent_change_a) {
2180
have_max_host_percent_change_a = TRUE;
2181
max_host_percent_change_a = temp_hoststatus->percent_state_change;
2184
total_host_latency += temp_hoststatus->latency;
2185
if(have_min_host_latency == FALSE || temp_hoststatus->latency < min_host_latency) {
2186
have_min_host_latency = TRUE;
2187
min_host_latency = temp_hoststatus->latency;
2189
if(have_max_host_latency == FALSE || temp_hoststatus->latency > max_host_latency) {
2190
have_max_host_latency = TRUE;
2191
max_host_latency = temp_hoststatus->latency;
2194
if(temp_hoststatus->last_check >= (current_time - 60))
2239
2195
active_host_checks_1min++;
2240
if(temp_hoststatus->last_check>=(current_time-300))
2196
if(temp_hoststatus->last_check >= (current_time - 300))
2241
2197
active_host_checks_5min++;
2242
if(temp_hoststatus->last_check>=(current_time-900))
2198
if(temp_hoststatus->last_check >= (current_time - 900))
2243
2199
active_host_checks_15min++;
2244
if(temp_hoststatus->last_check>=(current_time-3600))
2200
if(temp_hoststatus->last_check >= (current_time - 3600))
2245
2201
active_host_checks_1hour++;
2246
if(temp_hoststatus->last_check>=program_start)
2202
if(temp_hoststatus->last_check >= program_start)
2247
2203
active_host_checks_start++;
2248
if(temp_hoststatus->last_check!=(time_t)0)
2204
if(temp_hoststatus->last_check != (time_t)0)
2249
2205
active_host_checks_ever++;
2253
2209
total_passive_host_checks++;
2255
total_host_percent_change_b+=temp_hoststatus->percent_state_change;
2256
if(have_min_host_percent_change_b==FALSE || temp_hoststatus->percent_state_change<min_host_percent_change_b){
2257
have_min_host_percent_change_b=TRUE;
2258
min_host_percent_change_b=temp_hoststatus->percent_state_change;
2260
if(have_max_host_percent_change_b==FALSE || temp_hoststatus->percent_state_change>max_host_percent_change_b){
2261
have_max_host_percent_change_b=TRUE;
2262
max_host_percent_change_b=temp_hoststatus->percent_state_change;
2211
total_host_percent_change_b += temp_hoststatus->percent_state_change;
2212
if(have_min_host_percent_change_b == FALSE || temp_hoststatus->percent_state_change < min_host_percent_change_b) {
2213
have_min_host_percent_change_b = TRUE;
2214
min_host_percent_change_b = temp_hoststatus->percent_state_change;
2216
if(have_max_host_percent_change_b == FALSE || temp_hoststatus->percent_state_change > max_host_percent_change_b) {
2217
have_max_host_percent_change_b = TRUE;
2218
max_host_percent_change_b = temp_hoststatus->percent_state_change;
2265
if(temp_hoststatus->last_check>=(current_time-60))
2221
if(temp_hoststatus->last_check >= (current_time - 60))
2266
2222
passive_host_checks_1min++;
2267
if(temp_hoststatus->last_check>=(current_time-300))
2223
if(temp_hoststatus->last_check >= (current_time - 300))
2268
2224
passive_host_checks_5min++;
2269
if(temp_hoststatus->last_check>=(current_time-900))
2225
if(temp_hoststatus->last_check >= (current_time - 900))
2270
2226
passive_host_checks_15min++;
2271
if(temp_hoststatus->last_check>=(current_time-3600))
2227
if(temp_hoststatus->last_check >= (current_time - 3600))
2272
2228
passive_host_checks_1hour++;
2273
if(temp_hoststatus->last_check>=program_start)
2229
if(temp_hoststatus->last_check >= program_start)
2274
2230
passive_host_checks_start++;
2275
if(temp_hoststatus->last_check!=(time_t)0)
2231
if(temp_hoststatus->last_check != (time_t)0)
2276
2232
passive_host_checks_ever++;
2281
2237
printf("<div align=center>\n");
2758
2714
printf("<TR CLASS='downtime'><TH CLASS='downtime'>Host Name</TH><TH CLASS='downtime'>Service</TH><TH CLASS='downtime'>Entry Time</TH><TH CLASS='downtime'>Author</TH><TH CLASS='downtime'>Comment</TH><TH CLASS='downtime'>Start Time</TH><TH CLASS='downtime'>End Time</TH><TH CLASS='downtime'>Type</TH><TH CLASS='downtime'>Duration</TH><TH CLASS='downtime'>Downtime ID</TH><TH CLASS='downtime'>Trigger ID</TH><TH CLASS='downtime'>Actions</TH></TR>\n");
2760
2716
/* display all the service downtime */
2761
for(temp_downtime=scheduled_downtime_list,total_downtime=0;temp_downtime!=NULL;temp_downtime=temp_downtime->next){
2717
for(temp_downtime = scheduled_downtime_list, total_downtime = 0; temp_downtime != NULL; temp_downtime = temp_downtime->next) {
2763
if(temp_downtime->type!=SERVICE_DOWNTIME)
2719
if(temp_downtime->type != SERVICE_DOWNTIME)
2766
temp_service=find_service(temp_downtime->host_name,temp_downtime->service_description);
2722
temp_service = find_service(temp_downtime->host_name, temp_downtime->service_description);
2768
2724
/* make sure the user has rights to view service information */
2769
if(is_authorized_for_service(temp_service,¤t_authdata)==FALSE)
2725
if(is_authorized_for_service(temp_service, ¤t_authdata) == FALSE)
2772
2728
total_downtime++;
2776
bg_class="downtimeOdd";
2780
bg_class="downtimeEven";
2732
bg_class = "downtimeOdd";
2736
bg_class = "downtimeEven";
2783
printf("<tr CLASS='%s'>",bg_class);
2784
printf("<td CLASS='%s'><A HREF='%s?type=%d&host=%s'>%s</A></td>",bg_class,EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(temp_downtime->host_name),temp_downtime->host_name);
2785
printf("<td CLASS='%s'><A HREF='%s?type=%d&host=%s",bg_class,EXTINFO_CGI,DISPLAY_SERVICE_INFO,url_encode(temp_downtime->host_name));
2786
printf("&service=%s'>%s</A></td>",url_encode(temp_downtime->service_description),temp_downtime->service_description);
2787
get_time_string(&temp_downtime->entry_time,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
2788
printf("<td CLASS='%s'>%s</td>",bg_class,date_time);
2789
printf("<td CLASS='%s'>%s</td>",bg_class,(temp_downtime->author==NULL)?"N/A":temp_downtime->author);
2790
printf("<td CLASS='%s'>%s</td>",bg_class,(temp_downtime->comment==NULL)?"N/A":temp_downtime->comment);
2791
get_time_string(&temp_downtime->start_time,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
2792
printf("<td CLASS='%s'>%s</td>",bg_class,date_time);
2793
get_time_string(&temp_downtime->end_time,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
2794
printf("<td CLASS='%s'>%s</td>",bg_class,date_time);
2795
printf("<td CLASS='%s'>%s</td>",bg_class,(temp_downtime->fixed==TRUE)?"Fixed":"Flexible");
2796
get_time_breakdown(temp_downtime->duration,&days,&hours,&minutes,&seconds);
2797
printf("<td CLASS='%s'>%dd %dh %dm %ds</td>",bg_class,days,hours,minutes,seconds);
2798
printf("<td CLASS='%s'>%lu</td>",bg_class,temp_downtime->downtime_id);
2799
printf("<td CLASS='%s'>",bg_class);
2800
if(temp_downtime->triggered_by==0)
2739
printf("<tr CLASS='%s'>", bg_class);
2740
printf("<td CLASS='%s'><A HREF='%s?type=%d&host=%s'>%s</A></td>", bg_class, EXTINFO_CGI, DISPLAY_HOST_INFO, url_encode(temp_downtime->host_name), temp_downtime->host_name);
2741
printf("<td CLASS='%s'><A HREF='%s?type=%d&host=%s", bg_class, EXTINFO_CGI, DISPLAY_SERVICE_INFO, url_encode(temp_downtime->host_name));
2742
printf("&service=%s'>%s</A></td>", url_encode(temp_downtime->service_description), temp_downtime->service_description);
2743
get_time_string(&temp_downtime->entry_time, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
2744
printf("<td CLASS='%s'>%s</td>", bg_class, date_time);
2745
printf("<td CLASS='%s'>%s</td>", bg_class, (temp_downtime->author == NULL) ? "N/A" : temp_downtime->author);
2746
printf("<td CLASS='%s'>%s</td>", bg_class, (temp_downtime->comment == NULL) ? "N/A" : temp_downtime->comment);
2747
get_time_string(&temp_downtime->start_time, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
2748
printf("<td CLASS='%s'>%s</td>", bg_class, date_time);
2749
get_time_string(&temp_downtime->end_time, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
2750
printf("<td CLASS='%s'>%s</td>", bg_class, date_time);
2751
printf("<td CLASS='%s'>%s</td>", bg_class, (temp_downtime->fixed == TRUE) ? "Fixed" : "Flexible");
2752
get_time_breakdown(temp_downtime->duration, &days, &hours, &minutes, &seconds);
2753
printf("<td CLASS='%s'>%dd %dh %dm %ds</td>", bg_class, days, hours, minutes, seconds);
2754
printf("<td CLASS='%s'>%lu</td>", bg_class, temp_downtime->downtime_id);
2755
printf("<td CLASS='%s'>", bg_class);
2756
if(temp_downtime->triggered_by == 0)
2803
printf("%lu",temp_downtime->triggered_by);
2759
printf("%lu", temp_downtime->triggered_by);
2804
2760
printf("</td>\n");
2805
printf("<td><a href='%s?cmd_typ=%d&down_id=%lu'><img src='%s%s' border=0 ALT='Delete/Cancel This Scheduled Downtime Entry' TITLE='Delete/Cancel This Scheduled Downtime Entry'></td>",COMMAND_CGI,CMD_DEL_SVC_DOWNTIME,temp_downtime->downtime_id,url_images_path,DELETE_ICON);
2761
printf("<td><a href='%s?cmd_typ=%d&down_id=%lu'><img src='%s%s' border=0 ALT='Delete/Cancel This Scheduled Downtime Entry' TITLE='Delete/Cancel This Scheduled Downtime Entry'></td>", COMMAND_CGI, CMD_DEL_SVC_DOWNTIME, temp_downtime->downtime_id, url_images_path, DELETE_ICON);
2806
2762
printf("</tr>\n");
2809
if(total_downtime==0)
2765
if(total_downtime == 0)
2810
2766
printf("<TR CLASS='downtimeOdd'><TD CLASS='downtimeOdd' COLSPAN=12>There are no services with scheduled downtime</TD></TR>");
2812
2768
printf("</TABLE>\n");
2813
2769
printf("</DIV>\n");
2820
2776
/* shows check scheduling queue */
2821
void show_scheduling_queue(void){
2777
void show_scheduling_queue(void) {
2822
2778
sortdata *temp_sortdata;
2823
servicestatus *temp_svcstatus=NULL;
2824
hoststatus *temp_hststatus=NULL;
2779
servicestatus *temp_svcstatus = NULL;
2780
hoststatus *temp_hststatus = NULL;
2825
2781
char date_time[MAX_DATETIME_LENGTH];
2826
2782
char temp_url[MAX_INPUT_BUFFER];
2831
2787
/* make sure the user has rights to view system information */
2832
if(is_authorized_for_system_information(¤t_authdata)==FALSE){
2788
if(is_authorized_for_system_information(¤t_authdata) == FALSE) {
2834
2790
printf("<P><DIV CLASS='errorMessage'>It appears as though you do not have permission to view process information...</DIV></P>\n");
2835
2791
printf("<P><DIV CLASS='errorDescription'>If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI<br>");
2836
2792
printf("and check the authorization options in your CGI configuration file.</DIV></P>\n");
2841
2797
/* sort hosts and services */
2842
sort_data(sort_type,sort_option);
2798
sort_data(sort_type, sort_option);
2844
2800
printf("<DIV ALIGN=CENTER CLASS='statusSort'>Entries sorted by <b>");
2845
if(sort_option==SORT_HOSTNAME)
2801
if(sort_option == SORT_HOSTNAME)
2846
2802
printf("host name");
2847
else if(sort_option==SORT_SERVICENAME)
2803
else if(sort_option == SORT_SERVICENAME)
2848
2804
printf("service name");
2849
else if(sort_option==SORT_SERVICESTATUS)
2805
else if(sort_option == SORT_SERVICESTATUS)
2850
2806
printf("service status");
2851
else if(sort_option==SORT_LASTCHECKTIME)
2807
else if(sort_option == SORT_LASTCHECKTIME)
2852
2808
printf("last check time");
2853
else if(sort_option==SORT_NEXTCHECKTIME)
2809
else if(sort_option == SORT_NEXTCHECKTIME)
2854
2810
printf("next check time");
2855
printf("</b> (%s)\n",(sort_type==SORT_ASCENDING)?"ascending":"descending");
2811
printf("</b> (%s)\n", (sort_type == SORT_ASCENDING) ? "ascending" : "descending");
2856
2812
printf("</DIV>\n");
2858
2814
printf("<P>\n");
2860
2816
printf("<TABLE BORDER=0 CLASS='queue'>\n");
2861
2817
printf("<TR CLASS='queue'>");
2863
snprintf(temp_url,sizeof(temp_url)-1,"%s?type=%d",EXTINFO_CGI,DISPLAY_SCHEDULING_QUEUE);
2864
temp_url[sizeof(temp_url)-1]='\x0';
2866
printf("<TH CLASS='queue'>Host <A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by host name (ascending)' TITLE='Sort by host name (ascending)'></A><A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by host name (descending)' TITLE='Sort by host name (descending)'></A></TH>",temp_url,SORT_ASCENDING,SORT_HOSTNAME,url_images_path,UP_ARROW_ICON,temp_url,SORT_DESCENDING,SORT_HOSTNAME,url_images_path,DOWN_ARROW_ICON);
2868
printf("<TH CLASS='queue'>Service <A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by service name (ascending)' TITLE='Sort by service name (ascending)'></A><A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by service name (descending)' TITLE='Sort by service name (descending)'></A></TH>",temp_url,SORT_ASCENDING,SORT_SERVICENAME,url_images_path,UP_ARROW_ICON,temp_url,SORT_DESCENDING,SORT_SERVICENAME,url_images_path,DOWN_ARROW_ICON);
2870
printf("<TH CLASS='queue'>Last Check <A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by last check time (ascending)' TITLE='Sort by last check time (ascending)'></A><A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by last check time (descending)' TITLE='Sort by last check time (descending)'></A></TH>",temp_url,SORT_ASCENDING,SORT_LASTCHECKTIME,url_images_path,UP_ARROW_ICON,temp_url,SORT_DESCENDING,SORT_LASTCHECKTIME,url_images_path,DOWN_ARROW_ICON);
2872
printf("<TH CLASS='queue'>Next Check <A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by next check time (ascending)' TITLE='Sort by next check time (ascending)'></A><A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by next check time (descending)' TITLE='Sort by next check time (descending)'></A></TH>",temp_url,SORT_ASCENDING,SORT_NEXTCHECKTIME,url_images_path,UP_ARROW_ICON,temp_url,SORT_DESCENDING,SORT_NEXTCHECKTIME,url_images_path,DOWN_ARROW_ICON);
2819
snprintf(temp_url, sizeof(temp_url) - 1, "%s?type=%d", EXTINFO_CGI, DISPLAY_SCHEDULING_QUEUE);
2820
temp_url[sizeof(temp_url) - 1] = '\x0';
2822
printf("<TH CLASS='queue'>Host <A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by host name (ascending)' TITLE='Sort by host name (ascending)'></A><A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by host name (descending)' TITLE='Sort by host name (descending)'></A></TH>", temp_url, SORT_ASCENDING, SORT_HOSTNAME, url_images_path, UP_ARROW_ICON, temp_url, SORT_DESCENDING, SORT_HOSTNAME, url_images_path, DOWN_ARROW_ICON);
2824
printf("<TH CLASS='queue'>Service <A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by service name (ascending)' TITLE='Sort by service name (ascending)'></A><A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by service name (descending)' TITLE='Sort by service name (descending)'></A></TH>", temp_url, SORT_ASCENDING, SORT_SERVICENAME, url_images_path, UP_ARROW_ICON, temp_url, SORT_DESCENDING, SORT_SERVICENAME, url_images_path, DOWN_ARROW_ICON);
2826
printf("<TH CLASS='queue'>Last Check <A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by last check time (ascending)' TITLE='Sort by last check time (ascending)'></A><A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by last check time (descending)' TITLE='Sort by last check time (descending)'></A></TH>", temp_url, SORT_ASCENDING, SORT_LASTCHECKTIME, url_images_path, UP_ARROW_ICON, temp_url, SORT_DESCENDING, SORT_LASTCHECKTIME, url_images_path, DOWN_ARROW_ICON);
2828
printf("<TH CLASS='queue'>Next Check <A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by next check time (ascending)' TITLE='Sort by next check time (ascending)'></A><A HREF='%s&sorttype=%d&sortoption=%d'><IMG SRC='%s%s' BORDER=0 ALT='Sort by next check time (descending)' TITLE='Sort by next check time (descending)'></A></TH>", temp_url, SORT_ASCENDING, SORT_NEXTCHECKTIME, url_images_path, UP_ARROW_ICON, temp_url, SORT_DESCENDING, SORT_NEXTCHECKTIME, url_images_path, DOWN_ARROW_ICON);
2875
2831
printf("<TH CLASS='queue'>Type</TH><TH CLASS='queue'>Active Checks</TH><TH CLASS='queue'>Actions</TH></TR>\n");
2878
2834
/* display all services and hosts */
2879
for(temp_sortdata=sortdata_list;temp_sortdata!=NULL;temp_sortdata=temp_sortdata->next){
2835
for(temp_sortdata = sortdata_list; temp_sortdata != NULL; temp_sortdata = temp_sortdata->next) {
2881
2837
/* skip hosts and services that shouldn't be scheduled */
2882
if(temp_sortdata->is_service==TRUE){
2883
temp_svcstatus=temp_sortdata->svcstatus;
2884
if(temp_svcstatus->should_be_scheduled==FALSE){
2885
/* passive-only checks should appear if they're being forced */
2886
if(!(temp_svcstatus->checks_enabled==FALSE && temp_svcstatus->next_check!=(time_t)0L && (temp_svcstatus->check_options & CHECK_OPTION_FORCE_EXECUTION)))
2891
temp_hststatus=temp_sortdata->hststatus;
2892
if(temp_hststatus->should_be_scheduled==FALSE){
2893
/* passive-only checks should appear if they're being forced */
2894
if(!(temp_hststatus->checks_enabled==FALSE && temp_hststatus->next_check!=(time_t)0L && (temp_hststatus->check_options & CHECK_OPTION_FORCE_EXECUTION)))
2908
printf("<TR CLASS='queue%s'>",bgclass);
2838
if(temp_sortdata->is_service == TRUE) {
2839
temp_svcstatus = temp_sortdata->svcstatus;
2840
if(temp_svcstatus->should_be_scheduled == FALSE) {
2841
/* passive-only checks should appear if they're being forced */
2842
if(!(temp_svcstatus->checks_enabled == FALSE && temp_svcstatus->next_check != (time_t)0L && (temp_svcstatus->check_options & CHECK_OPTION_FORCE_EXECUTION)))
2847
temp_hststatus = temp_sortdata->hststatus;
2848
if(temp_hststatus->should_be_scheduled == FALSE) {
2849
/* passive-only checks should appear if they're being forced */
2850
if(!(temp_hststatus->checks_enabled == FALSE && temp_hststatus->next_check != (time_t)0L && (temp_hststatus->check_options & CHECK_OPTION_FORCE_EXECUTION)))
2864
printf("<TR CLASS='queue%s'>", bgclass);
2910
2866
/* get the service status */
2911
if(temp_sortdata->is_service==TRUE){
2913
printf("<TD CLASS='queue%s'><A HREF='%s?type=%d&host=%s'>%s</A></TD>",bgclass,EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(temp_svcstatus->host_name),temp_svcstatus->host_name);
2915
printf("<TD CLASS='queue%s'><A HREF='%s?type=%d&host=%s",bgclass,EXTINFO_CGI,DISPLAY_SERVICE_INFO,url_encode(temp_svcstatus->host_name));
2916
printf("&service=%s'>%s</A></TD>",url_encode(temp_svcstatus->description),temp_svcstatus->description);
2918
get_time_string(&temp_svcstatus->last_check,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
2919
printf("<TD CLASS='queue%s'>%s</TD>",bgclass,(temp_svcstatus->last_check==(time_t)0)?"N/A":date_time);
2921
get_time_string(&temp_svcstatus->next_check,date_time,(int)sizeof(date_time),SHORT_DATE_TIME);
2922
printf("<TD CLASS='queue%s'>%s</TD>",bgclass,(temp_svcstatus->next_check==(time_t)0)?"N/A":date_time);
2924
printf("<TD CLASS='queue%s'>",bgclass);
2925
if(temp_svcstatus->check_options==CHECK_OPTION_NONE)
2867
if(temp_sortdata->is_service == TRUE) {
2869
printf("<TD CLASS='queue%s'><A HREF='%s?type=%d&host=%s'>%s</A></TD>", bgclass, EXTINFO_CGI, DISPLAY_HOST_INFO, url_encode(temp_svcstatus->host_name), temp_svcstatus->host_name);
2871
printf("<TD CLASS='queue%s'><A HREF='%s?type=%d&host=%s", bgclass, EXTINFO_CGI, DISPLAY_SERVICE_INFO, url_encode(temp_svcstatus->host_name));
2872
printf("&service=%s'>%s</A></TD>", url_encode(temp_svcstatus->description), temp_svcstatus->description);
2874
get_time_string(&temp_svcstatus->last_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
2875
printf("<TD CLASS='queue%s'>%s</TD>", bgclass, (temp_svcstatus->last_check == (time_t)0) ? "N/A" : date_time);
2877
get_time_string(&temp_svcstatus->next_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
2878
printf("<TD CLASS='queue%s'>%s</TD>", bgclass, (temp_svcstatus->next_check == (time_t)0) ? "N/A" : date_time);
2880
printf("<TD CLASS='queue%s'>", bgclass);
2881
if(temp_svcstatus->check_options == CHECK_OPTION_NONE)
2926
2882
printf("Normal ");
2928
2884
if(temp_svcstatus->check_options & CHECK_OPTION_FORCE_EXECUTION)
2929
2885
printf("Forced ");
2930
2886
if(temp_svcstatus->check_options & CHECK_OPTION_FRESHNESS_CHECK)
3108
3064
char *host_name[2];
3109
3065
char *service_description[2];
3111
if(new_sortdata->is_service==TRUE){
3112
temp_svcstatus=new_sortdata->svcstatus;
3113
last_check[0]=temp_svcstatus->last_check;
3114
next_check[0]=temp_svcstatus->next_check;
3115
status[0]=temp_svcstatus->status;
3116
host_name[0]=temp_svcstatus->host_name;
3117
service_description[0]=temp_svcstatus->description;
3118
current_attempt[0]=temp_svcstatus->current_attempt;
3121
temp_hststatus=new_sortdata->hststatus;
3122
last_check[0]=temp_hststatus->last_check;
3123
next_check[0]=temp_hststatus->next_check;
3124
status[0]=temp_hststatus->status;
3125
host_name[0]=temp_hststatus->host_name;
3126
service_description[0]="";
3127
current_attempt[0]=temp_hststatus->current_attempt;
3129
if(temp_sortdata->is_service==TRUE){
3130
temp_svcstatus=temp_sortdata->svcstatus;
3131
last_check[1]=temp_svcstatus->last_check;
3132
next_check[1]=temp_svcstatus->next_check;
3133
status[1]=temp_svcstatus->status;
3134
host_name[1]=temp_svcstatus->host_name;
3135
service_description[1]=temp_svcstatus->description;
3136
current_attempt[1]=temp_svcstatus->current_attempt;
3139
temp_hststatus=temp_sortdata->hststatus;
3140
last_check[1]=temp_hststatus->last_check;
3141
next_check[1]=temp_hststatus->next_check;
3142
status[1]=temp_hststatus->status;
3143
host_name[1]=temp_hststatus->host_name;
3144
service_description[1]="";
3145
current_attempt[1]=temp_hststatus->current_attempt;
3148
if(s_type==SORT_ASCENDING){
3150
if(s_option==SORT_LASTCHECKTIME){
3067
if(new_sortdata->is_service == TRUE) {
3068
temp_svcstatus = new_sortdata->svcstatus;
3069
last_check[0] = temp_svcstatus->last_check;
3070
next_check[0] = temp_svcstatus->next_check;
3071
status[0] = temp_svcstatus->status;
3072
host_name[0] = temp_svcstatus->host_name;
3073
service_description[0] = temp_svcstatus->description;
3074
current_attempt[0] = temp_svcstatus->current_attempt;
3077
temp_hststatus = new_sortdata->hststatus;
3078
last_check[0] = temp_hststatus->last_check;
3079
next_check[0] = temp_hststatus->next_check;
3080
status[0] = temp_hststatus->status;
3081
host_name[0] = temp_hststatus->host_name;
3082
service_description[0] = "";
3083
current_attempt[0] = temp_hststatus->current_attempt;
3085
if(temp_sortdata->is_service == TRUE) {
3086
temp_svcstatus = temp_sortdata->svcstatus;
3087
last_check[1] = temp_svcstatus->last_check;
3088
next_check[1] = temp_svcstatus->next_check;
3089
status[1] = temp_svcstatus->status;
3090
host_name[1] = temp_svcstatus->host_name;
3091
service_description[1] = temp_svcstatus->description;
3092
current_attempt[1] = temp_svcstatus->current_attempt;
3095
temp_hststatus = temp_sortdata->hststatus;
3096
last_check[1] = temp_hststatus->last_check;
3097
next_check[1] = temp_hststatus->next_check;
3098
status[1] = temp_hststatus->status;
3099
host_name[1] = temp_hststatus->host_name;
3100
service_description[1] = "";
3101
current_attempt[1] = temp_hststatus->current_attempt;
3104
if(s_type == SORT_ASCENDING) {
3106
if(s_option == SORT_LASTCHECKTIME) {
3151
3107
if(last_check[0] <= last_check[1])
3156
if(s_option==SORT_NEXTCHECKTIME){
3112
if(s_option == SORT_NEXTCHECKTIME) {
3157
3113
if(next_check[0] <= next_check[1])
3162
else if(s_option==SORT_CURRENTATTEMPT){
3118
else if(s_option == SORT_CURRENTATTEMPT) {
3163
3119
if(current_attempt[0] <= current_attempt[1])
3168
else if(s_option==SORT_SERVICESTATUS){
3124
else if(s_option == SORT_SERVICESTATUS) {
3169
3125
if(status[0] <= status[1])
3174
else if(s_option==SORT_HOSTNAME){
3175
if(strcasecmp(host_name[0],host_name[1])<0)
3180
else if(s_option==SORT_SERVICENAME){
3181
if(strcasecmp(service_description[0],service_description[1])<0)
3188
if(s_option==SORT_LASTCHECKTIME){
3130
else if(s_option == SORT_HOSTNAME) {
3131
if(strcasecmp(host_name[0], host_name[1]) < 0)
3136
else if(s_option == SORT_SERVICENAME) {
3137
if(strcasecmp(service_description[0], service_description[1]) < 0)
3144
if(s_option == SORT_LASTCHECKTIME) {
3189
3145
if(last_check[0] > last_check[1])
3194
if(s_option==SORT_NEXTCHECKTIME){
3150
if(s_option == SORT_NEXTCHECKTIME) {
3195
3151
if(next_check[0] > next_check[1])
3200
else if(s_option==SORT_CURRENTATTEMPT){
3156
else if(s_option == SORT_CURRENTATTEMPT) {
3201
3157
if(current_attempt[0] > current_attempt[1])
3206
else if(s_option==SORT_SERVICESTATUS){
3162
else if(s_option == SORT_SERVICESTATUS) {
3207
3163
if(status[0] > status[1])
3212
else if(s_option==SORT_HOSTNAME){
3213
if(strcasecmp(host_name[0],host_name[1])>0)
3218
else if(s_option==SORT_SERVICENAME){
3219
if(strcasecmp(service_description[0],service_description[1])>0)
3168
else if(s_option == SORT_HOSTNAME) {
3169
if(strcasecmp(host_name[0], host_name[1]) > 0)
3174
else if(s_option == SORT_SERVICENAME) {
3175
if(strcasecmp(service_description[0], service_description[1]) > 0)
3231
3187
/* free all memory allocated to the sortdata structures */
3232
void free_sortdata_list(void){
3188
void free_sortdata_list(void) {
3233
3189
sortdata *this_sortdata;
3234
3190
sortdata *next_sortdata;
3236
3192
/* free memory for the sortdata list */
3237
for(this_sortdata=sortdata_list;this_sortdata!=NULL;this_sortdata=next_sortdata){
3238
next_sortdata=this_sortdata->next;
3193
for(this_sortdata = sortdata_list; this_sortdata != NULL; this_sortdata = next_sortdata) {
3194
next_sortdata = this_sortdata->next;
3239
3195
free(this_sortdata);