예제 #1
0
파일: output.c 프로젝트: phiexz/goaccess
/* entry point to generate a report writing it to the fp */
void
output_html (GLog * logger, GHolder * holder)
{
  FILE *fp = stdout;
  char now[DATE_TIME];

  generate_time ();
  strftime (now, DATE_TIME, "%Y-%m-%d %H:%M:%S", now_tm);

  print_html_header (fp, now);
  print_pure_menu (fp, now);

  print_html_summary (fp, logger);
  print_html_visitors_report (fp, holder + VISITORS);
  print_html_request_report (fp, holder + REQUESTS, logger->process);
  print_html_request_report (fp, holder + REQUESTS_STATIC, logger->process);
  print_html_request_report (fp, holder + NOT_FOUND, logger->process);
  print_html_hosts (fp, holder + HOSTS, logger->process);
  print_html_browser_os (fp, holder + OS);
  print_html_browser_os (fp, holder + BROWSERS);
  print_html_generic (fp, holder + REFERRERS, logger->process);
  print_html_generic (fp, holder + REFERRING_SITES, logger->process);
  print_html_generic (fp, holder + KEYPHRASES, logger->process);
#ifdef HAVE_LIBGEOIP
  print_html_geolocation (fp, holder + GEO_LOCATION, logger->process);
#endif
  print_html_status (fp, holder + STATUS_CODES, logger->process);

  print_html_footer (fp);
}
예제 #2
0
파일: crm_mon.c 프로젝트: sipwise/heartbeat
void
mon_update(const HA_Message *msg, int call_id, int rc,
	   crm_data_t *output, void*user_data) 
{
	const char *prefix = NULL;
	if(rc == cib_ok) {
		crm_data_t *cib = NULL;
#if CRM_DEPRECATED_SINCE_2_0_4
		if( safe_str_eq(crm_element_name(output), XML_TAG_CIB) ) {
			cib = output;
		} else {
			cib = find_xml_node(output,XML_TAG_CIB,TRUE);
		}
#else
		cib = output;
		CRM_DEV_ASSERT(safe_str_eq(crm_element_name(cib), XML_TAG_CIB));
#endif		
		if(as_html_file || web_cgi) {
			print_html_status(cib, as_html_file, web_cgi);
		} else if (simple_status) {
			print_simple_status(cib);
			if (has_warnings) {
				exit(1); 
			}
		} else {
			print_status(cib);
		}
		if(one_shot) {
			exit(LSB_EXIT_OK);
		}
		
			
	} else if(simple_status) {
		fprintf(stderr, "Critical: query failed: %s", cib_error2string(rc));
		exit(2);
	} else if(one_shot) {
		fprintf(stderr, "Query failed: %s", cib_error2string(rc));
		exit(LSB_EXIT_OK);

	} else {
		CRM_DEV_ASSERT(cib_conn->cmds->signoff(cib_conn) == cib_ok);
		crm_err("Query failed: %s", cib_error2string(rc));
		prefix = "Query failed! ";
		
	}
	wait_for_refresh(0, prefix, interval);
}