Enhanced parser#90
Conversation
…le perfdata labels with spaces and nasty characters.
…ectory variable back to default. Adding some comments.
…g 'pct' to make identifying percentage units easier in the graphite tree
|
Hi There, sorry for the delay I was at a conference (re:invent) all week. Thank you for taking the time to write this. Can you take a peek at the 'parserfix' branch and see if that works with your data? The branch is going to be a bit behind now, because for some reason people keep saying they will go test it and no-one ever gets back to me. :) heh Anyways, if the parserfix branch doesn't fix the problem, then I'll take a closer look at this and we'll move forward with it. Have a good day. |
|
Hey Shawn, e.g., >>> import shlex
>>> shlex.split(s)
['c:', 'free=201.06451GB;0.97656;0.48828;0;279.37899', 'c:', 'free', '%=71%;0;0;0;100']It looks like that's all that the parserfix branch is doing is those few lines. I checked to make sure my parser could handle labels with single quotes in them as was intended with the shlex split using this raw data: raws = [ "c: free=201.06451GB;0.97656;0.48828;0;279.37899 c: free %=71%;0;0;0;100",
"total 5m=2%;80;90 total 1m=1%;80;90 total 5s=2%;80;90",
"my perf/descrip is awsom!=20gbs;30ms;70rs dis$isdope=45%;80gs",
"'label cool'=56mb;10mb;8mb bob's awesome label=45mbps;43mbps",
]It looks like it handles it just fine. My new function in the enhanced-parser branch should be able to handle any character in the label name as long as it's not an = or ; which I think is similar to how pnp4nagios handles parsing. Please do test it though :-) |
Love the project by the way. However, a lot of my perfdata comes from windows boxes and NSClient++ which spits back nasty perfdata UOM strings. raws[0] and raws[1] in the below example are actual sample data that makes up 80% of my disk space checks. These were all throwing exceptions in the process_log() function because it was splitting on spaces. I wrote a parser_enhanced() function that finds the true delimiter with nasty perfdata strings like this.
Let me know if it looks like it could benefit the project.
Types of exceptions I was seeing

How it was showing up in Graphite:
