Skip to content

Fix perfdata format for OS load (value=current;warning;critical)#14

Open
cinek810 wants to merge 1 commit intostanvit:masterfrom
cinek810:master
Open

Fix perfdata format for OS load (value=current;warning;critical)#14
cinek810 wants to merge 1 commit intostanvit:masterfrom
cinek810:master

Conversation

@cinek810
Copy link

This is old Nagios style to return current value with warning and critical. It should not be used for 1 minute, 5 minute and 15 minutes, since those are just different measures and should be returned separately.

This is old Nagios style to return current value with warning and
critical. It should not be used for 1 minute, 5 minute and 15 minutes,
since those are just different measures and should be returned
separately.

Just using space as a field separator didn't fully work. Testing with
icinga2 shows performance data correctly, but when send to influxdb2 all
were considered the same metric.
@stanvit
Copy link
Owner

stanvit commented Dec 3, 2023

Hi @cinek810 , thanks for the change
I'm a bit worrying about those who could still use the old style of System Load performance data, do you think that maybe it would be more backwards compatible to keep both formats? Would this format work for your use case?

perfdata.append('load=%s;%s;%s load1=%s load5=%s load15=%s'%(avg01,avg05,avg15,avg01,avg05,avg15))

@cinek810
Copy link
Author

I see it's not backward compatible for former users of the plugin. Maybe instead of having two we should add a switch to enable new behavior? I can work on that - what do you think?
I don't like having both since it will likely double number of stats in the backend databases.

@stanvit
Copy link
Owner

stanvit commented Dec 15, 2023

I see it's not backward compatible for former users of the plugin. Maybe instead of having two we should add a switch to enable new behavior? I can work on that - what do you think? I don't like having both since it will likely double number of stats in the backend databases.

Yeah, having an option would be the best, I would appreciate if you added it.

Perhaps we should leave --load as it is and add a new parameter, something like --separate-la:

...
p.add_option("-L","--load", dest="process_la", action="store_true", default=False, help="Display load average performance data"
p.add_option("--separate-la", dest="separate_la", action="store_true", default=False, help="Display LA1, LA5 and LA15 values separately in performance data"
...
        if opts.process_la:
            process_system_load(service, opts.separate_la)
...
def process_system_load(service, separate_la=False):
    prefix = find_existing_prefix(service, ["system/load", "load"])
    ...
    if separate_la:
        perfdata.append('load1=%s load5=%s load15=%s'%(avg01,avg05,avg15))
    else:    
        perfdata.append('load=%s;%s;%s'%(avg01,avg05,avg15))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants