[monit-dev] [monit] r350 committed - ipaddrin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[monit-dev] [monit] r350 committed - ipaddrin

monit-2
Revision: 350
Author:   [hidden email]
Date:     Thu Mar 24 01:16:05 2011
Log:      ipaddrin
http://code.google.com/p/monit/source/detail?r=350

Modified:
  /trunk/collector.c
  /trunk/http/cervlet.c
  /trunk/monitor.h
  /trunk/xml.c

=======================================
--- /trunk/collector.c Wed Jan 19 10:40:32 2011
+++ /trunk/collector.c Thu Mar 24 01:16:05 2011
@@ -99,7 +99,7 @@
      }
    }

-  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");
=======================================
--- /trunk/http/cervlet.c Wed Mar 23 14:31:50 2011
+++ /trunk/http/cervlet.c Thu Mar 24 01:16:05 2011
@@ -2269,7 +2269,7 @@

    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");
=======================================
--- /trunk/monitor.h Fri Feb 18 08:15:27 2011
+++ /trunk/monitor.h Thu Mar 24 01:16:05 2011
@@ -969,7 +969,7 @@
  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();

=======================================
--- /trunk/xml.c Wed Jan 19 10:40:32 2011
+++ /trunk/xml.c Thu Mar 24 01:16:05 2011
@@ -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 @@
   * @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 @@
   * 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 @@
        "<port>%d</port>"
        "<ssl>%d</ssl>"
        "</httpd>",
-      Run.bind_addr?Run.bind_addr:"",
+      Run.bind_addr ? Run.bind_addr : myip,
        Run.httpdport,
        Run.httpdssl);


_______________________________________________
monit-dev mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/monit-dev