def test_process_perf_string(): lines = process_nagios_perf_data('', "'_var'=9GB;15;15;0;15 '_foo.bar'=2GB;4;4;0;4 '_bar baz'=4GB;4;4;0;4 'D:\_Label:Data__Serial_Number_8c4da61a'=209524MB;2310;4620;0;230998", '123') assert 4 == len(lines) assert "'_var' 9 123" == lines[0] assert "'_foo_bar' 2 123" == lines[1] assert "'_bar_baz' 4 123" == lines[2] assert "'D___Label_Data__Serial_Number_8c4da61a' 209524 123" == lines[3]
def test_process_perf_string(): lines = process_nagios_perf_data( '', "'_var'=9GB;15;15;0;15 '_foo.bar'=2GB;4;4;0;4 '_bar baz'=4GB;4;4;0;4 'D:\_Label:Data__Serial_Number_8c4da61a'=209524MB;2310;4620;0;230998 negative=-1 important=50", '123') assert 6 == len(lines) assert "'_var' 9 123" == lines[0] assert "'_foo_bar' 2 123" == lines[1] assert "'_bar_baz' 4 123" == lines[2] assert "'D___Label_Data__Serial_Number_8c4da61a' 209524 123" == lines[3] assert "negative -1 123" == lines[4] assert "important 50 123" == lines[5]
def test_process_perf_string(): lines = process_nagios_perf_data( "", "'_var'=9GB;15;15;0;15 '_foo.bar'=2GB;4;4;0;4 '_bar baz'=4GB;4;4;0;4 'D:\_Label:Data__Serial_Number_8c4da61a'=209524MB;2310;4620;0;230998 negative=-1 important=50", "123", ) assert 6 == len(lines) assert "'_var' 9 123" == lines[0] assert "'_foo_bar' 2 123" == lines[1] assert "'_bar_baz' 4 123" == lines[2] assert "'D___Label_Data__Serial_Number_8c4da61a' 209524 123" == lines[3] assert "negative -1 123" == lines[4] assert "important 50 123" == lines[5]
def process_host_perf_data(carbon_string, perf_data, time_stamp): """ given the nagios perfdata, and some variables we return a list of carbon formatted values. carbon_string should already have a trailing . """ return process_nagios_perf_data(carbon_string, perf_data, time_stamp)
def process_service_perf_data(carbon_string, perf_data, time_stamp): """ given the nagios perfdata, and some variables we return a list of carbon formatted strings. """ return process_nagios_perf_data(carbon_string, perf_data, time_stamp)