[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opennms-discuss
Subject:    [opennms-discuss] xml filter tag content error
From:       JohnD Blackburn <johnd.blackburn () au ! abb ! com>
Date:       2018-08-06 6:25:08
Message-ID: DB6PR0602MB290218D4B7F8A3F85BF30704CB200 () DB6PR0602MB2902 ! eurprd06 ! prod ! outlook ! com
[Download RAW message or body]

I've just come across an issue with interpretation of the contents of the filter tag.

I was having an issue with a threshold not triggering, that was caused by this filter \
line:

      <filter>IPADDR != '0.0.0.0' &amp; (nodeSysOID LIKE '.1.3.6.1.4.1.2021.%' | \
nodeSysOID LIKE '.1.3.6.1.4.1.8072.%' | nodeSysOID LIKE '.1.3.6.1.4.1.311.%)</filter>

Notice the missing quote mark after the last OID

When I investigated the failing threshold, I found a log entry stating that the \
filter did not match any IP address.

This was broken for more than a month before we noticed it was an issue, and changing \
the filter line to the following fixed the issue immediately:

      <filter>IPADDR != '0.0.0.0' &amp; (nodeSysOID LIKE '.1.3.6.1.4.1.2021.%' | \
nodeSysOID LIKE '.1.3.6.1.4.1.8072.%' | nodeSysOID LIKE \
'.1.3.6.1.4.1.311.%')</filter>

Now I understand that the text between the <filter> and </filter> tags, according to \
the XML spec, can be just about anything, and therefore, the 1st (incorrect line) is \
still perfectly valid XML (so the use of xmllint did not show an error)

Would it be possible to make OpenNMS more critical of the content between the \
"filter" tags so that an error like this could be reported as such?

Regards,
John


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:ABBvoice;
	panose-1:2 13 6 3 2 5 3 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Verdana",sans-serif;
	color:windowtext;
	font-weight:normal;
	font-style:normal;
	text-decoration:none none;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-AU" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">I&#8217;ve just come across an \
issue with interpretation of the contents of the filter tag.<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">I was \
having an issue with a threshold not triggering, that was caused by this filter \
line:<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&lt;filter&gt;IPADDR != '0.0.0.0' &amp;amp; (nodeSysOID LIKE '.1.3.6.1.4.1.2021.%' | \
nodeSysOID LIKE '.1.3.6.1.4.1.8072.%' | nodeSysOID LIKE \
'.1.3.6.1.4.1.311.%)&lt;/filter&gt;<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">Notice the \
missing quote mark after the last OID<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">When I \
investigated the failing threshold, I found a log entry stating that the filter did \
not match any IP address.<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">This was \
broken for more than a month before we noticed it was an issue, and changing the \
filter line to the following fixed the issue immediately:<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&lt;filter&gt;IPADDR != '0.0.0.0' &amp;amp; (nodeSysOID LIKE '.1.3.6.1.4.1.2021.%' | \
nodeSysOID LIKE '.1.3.6.1.4.1.8072.%' | nodeSysOID LIKE \
'.1.3.6.1.4.1.311.%')&lt;/filter&gt;<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">Now I \
understand that the text between the &lt;filter&gt; and &lt;/filter&gt; tags, \
according to the XML spec, can be just about anything, and therefore, the \
1<sup>st</sup> (incorrect line) is still perfectly  valid XML (so the use of xmllint \
did not show an error)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">Would it \
be possible to make OpenNMS more critical of the content between the \
&#8220;filter&#8221; tags so that an error like this could be reported as \
such?<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">Regards,<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">John<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormalCxSpMiddle" style="mso-margin-bottom-alt:auto;mso-add-space:auto"> \
<span style="font-size:9.0pt;font-family:&quot;ABBvoice&quot;,sans-serif;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormalCxSpMiddle" \
style="mso-margin-bottom-alt:auto;mso-add-space:auto"> <span \
style="font-size:9.0pt;font-family:&quot;ABBvoice&quot;,sans-serif;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormalCxSpMiddle" style="margin-bottom:13.0pt;mso-add-space:auto"><span \
style="font-size:9.0pt;font-family:&quot;ABBvoice&quot;,sans-serif;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>


[Attachment #4 (--===============3078917082944892934==)]
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-discuss mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-discuss

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic