5.8.1 breaks xml output
Issue #47
resolved
Hi,
I have this check:
check process squid with pidfile /var/run/squid.pid
start program = "/sbin/service squid start"
stop program = "/sbin/service squid stop"
if failed host 172.16.66.1 port 3128 then restart
group httpd
which produces faulty XML output in 5.8.1 (stripped down to the relevant part):
<hostname>172.16.66.1</hostname>
<portnumber>3128</portnumber>
<request><![CDATA[<![CDATA[]]>]]></request>
<protocol>DEFAULT</protocol>
compare to 5.8:
<hostname>172.16.66.1</hostname>
<portnumber>3128</portnumber>
<request><![CDATA[]]></request>
<protocol>DEFAULT</protocol>
this is the change that breaks xml output in 5.8.1:
diff -w -B -x .svn -Nrup monit-5.8/src/xml.c monit-5.8.1/src/xml.c
--- monit-5.8/src/xml.c
+++ monit-5.8.1/src/xml.c
@@ -255,7 +255,7 @@ static void status_service(Service_T S,
"<port>"
"<hostname>%s</hostname>"
"<portnumber>%d</portnumber>"
- "<request>%s</request>"
+ "<request><![CDATA[%s]]></request>"
"<protocol>%s</protocol>"
"<type>%s</type>"
"<responsetime>%.3f</responsetime>"
Marked as "major" because it neither python nor perl are willing to parse the resulting xml.
Kind regards,
Philippe
Comments (8)
-
repo owner -
Account Deleted reporter nevermind. I use the nagios plugin "check_monit" which failed after updating monit to 5.8.1. It seems that the script silently inserts an additional CDATA into the resulting xml:
xml_hacks = ( (re.compile(r"<request>(.*?)</request>",flags=re.MULTILINE), (r"<request><![CDATA[\1]]></request>")), )
sorry (^_^);;
-
repo owner - changed status to resolved
-
assigned issue to
closing (3rd party bug)
-
Philfry,
How have you fixed the issue?
-
Account Deleted reporter Nothing to do regarding monit.
If you're using check_monit just run
sed -i -r -e '/request><..CDATA/d' check_monit.py
-
repo owner - changed component to 1. Monit
-
repo owner - changed component to Monit
-
repo owner - removed version
Removing version: 5.8.1 (automated comment)
- Log in to comment
I'm not able to reproduce this with the same conf. To get double CDATA in the string would mean that either p->request is wrapped in CDATA which it is not or that there is some interleaved write to the string buffer which seems unlikely. Could you do a make cleanall and try to rebuild Monit from scratch in case there are some old code linked in or you had your own changes in the code? If the problem remains, could you attach a simple monitrc conf that reproduces the problem?