4 #include "../svn-revision.h"
13 void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
22 void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
32 if (request.getURI() ==
"/")
42 static void outputValue(std::ostream& os,
const std::string& name,
const std::string& units,
double value)
44 os << Poco::format(
"<%s units=\"%s\">%f</%s>\n", name, units, value, name);
47 static void outputValue(std::ostream& os,
const std::string& name,
const std::string& units,
int value)
49 os << Poco::format(
"<%s units=\"%s\">%d</%s>\n", name, units, value, name);
52 static void outputValue(std::ostream& os,
const std::string& name,
const std::string& units,
unsigned int value)
54 os << Poco::format(
"<%s units=\"%s\">%u</%s>\n", name, units, value, name);
57 static void outputValue(std::ostream& os,
const std::string& name,
const std::string& units,
const std::string& value)
59 os << Poco::format(
"<%s units=\"%s\">%s</%s>\n", name, units, value, name);
62 static void outputTimeValue(std::ostream& os,
const std::string& name, time_t value)
64 char time_buffer[128];
65 strftime(time_buffer,
sizeof(time_buffer),
"%H:%M, %a %d %b", localtime(&value));
66 os << Poco::format(
"<%s units=\"\" fromepoch=\"%lu\" iso=\"%s\">%s</%s>\n", name, (
unsigned long)value,
67 Poco::DateTimeFormatter::format(Poco::Timestamp::fromEpochTime(value),
"%Y-%m-%dT%H:%M:%S%z"),
68 std::string(time_buffer), name);
71 static const char*
nagios_status[] = {
"OK",
"WARNING",
"CRITICAL",
"UNKNOWN" };
77 Poco::Util::Application& app = Poco::Util::Application::instance();
79 response.setChunkedTransferEncoding(
true);
80 response.setContentType(
"text/xml");
81 std::ostream& ostr = response.send();
83 ostr <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
115 outputValue(ostr,
"ICPSVNRevision",
"", ICPSVN_Revision);
117 Poco::format(
"SVN revision %s (%s, %s %s, %s)", ICPSVN_Revision, ICPSVN_Date, ICPSVN_Mixed, ICPSVN_Range, ICPSVN_Modified));
118 ostr <<
"</values>\n";
123 Poco::Util::Application& app = Poco::Util::Application::instance();
125 response.setChunkedTransferEncoding(
true);
126 response.setContentType(
"text/plain");
127 std::ostream& ostr = response.send();
129 const std::string& item = request.getURI();
130 if (
"/VeroPercent" == item)
134 else if (
"/ShutterStatus" == item)
138 else if (
"/ShutterVal" == item)
142 else if (
"/DAEStatus" == item)
const ISISCRPT_STRUCT * m_crpt
static const char * sestatus_names[]
static const char * nagios_status[]
int64_t update_total_counts
static void outputTimeValue(std::ostream &os, const std::string &name, time_t value)
void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response)
RootHandler(const ISISCRPT_STRUCT *crpt)
static const char * nagios_shutter_val[]
static const char * DAEType_desc[]
int dae_type
time CRPT unloaded (may not be set if program crashed)
char long_title[ISISCRPT_TITLE_LEN+1]
boost::array< unsigned, ISISCRPT_MAX_MONITOR > monitor_sum
static const char * runstatus_names[]
void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response)
const ISISCRPT_STRUCT * m_crpt
double eventModeCardFraction() const
char user_name[ISISCRPT_USER_NAME_LEN+1]
char inst_name[ISISCRPT_INST_LEN+1]
Poco::Net::HTTPRequestHandler * createRequestHandler(const Poco::Net::HTTPServerRequest &request)
const ISISCRPT_STRUCT * m_crpt
DataHandler(const ISISCRPT_STRUCT *crpt)
static void outputValue(std::ostream &os, const std::string &name, const std::string &units, double value)
ICPRequestHandlerFactory(const ISISCRPT_STRUCT *crpt)