summaryrefslogtreecommitdiffstats
path: root/lib/base/perfdatavalue.hpp
blob: 05b2c34acd3bc61ac309cc07b8324e01299024c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */

#ifndef PERFDATAVALUE_H
#define PERFDATAVALUE_H

#include "base/i2-base.hpp"
#include "base/perfdatavalue-ti.hpp"

namespace icinga
{

/**
 * A performance data value.
 *
 * @ingroup base
 */
class PerfdataValue final : public ObjectImpl<PerfdataValue>
{
public:
	DECLARE_OBJECT(PerfdataValue);

	PerfdataValue() = default;

	PerfdataValue(const String& label, double value, bool counter = false, const String& unit = "",
		const Value& warn = Empty, const Value& crit = Empty,
		const Value& min = Empty, const Value& max = Empty);

	static PerfdataValue::Ptr Parse(const String& perfdata);
	String Format() const;

private:
	static Value ParseWarnCritMinMaxToken(const std::vector<String>& tokens,
		std::vector<String>::size_type index, const String& description);
};

}

#endif /* PERFDATA_VALUE */