Permalink
Browse files

ipaddrin

git-svn-id: http://monit.googlecode.com/svn/trunk@350 808b68a2-07de-11de-a1f0-819f45317607
  • Loading branch information...
1 parent 8ba90e9 commit e9195ca104ea8248819cbe67114e8edec7d45700 mmonit@tildeslash.com committed Mar 24, 2011
Showing with 10 additions and 8 deletions.
  1. +1 −1 collector.c
  2. +1 −1 http/cervlet.c
  3. +1 −1 monitor.h
  4. +7 −5 xml.c
View
@@ -99,7 +99,7 @@ int handle_mmonit(Event_T E) {
}
}
- D = status_xml(E, E ? LEVEL_SUMMARY : LEVEL_FULL, 2);
+ D = status_xml(E, E ? LEVEL_SUMMARY : LEVEL_FULL, 2, socket_get_local_host(socket));
if(!data_send(socket, C, D)) {
LogError("M/Monit: communication failed\n");
View
@@ -2269,7 +2269,7 @@ static void print_status(HttpRequest req, HttpResponse res, int version)
if(stringFormat && Util_startsWith(stringFormat, "xml"))
{
- char *D = status_xml(NULL, level, version);
+ char *D = status_xml(NULL, level, version, socket_get_local_host(req->S));
out_print(res, "%s", D);
FREE(D);
set_content_type(res, "text/xml");
View
@@ -969,7 +969,7 @@ int sha_md5_stream (FILE *, void *, void *);
void reset_procinfo(Service_T);
int check_service_status(Service_T);
void printhash(char *);
-char *status_xml(Event_T, short, int);
+char *status_xml(Event_T, short, int, const char *);
int handle_mmonit(Event_T);
int do_wakeupcall();
View
12 xml.c
@@ -67,7 +67,7 @@
/* -------------------------------------------------------------- Prototypes */
-static void document_head(Buffer_T *, int);
+static void document_head(Buffer_T *, int, const char *);
static void document_foot(Buffer_T *);
static void status_service(Service_T, Buffer_T *, short, int);
static void status_servicegroup(ServiceGroup_T, Buffer_T *, short);
@@ -83,17 +83,18 @@ static void status_event(Event_T, Buffer_T *);
* @param E An event object or NULL for general status
* @param L Status information level
* @param V Format version
+ * @param myip The client-side IP address
* @return XML document or NULL in the case of error. The caller must free
* the memory.
*/
-char *status_xml(Event_T E, short L, int V) {
+char *status_xml(Event_T E, short L, int V, const char *myip) {
Buffer_T B;
Service_T S;
ServiceGroup_T SG;
memset(&B, 0, sizeof(Buffer_T));
- document_head(&B, V);
+ document_head(&B, V, myip);
if (V == 2)
Util_stringbuffer(&B, "<services>");
@@ -123,8 +124,9 @@ char *status_xml(Event_T E, short L, int V) {
* Prints a document header into the given buffer.
* @param B Buffer object
* @param V Format version
+ * @param myip The client-side IP address
*/
-static void document_head(Buffer_T *B, int V) {
+static void document_head(Buffer_T *B, int V, const char *myip) {
Util_stringbuffer(B,
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
if (V == 2) {
@@ -164,7 +166,7 @@ static void document_head(Buffer_T *B, int V) {
"<port>%d</port>"
"<ssl>%d</ssl>"
"</httpd>",
- Run.bind_addr?Run.bind_addr:"",
+ Run.bind_addr ? Run.bind_addr : myip,
Run.httpdport,
Run.httpdssl);

0 comments on commit e9195ca

Please sign in to comment.