You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 16
Next »
During the conversion of pnp4nagios files to the rrd format, you may face this errors:
'NoneType' object has no attribute 'text'
OMD[mysite]:~$ cmk -v --convert-rrds --delete-rrds RRD8040
RRD8040:
HOST: RRD8040
ERROR: 'NoneType' object has no attribute 'text'
Let's modify the command to receive more debug output:
OMD[mysite]:~$ cmk -vv --debug --convert-rrds --delete-rrds RRD8040
RRD8040:
Traceback (most recent call last):
File "/omd/sites/rrd/bin/cmk", line 94, in <module>
exit_status = modes.call(mode_name, mode_args, opts, args)
File "/omd/sites/rrd/lib/python/cmk_base/modes/__init__.py", line 72, in call
return mode.handler_function(*handler_args)
File "/omd/sites/rrd/lib/python/cmk_base/modes/cee.py", line 147, in mode_convert_rrds
rrd.do_convert_rrds(*args)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 413, in do_convert_rrds
convert_rrds_of_host(hostname)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 420, in convert_rrds_of_host
existing_rrds = find_host_rrd_services(hostname)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 711, in find_host_rrd_services
for service in find_pnp_rrds(hostname):
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 728, in find_pnp_rrds
xmlinfo = parse_pnp_xml_file(host_dir + "/" + xml_file)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 769, in parse_pnp_xml_file
'host': root.find('NAGIOS_AUTH_HOSTNAME').text,
AttributeError: 'NoneType' object has no attribute 'text'
To find the corrupted files, you can grep for "NAGIOS_AUTH_HOSTNAME" , save the result to a list and compare this list with all xml files
OMD[mysite]:~/var/pnp4nagios/perfdata/RRD8040$ ls |grep ".*.xml" |sort >~/tmp/xml
OMD[mysite]:~/var/pnp4nagios/perfdata/RRD8040$ grep -ril "NAGIOS_AUTH_HOSTNAME" |sort >~/tmp/xml1
OMD[mysite]:~/var/pnp4nagios/perfdata/RRD8040$ diff ~/tmp/xml ~/tmp/xml1
64d63
< Volume_BILDER_BILDER.xml
87d85
< Volume_UNIX_DATA_01_fs_size.xml
100d97
< Volume_nasstore01.BILDER_fs_size.xml
If I check each of these files, the files are looking really different. So either the files are corrupt, or they are not in the right format:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rrd SYSTEM "http://oss.oetiker.ch/rrdtool/rrdtool.dtd">
<!-- Round Robin Database Dump -->
<rrd>
<version>0003</version>
<step>60</step> <!-- Seconds -->
<lastupdate>1497008778</lastupdate> <!-- 2017-06-09 13:46:18 CEST -->
<ds>
<name> 1 </name>
<type> GAUGE </type>
<minimal_heartbeat>8460</minimal_heartbeat>
<min>NaN</min>
<max>NaN</max>
<!-- PDP Status -->
<last_ds>5694.328125</last_ds>
<value>1.0249790625e+05</value>
<unknown_sec> 0 </unknown_sec>
</ds>
<!-- Round Robin Archives -->
<rra>
<cf>AVERAGE</cf>
<pdp_per_row>1</pdp_per_row> <!-- 60 seconds -->
<params>
<xff>5.0000000000e-01</xff>
</params>
<cdp_prep>
<ds>
<primary_value>5.6943281250e+03</primary_value>
<secondary_value>5.6943281250e+03</secondary_value>
<value>NaN</value>
<unknown_datapoints>0</unknown_datapoints>
</ds>
</cdp_prep>
<database>
<!-- 2017-06-07 13:47:00 CEST / 1496836020 --> <row><v>5.6934375000e+03</v></row>
<!-- 2017-06-07 13:48:00 CEST / 1496836080 --> <row><v>5.6934375000e+03</v></row>
<!-- 2017-06-07 13:49:00 CEST / 1496836140 --> <row><v>5.6934375000e+03</v></row>
<!-- 2017-06-07 13:50:00 CEST / 1496836200 --> <row><v>5.6934375000e+03</v></row>
<!-- 2017-06-07 13:51:00 CEST / 1496836260 --> <row><v>5.6934375000e+03</v></row>
<!-- 2017-06-07 13:52:00 CEST / 1496836320 --> <row><v>5.6934375000e
The only solution is to delete these files and run the conversion again!
'ascii' codec can't decode characters
OMD[mysite]:~$ cmk --convert-rrds localhost
Traceback (most recent call last):
File "/omd/sites/rrd/bin/cmk", line 94, in <module>
exit_status = modes.call(mode_name, mode_args, opts, args)
File "/omd/sites/rrd/lib/python/cmk_base/modes/__init__.py", line 72, in call
return mode.handler_function(*handler_args)
File "/omd/sites/rrd/lib/python/cmk_base/modes/cee.py", line 147, in mode_convert_rrds
rrd.do_convert_rrds(*args)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 413, in do_convert_rrds
convert_rrds_of_host(hostname)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 428, in convert_rrds_of_host
console.error(" %sERROR: %s%s\n" % (tty.red + tty.bold, e, tty.normal))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 70-75: ordinal not in range(128)
Let's modify the command to receive more debug output:
OMD[rrd]:~$ cmk -vv --debug --convert-rrds localhost
...
Urlaubstüüüüüüge (PNP)...
- Metric1..Traceback (most recent call last):
File "/omd/sites/rrd/bin/cmk", line 94, in <module>
exit_status = modes.call(mode_name, mode_args, opts, args)
File "/omd/sites/rrd/lib/python/cmk_base/modes/__init__.py", line 72, in call
return mode.handler_function(*handler_args)
File "/omd/sites/rrd/lib/python/cmk_base/modes/cee.py", line 147, in mode_convert_rrds
rrd.do_convert_rrds(*args)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 413, in do_convert_rrds
convert_rrds_of_host(hostname)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 422, in convert_rrds_of_host
convert_pnp_rrds(hostname, existing_rrds)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 441, in convert_pnp_rrds
cmk.utils.pnp_cleanup(servicedesc), target_rrdconf)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 472, in convert_pnp_rrds_of
result = convert_pnp_rrd(old_rrd_path, new_rrd_path, old_ds_name, rrdconf)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 497, in convert_pnp_rrd
old_rrdconf = get_old_rrd_config(old_rrd_path, old_ds_name)
File "/omd/sites/rrd/lib/python/cmk_base/cee/rrd.py", line 789, in get_old_rrd_config
old_config_raw = rrdtool.info([rrd_file_path])
TypeError: Element 0 in argument 0 must be str
'NoneType' object has no attribute 'replace'
OMD[cmk]:~$ cmk -v --convert-rrds RRD-a
fr010-n001:
...
...
...
STP Topology Changes (PNP)...
HOST: RRD-a
ERROR: 'NoneType' object has no attribute 'replace'
OMD[cmk]:~$ cmk --debug -vv --convert-rrds RRD-a
RRD-a:
Traceback (most recent call last):
File "/omd/sites/cmk/bin/cmk", line 94, in <module>
exit_status = modes.call(mode_name, mode_args, opts, args)
File "/omd/sites/cmk/lib/python/cmk_base/modes/__init__.py", line 72, in call
return mode.handler_function(*handler_args)
File "/omd/sites/cmk/lib/python/cmk_base/modes/cee.py", line 147, in mode_convert_rrds
rrd.do_convert_rrds(*args)
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 413, in do_convert_rrds
convert_rrds_of_host(hostname)
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 420, in convert_rrds_of_host
existing_rrds = find_host_rrd_services(hostname)
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 711, in find_host_rrd_services
for service in find_pnp_rrds(hostname):
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 729, in find_pnp_rrds
xmlinfo = parse_pnp_xml_file(host_dir + "/" + xml_file)
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 760, in parse_pnp_xml_file
root = ET.parse(xml_path).getroot()
File "/omd/sites/cmk/lib/python2.7/xml/etree/ElementTree.py", line 1182, in parse
tree.parse(source, parser)
File "/omd/sites/cmk/lib/python2.7/xml/etree/ElementTree.py", line 656, in parse
parser.feed(data)
File "/omd/sites/cmk/lib/python2.7/xml/etree/ElementTree.py", line 1659, in feed
self._raiseerror(v)
File "/omd/sites/cmk/lib/python2.7/xml/etree/ElementTree.py", line 1523, in _raiseerror
raise err
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 5, column 91
Create debug inside the code:
OMD[cmk]:~$ cmk --debug -vv --convert-rrds RRD-a
RRD-a:
CPU_utilization.xml
Check_MK.xml
Disk_IO_SUMMARY.xml
DotNet_Memory_Management__Global_.xml
Interface_1.xml
Interface_2.xml
Interface_3.xml
Interface_vmxnet3_Ethernet_Adapter.xml
MSSQLSERVER_SMS_Siemag_Backup.xml
MSSQLSERVER_SMS_Siemag_Sizes.xml
MSSQLSERVER_Translate_Artikel_Backup.xml
MSSQLSERVER_Translate_Artikel_Sizes.xml
MSSQLSERVER_Translate_Nestl�_Backup.xml
Traceback (most recent call last):
File "/omd/sites/cmk/bin/cmk", line 94, in <module>
exit_status = modes.call(mode_name, mode_args, opts, args)
File "/omd/sites/cmk/lib/python/cmk_base/modes/__init__.py", line 72, in call
return mode.handler_function(*handler_args)
File "/omd/sites/cmk/lib/python/cmk_base/modes/cee.py", line 147, in mode_convert_rrds
rrd.do_convert_rrds(*args)
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 413, in do_convert_rrds
convert_rrds_of_host(hostname)
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 420, in convert_rrds_of_host
existing_rrds = find_host_rrd_services(hostname)
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 711, in find_host_rrd_services
for service in find_pnp_rrds(hostname):
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 729, in find_pnp_rrds
xmlinfo = parse_pnp_xml_file(host_dir + "/" + xml_file)
File "/omd/sites/cmk/lib/python/cmk_base/cee/rrd.py", line 760, in parse_pnp_xml_file
root = ET.parse(xml_path).getroot()
File "/omd/sites/cmk/lib/python2.7/xml/etree/ElementTree.py", line 1182, in parse
tree.parse(source, parser)
File "/omd/sites/cmk/lib/python2.7/xml/etree/ElementTree.py", line 656, in parse
parser.feed(data)
File "/omd/sites/cmk/lib/python2.7/xml/etree/ElementTree.py", line 1659, in feed
self._raiseerror(v)
File "/omd/sites/cmk/lib/python2.7/xml/etree/ElementTree.py", line 1523, in _raiseerror
raise err
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 5, column 91