GpfsmonSensorBase.h 3.19 KB
Newer Older
1
2
3
//================================================================================
// Name        : GpfsmonSensorBase.h
// Author      : Carla Guillen
Micha Müller's avatar
Micha Müller committed
4
// Contact     : info@dcdb.it
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright   : Leibniz Supercomputing Centre
// Description : Sensor base class for Gpfsmon plugin.
//================================================================================

//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2018-2019 Leibniz Supercomputing Centre
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//================================================================================
lu43jih's avatar
lu43jih committed
27

28
29
30
31
32
33
34
/**
 * @defgroup gpfsmon Gpfsmon plugin
 * @ingroup  pusherplugins
 *
 * @brief
 */

lu43jih's avatar
lu43jih committed
35
36
37
#ifndef GPFSMON_GPFSMONSENSORBASE_H_
#define GPFSMON_GPFSMONSENSORBASE_H_

38
#include "sensorbase.h"
lu43jih's avatar
lu43jih committed
39
40
41

#include <regex>

42
43
44
45
46
47
48
49
50
51
52
53
enum GPFS_METRIC {
	TIMESTAMP_GPFS = 0,
	IOBYTESREAD = 1,
	IOBYTESWRITE = 2,
	IOOPENS = 3,
	IOCLOSES = 4,
	IOREADS = 5,
	IOWRITES = 6,
	READDIR = 7,
	INODE_UPDATES = 8,
	SIZE = INODE_UPDATES + 1
};
lu43jih's avatar
lu43jih committed
54

55
56
57
58
59
/**
 * @brief SensorBase specialization for this plugin.
 *
 * @ingroup gpfsmon
 */
lu43jih's avatar
lu43jih committed
60
class GpfsmonSensorBase : public SensorBase {
61
62
63
      public:
	GpfsmonSensorBase(const std::string &name)
	    : SensorBase(name), _metric_type(GPFS_METRIC::SIZE) {
lu43jih's avatar
lu43jih committed
64
		setDelta(true);
65
		setDeltaMaxValue(ULLONG_MAX);
lu43jih's avatar
lu43jih committed
66
67
68
69
70
71
72
73
74
75
76
77
78
	}

	virtual ~GpfsmonSensorBase() {
	}

	GPFS_METRIC getMetricType() const {
		return _metric_type;
	}

	void setMetricType(GPFS_METRIC metricType) {
		_metric_type = metricType;
	}

79
80
	GpfsmonSensorBase(const GpfsmonSensorBase &) = default;
	GpfsmonSensorBase &operator=(const GpfsmonSensorBase &) = default;
81

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	void printConfig(LOG_LEVEL ll, LOGGER &lg, unsigned leadingSpaces = 16) {
		std::string leading(leadingSpaces, ' ');
		std::string metric("unknown");
		switch (_metric_type) {
			case TIMESTAMP_GPFS:
				metric = "TIMESTAMP_GPFS";
				break;
			case IOBYTESREAD:
				metric = "IOBYTESREAD";
				break;
			case IOBYTESWRITE:
				metric = "IOBYTESWRITE";
				break;
			case IOOPENS:
				metric = "IOOPENS";
				break;
			case IOCLOSES:
				metric = "IOCLOSES";
				break;
			case IOREADS:
				metric = "IOREADS";
				break;
			case IOWRITES:
				metric = "IOWRITES";
				break;
			case READDIR:
				metric = "READDIR";
				break;
			case INODE_UPDATES:
				metric = "INODE_UPDATES";
				break;
			case SIZE:
				metric = "SIZE";
				break;
		}
		LOG_VAR(ll) << leading << "    Metric type:  " << metric;
	}
119

120
      protected:
lu43jih's avatar
lu43jih committed
121
122
123
124
	GPFS_METRIC _metric_type;
};

#endif /* GPFSMON_GPFSMONSENSORBASE_H_ */