stanvit / nagios-monit-plugin

Nagios plugin for monit state checking
MIT License
12 stars 5 forks source link

Plugin crash if 'port response time' have funny characters #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, I try to monitor nginx process:

Process 'nginx'
  status                            running
  monitoring status                 monitored
  pid                               24480
  parent pid                        1
  uptime                            6d 14h 44m 
  childrens                         16
  memory kilobytes                  2720
  memory kilobytes total            201692
  memory percent                    0.0%
  memory percent total              1.2%
  cpu percent                       0.0%
  cpu percent total                 0.0%
  port response time                0.357s to example.com:443/sometext/?uact=get_info&cid=10383&sid=3&duser=user&dpass=pass [HTTP via TCPSSL]
  port response time                0.001s to example.com:80 [HTTP via TCP]
  data collected                    Wed Jul 21 20:08:36 2010

Traceback (most recent call last):
  File "./check_monit.py", line 130, in <module>
    main()
  File "./check_monit.py", line 118, in main
    process_status(get_status())
  File "./check_monit.py", line 94, in process_status
    tree = xml.etree.ElementTree.fromstring(status)
  File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 963, in XML
    parser.feed(text)
  File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 1245, in feed
    self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 98, column 
40

I use revision 5  and Python 2.5.2 under Debian lenny i386

Original issue reported on code.google.com by Tem...@gmail.com on 21 Jul 2010 at 4:31

GoogleCodeExporter commented 9 years ago
Fixed: Monit puts monitoring URI into its XML output, but ampersand is 
considered as invalid for XML. Wrapped with CDATA.

Original comment by stas.vit...@gmail.com on 24 Jul 2010 at 4:09