Python, lxml and Xpath

https://lxml.de/xpathxslt.html https://www.w3schools.com/xml/xpath_syntax.asp Read a file with xml, convert it to a string from bytes: pip install lxml from lxml import etree as et Make dictionary (duplicate keys, get atr) result: Code: def xml_to_dict(xmlfile): msg = {} count = 1 with open(xmlfile) as r: xml = r.read() print(type(xml)) parser = et.XMLParser(recover=True, collect_ids=True) root = et.fromstring(bytes(xml, encoding=”utf-8″), parser) x = root.xpath(“//*”)# get all #x […]

Python as systemctl service

https://www.loggly.com/blog/new-style-daemons-python/ https://github.com/torfsen/python-systemd-tutorial This is an easy and not enough tested script, you may also enable it to start at boot. Read about systemctl: https://www.freedesktop.org/software/systemd/man/systemctl.html So create a file in /lib/systemd/system touch python_service.service sudo nano python_service.service run the script with (when it is done and has no erros): This is my test script: It prints service […]

Testing Zabbix VirtualBox 6.0

https://www.virtualbox.org/wiki/Downloads If you’re looking for the latest VirtualBox 5.2 packages, see VirtualBox 5.2 builds. Please also use version 5.2 if you still need support for 32-bit hosts, as this has been discontinued in 6.0. Version 5.2 will remain supported until July 2020. Note: After upgrading VirtualBox it is recommended to upgrade the guest additions as […]