Hey Guys!
We want to work with some xml files and LLD-Discoveryprocess. Therefore I get the XML file into zabbix and we preprocessing I transfer the xml stuff into json.
After that I work with some JSONPath magic. But this is, where the struggling begins.
It is possible to get the LLD value from json. But when we try to get the value for the zabbix-item (by searching via jsonpath with the LLDMacro I run again a wall, again and again (head hurts).
Here is a shortend xml example:
After zabbix transformed into json, the element attributes will begin with a "@".
I can get these values via LLD macro by using $..['@id'] but after building the jsonpath for the prototype, it does not work.
I always get "not a match on json path".
Some ideas?
We want to work with some xml files and LLD-Discoveryprocess. Therefore I get the XML file into zabbix and we preprocessing I transfer the xml stuff into json.
After that I work with some JSONPath magic. But this is, where the struggling begins.
It is possible to get the LLD value from json. But when we try to get the value for the zabbix-item (by searching via jsonpath with the LLDMacro I run again a wall, again and again (head hurts).

Here is a shortend xml example:
Code:
<?xml version="1.0" ?> <!DOCTYPE niktoscan SYSTEM "/usr/share/doc/nikto/nikto.dtd"> <niktoscan hoststest="0" options="-o /srv/report.xml -C all -h http://num.ber.num.ber/" version="2.1.5" scanstart="Fri Oct 29 14:14:11 2021" scanend="Thu Jan 1 01:00:00 1970" scanelapsed=" seconds" nxmlversion="1.2"> <scandetails targetip="ip.ad.dre.ss" targethostname="webserver" targetport="80" targetbanner="Apache/2.4.38 (Debian)" starttime="2021-10-29 14:14:13" sitename="http://webserver:80" siteip="http://bla.bla.bla.bls:80" hostheader="webserver" errors="0" checks="6544"> <item id="999976" osvdbid="0" osvdblink="http://osvdb.org/0" method="GET"> <description><![CDATA[The anti-clickjacking X-Frame-Options header is not present.]]></description> <uri><![CDATA[/]]></uri> <namelink><![CDATA[http://webserver:80/]]></namelink> <iplink></iplink> </item> <item id="999100" osvdbid="0" osvdblink="http://osvdb.org/0" method="GET"> <description><![CDATA[Uncommon header 'link' found, with contents: <http://www.armour.local/wp-json/>; rel="https://api.w.org/"]]></description> <uri><![CDATA[/]]></uri> <namelink><![CDATA[http://webserver:80/]]></namelink> <iplink></iplink> </item> <item id="999100" osvdbid="0" osvdblink="http://osvdb.org/0" method="GET"> <description><![CDATA[Uncommon header 'x-robots-tag' found, with contents: noindex]]></description> <uri><![CDATA[/wp-admin/admin-ajax.php]]></uri> <namelink><![CDATA[http://webserver:80/wp-admin/admin-ajax.php]]></namelink> <iplink></iplink> </item> <item id="999996" osvdbid="0" osvdblink="http://osvdb.org/0" method="GET"> <description><![CDATA["robots.txt" contains 2 entries which should be manually viewed.]]></description> <uri><![CDATA[/robots.txt]]></uri> <namelink><![CDATA[http://webserver:80/robots.txt]]></namelink> <iplink></iplink> </item> <item id="999972" osvdbid="0" osvdblink="http://osvdb.org/0" method="DEBUG"> <description><![CDATA[DEBUG HTTP verb may show server debugging information. See http://msdn.microsoft.com/en-us/library/e8z01xdh%28VS.80%29.aspx for details.]]></description> <uri><![CDATA[HASH(0x5557b46ece08)]]></uri> <namelink><![CDATA[http://webserver:80HASH(0x5557b46ece08)]]></namelink> <iplink></iplink> </item> <item id="999984" osvdbid="0" osvdblink="http://osvdb.org/0" method="GET"> <description><![CDATA[Server leaks inodes via ETags, header found with file /icons/README, fields: 0x13f4 0x438c034968a80 ]]></description> <uri><![CDATA[/icons/README]]></uri> <namelink><![CDATA[http://webserver:80/icons/README]]></namelink> <iplink></iplink> </item> <item id="003584" osvdbid="3233" osvdblink="http://osvdb.org/3233" method="GET"> <description><![CDATA[/icons/README: Apache default file found.]]></description> <uri><![CDATA[/icons/README]]></uri> <namelink><![CDATA[http://webserver:80/icons/README]]></namelink> <iplink></iplink> </item> <item id="006186" osvdbid="3092" osvdblink="http://osvdb.org/3092" method="GET"> <description><![CDATA[/license.txt: License file found may identify site software.]]></description> <uri><![CDATA[/license.txt]]></uri> <namelink><![CDATA[http://webserver:80/license.txt]]></namelink> <iplink></iplink> </item> <statistics elapsed="395" itemsfound="14" itemstested="6544" endtime="2021-10-29 14:20:48" /> </scandetails> </niktoscan>
I can get these values via LLD macro by using $..['@id'] but after building the jsonpath for the prototype, it does not work.
I always get "not a match on json path".
cannot extract value from json by path "$.niktoscan.scandetails.item.*.[?('@id' == "999100")].description": no data matches the specified path
Comment