summaryrefslogtreecommitdiffstats
path: root/lib/livestatus/livestatuslogutility.hpp
blob: 66d11548f55e51673e3c7dbd09595282b24a3769 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */

#ifndef LIVESTATUSLOGUTILITY_H
#define LIVESTATUSLOGUTILITY_H

#include "livestatus/historytable.hpp"

using namespace icinga;

namespace icinga
{

enum LogEntryType {
	LogEntryTypeHostAlert,
	LogEntryTypeHostDowntimeAlert,
	LogEntryTypeHostFlapping,
	LogEntryTypeHostNotification,
	LogEntryTypeHostInitialState,
	LogEntryTypeHostCurrentState,
	LogEntryTypeServiceAlert,
	LogEntryTypeServiceDowntimeAlert,
	LogEntryTypeServiceFlapping,
	LogEntryTypeServiceNotification,
	LogEntryTypeServiceInitialState,
	LogEntryTypeServiceCurrentState,
	LogEntryTypeTimeperiodTransition,
	LogEntryTypeVersion,
	LogEntryTypeInitialStates,
	LogEntryTypeProgramStarting
};

enum LogEntryClass {
	LogEntryClassInfo = 0,
	LogEntryClassAlert = 1,
	LogEntryClassProgram = 2,
	LogEntryClassNotification = 3,
	LogEntryClassPassive = 4,
	LogEntryClassCommand = 5,
	LogEntryClassState = 6,
	LogEntryClassText = 7
};

/**
 * @ingroup livestatus
 */
class LivestatusLogUtility
{
public:
	static void CreateLogIndex(const String& path, std::map<time_t, String>& index);
	static void CreateLogIndexFileHandler(const String& path, std::map<time_t, String>& index);
	static void CreateLogCache(std::map<time_t, String> index, HistoryTable *table, time_t from, time_t until, const AddRowFunction& addRowFn);
	static Dictionary::Ptr GetAttributes(const String& text);

private:
	LivestatusLogUtility();
};

}

#endif /* LIVESTATUSLOGUTILITY_H */