GpfsmonSensorBase.h 1.82 KB
Newer Older
lu43jih's avatar
lu43jih committed
1
/*
lu43jih's avatar
lu43jih committed
2
 * GpfsmonSensorBase.h
lu43jih's avatar
lu43jih committed
3 4
 *
 *  Created on: 26.11.2018
lu43jih's avatar
lu43jih committed
5
 *      Author: Carla Guillen
lu43jih's avatar
lu43jih committed
6 7 8 9 10
 */

#ifndef GPFSMON_GPFSMONSENSORBASE_H_
#define GPFSMON_GPFSMONSENSORBASE_H_

11
#include "sensorbase.h"
lu43jih's avatar
lu43jih committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

#include <regex>


	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
	};

class GpfsmonSensorBase : public SensorBase {
public:
lu43jih's avatar
lu43jih committed
31 32
	GpfsmonSensorBase(const std::string& name) :
		SensorBase(name), _metric_type(GPFS_METRIC::SIZE) {
lu43jih's avatar
lu43jih committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46
		setDelta(true);
	}

	virtual ~GpfsmonSensorBase() {
	}

	GPFS_METRIC getMetricType() const {
		return _metric_type;
	}

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

47 48 49
	GpfsmonSensorBase(const GpfsmonSensorBase& )=default;
	GpfsmonSensorBase& operator=(const GpfsmonSensorBase &)=default;

50 51
	void printConfig(LOG_LEVEL ll, LOGGER& lg, unsigned leadingSpaces=16) {
	  std::string leading(leadingSpaces, ' ');
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
	  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;
	  }
85
      LOG_VAR(ll) << leading << "    Metric type:  " <<  metric;
86
    }
87

lu43jih's avatar
lu43jih committed
88 89 90 91 92
protected:
	GPFS_METRIC _metric_type;
};

#endif /* GPFSMON_GPFSMONSENSORBASE_H_ */