]> granicus.if.org Git - icinga2/commitdiff
Change B/s unit to B to comply with Nagios plugin spec
authorPer von Zweigbergk <pvz@itassistans.se>
Thu, 5 Nov 2015 16:27:41 +0000 (17:27 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 23 Feb 2016 08:17:53 +0000 (09:17 +0100)
Unfortunately B/s is not a valid unit in the Nagios plugin specification. As a bit of a sad workaround, we set the unit to B, which is technically incorrect, but we can't really do much about that without amending the spec...

fixes #10544

Signed-off-by: Jean Flach <jean-marcel.flach@netways.de>
plugins/check_network.cpp

index da3ad1935fea5715fd94ee7e0ca978f47d46f057..65d11d890bc2b1d29ebe063f647e77a1aa874fcb 100644 (file)
@@ -101,7 +101,7 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
                std::cout << desc;
                wprintf(
                        L"\nIt will then output a string looking something like this:\n\n"
-                       L"\tNETWORK WARNING 1131B/s | network=1131B/s;1000;7000;0\n\n"
+                       L"\tNETWORK WARNING 1131B/s | network=1131B;1000;7000;0\n\n"
                        L"\"NETWORK\" being the type of the check, \"WARNING\" the returned status\n"
                        L"and \"1131B/s\" is the returned value.\n"
                        L"The performance data is found behind the \"|\", in order:\n"
@@ -190,7 +190,7 @@ INT printOutput(printInfoStruct& printInfo, CONST std::vector<nInterface>& vInte
                        wsFriendlyName = it->name;
                }
                boost::algorithm::replace_all(wsFriendlyName, "'", "''");
-               tss << L"netI='" << wsFriendlyName << L"';in=" << it->BytesInSec << "B/s;out=" << it->BytesOutSec << L"B/s ";
+               tss << L"netI='" << wsFriendlyName << L"';in=" << it->BytesInSec << "B;out=" << it->BytesOutSec << L"B ";
        }
 
        if (printInfo.warn.rend(tIn + tOut))
@@ -198,7 +198,7 @@ INT printOutput(printInfoStruct& printInfo, CONST std::vector<nInterface>& vInte
        if (printInfo.crit.rend(tIn + tOut))
                state = CRITICAL;
 
-       perfDataFirst << L"network=" << tIn + tOut << L"B/s;" << printInfo.warn.pString() << L";" << printInfo.crit.pString() << L";" << L"0; ";
+       perfDataFirst << L"network=" << tIn + tOut << L"B;" << printInfo.warn.pString() << L";" << printInfo.crit.pString() << L";" << L"0; ";
 
        switch (state) {
        case OK: