1 /******************************************************************************
3 * Copyright (C) 2012-2018 Icinga Development Team (https://icinga.com/) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
29 BunitB = 0, BunitkB = 1, BunitMB = 2, BunitGB = 3, BunitTB = 4
34 TunitMS, TunitS, TunitM, TunitH
39 OK = 0, WARNING = 1, CRITICAL = 2
45 // doubles are always enough for ANY 64 bit value
48 // true means everything BELOW upper/outside [lower-upper] is fine
55 threshold(const double v, const double c, bool l = true, bool p = false);
57 threshold(const std::wstring&);
59 // returns true if the threshold is broken
60 bool rend(const double val, const double max = 100.0);
62 // returns a printable string of the threshold
63 std::wstring pString(const double max = 100.0);
65 threshold toSeconds(const Tunit& fromUnit);
68 std::wstring removeZero(double);
69 std::vector<std::wstring> splitMultiOptions(const std::wstring&);
71 Bunit parseBUnit(const std::wstring&);
72 std::wstring BunitStr(const Bunit&);
73 Tunit parseTUnit(const std::wstring&);
74 std::wstring TunitStr(const Tunit&);
76 void printErrorInfo(unsigned long err = 0);
77 std::wstring formatErrorInfo(unsigned long err);
79 std::wstring stateToString(const state&);
81 #endif /* THRESHOLDS_H */