zabbix-tooling / zabbix-agent-extensions

zabbix-agent-extensions
GNU General Public License v2.0
111 stars 45 forks source link

YAML "parser" is not working #24

Closed bilbolodz closed 5 years ago

bilbolodz commented 5 years ago

Your "YAML parcel" from zabbix_checkpuppetstate is NOT working for such puppet summay file (space replaced by because of github autoformat):


version: __config: __puppet: "3.8.7" time: ____last_run: 1548848434

any ideas how to fix it?

bilbolodz commented 5 years ago

I've managed to "cope with this" by modifying match strings to: "^[ ]{2}([^ ]+):" "^[ ]{2}[ ]+([^ ]+): (.+)$"

but it VERY UGLY trick to match ONLY my puppet file NOT the general solution.

scoopex commented 5 years ago

Can you upload a complete yaml file? (You can probably add with the code formatting or by uploading a example file). Sorry for doing manual yaml parsing :-) I just wanted to prevent the usage of an additional dependency.

bilbolodz commented 5 years ago

Manual yaml parsing is VERY good idea. I've uploaded my to pastbin: https://pastebin.com/JmBNNVkN

bilbolodz commented 5 years ago

Any news?

scoopex commented 5 years ago

Does the file really contain leading space in any line? Can you upload a complete file as a example?

Have you considered to update to a not that outdated release of puppet ? :-) (in know that this question is rhetoric :-))

Solution idea: Calculate the number of leading spaces after tripe dash header and trim that number of spaces in every line. Probably you can submit a patch, i would probably accept it.

bilbolodz commented 5 years ago

File uploaded. last_run_summary.yaml.gz

I'm not in power to change anything in puppet.

scoopex commented 5 years ago

Ah, ok :-) The file is really that short - i had the impression that you shortened the file. Welcome to the world of opensource, i implemented a workaround for free, for you and your pretty outdated puppet release :-)

https://github.com/scoopex/zabbix-agent-extensions/commit/40dd29c1cf2121d19d76ab3d6160e9b06c950f00

I created a new release tag, but unfortunately travisci seems to be broken :-)