How-to debug corrupted xml file of pnp4nagios

How-to debug corrupted xml file of pnp4nagios

This article explains how to identify and troubleshoot corrupted PNP4Nagios XML files in Checkmk using xmllint.

LAST TESTED ON CHECKMK 2.5.0P14

Troubleshooting corrupted XML files

  1. First, check whether xmllint is already installed on your Checkmk server:

    root@linux~$ command -v xmllint

    If the command returns a path, such as /usr/bin/xmllint, the utility is already installed.


    If no path is returned, install xmllint using the appropriate command for your Linux distribution.


    Debian/Ubuntu

    sudo apt install libxml2-utils

     

    Red Hat Enterprise Linux (RHEL) and binary compatible distributions such as Rocky Linux

    sudo dnf install libxml2

    Note: On older RHEL-based distributions that use yum, run sudo yum install libxml2 instead.


  2. Switch to your Checkmk site user and execute the following command to check the PNP4Nagios XML files. The command saves the output to xmllint.log for further analysis.

    root@linux~$ su - mysite OMD[mysite]:~$ for i in $(find ~/var/pnp4nagios/perfdata/ -name "*xml"); do echo "#####$i####"; xmllint --debug --format $i; echo "#####" ;done &> xmllint.log

     

    TIP: With the parameter --noout, xmllint will show you only the errors and not the whole structure of the xml files.

    root@linux~$ su - mysite OMD[mysite]:~$ for i in $(find ~/var/pnp4nagios/perfdata/ -name "*xml"); do echo "#####$i####"; xmllint  --noout --debug  --format $i; echo "#####" ;done &> xmllint_only_debug.log

     

  3. Visit the Checkmk forum to search for similar PNP4Nagios issues and possible solutions. If you cannot find a resolution, consider creating a new forum post with the relevant error messages and debugging logs.


    If the issue persists, check whether your issue is addressed in Troubleshooting errors during the RRD conversion.

 

Related articles