Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
The container registry cleanup task is now completed and the registry can be used normally.
Open sidebar
dcdb
dcdb
Commits
12cbba8c
Commit
12cbba8c
authored
Nov 28, 2018
by
lu43jih
Browse files
Working on Gpfsmon plugin
parent
06d035bb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
12cbba8c
...
@@ -97,10 +97,8 @@ libdcdbplugin_snmp.$(LIBEXT): src/sensors/snmp/SNMPSensorGroup.o src/sensors/snm
...
@@ -97,10 +97,8 @@ libdcdbplugin_snmp.$(LIBEXT): src/sensors/snmp/SNMPSensorGroup.o src/sensors/snm
libdcdbplugin_procfs.$(LIBEXT)
:
src/sensors/procfs/ProcfsSensorGroup.o src/sensors/procfs/ProcfsParser.o src/sensors/procfs/ProcfsConfigurator.o
libdcdbplugin_procfs.$(LIBEXT)
:
src/sensors/procfs/ProcfsSensorGroup.o src/sensors/procfs/ProcfsParser.o src/sensors/procfs/ProcfsConfigurator.o
$(CXX)
$(LIBFLAGS)$@
-o
$@
$^
-L
$(DCDBDEPLOYPATH)
/lib/
-lboost_log
-lboost_system
-lboost_regex
$(CXX)
$(LIBFLAGS)$@
-o
$@
$^
-L
$(DCDBDEPLOYPATH)
/lib/
-lboost_log
-lboost_system
-lboost_regex
libdcdbplugin_gpfsmon.$(LIBEXT)
:
src/sensors/gpfsmon/GpfsmonSensorGroup.o
libdcdbplugin_gpfsmon.$(LIBEXT)
:
src/sensors/gpfsmon/GpfsmonSensorGroup.o
src/sensors/gpfsmon/GpfsmonConfigurator.o
$(CXX)
$(LIBFLAGS)$@
-o
$@
$^
-L
$(DCDBDEPLOYPATH)
/lib/
-lboost_log
-lboost_system
$(CXX)
$(LIBFLAGS)$@
-o
$@
$^
-L
$(DCDBDEPLOYPATH)
/lib/
-lboost_log
-lboost_system
#src/sensors/gpfsmon/gpfsmonConfigurator.o
#libdcdbplugin_opa.$(LIBEXT): src/sensors/opa/OpaSensorGroup.o src/sensors/opa/OpaConfigurator.o
#libdcdbplugin_opa.$(LIBEXT): src/sensors/opa/OpaSensorGroup.o src/sensors/opa/OpaConfigurator.o
# $(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lopamgt -libverbs -libumad -lssl
# $(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lopamgt -libverbs -libumad -lssl
src/sensors/gpfsmon/GpfsmonConfigurator.cpp
0 → 100644
View file @
12cbba8c
/*
* gpfsmonConfigurator.cpp
*
* Created on: 26.11.2018
* Author: Your name goes here!
*/
#include
"GpfsmonConfigurator.h"
GpfsmonConfigurator
::
GpfsmonConfigurator
()
{
_metricMap
[
"TIMESTAMP_GPFS"
]
=
TIMESTAMP_GPFS
;
_metricMap
[
"IOBYTESREAD"
]
=
IOBYTESREAD
;
_metricMap
[
"IOBYTESWRITE"
]
=
IOBYTESWRITE
;
_metricMap
[
"IOOPENS"
]
=
IOOPENS
;
_metricMap
[
"IOCLOSES"
]
=
IOCLOSES
;
_metricMap
[
"IOREADS"
]
=
IOREADS
;
_metricMap
[
"IOWRITES"
]
=
IOWRITES
;
_metricMap
[
"READDIR"
]
=
READDIR
;
_metricMap
[
"INODE_UPDATES"
]
=
INODE_UPDATES
;
_groupName
=
"group"
;
_baseName
=
"sensor"
;
}
GpfsmonConfigurator
::~
GpfsmonConfigurator
()
{}
void
GpfsmonConfigurator
::
sensorBase
(
GpfsmonSensorBase
&
s
,
CFG_VAL
config
)
{
ADD
{
if
(
boost
::
iequals
(
val
.
first
,
"metric"
))
{
auto
it
=
_metricMap
.
find
(
val
.
second
.
data
());
if
(
it
!=
_metricMap
.
end
())
{
if
(
it
->
second
==
TIMESTAMP_GPFS
){
LOG
(
warning
)
<<
" metric
\"
"
<<
val
.
second
.
data
()
<<
"
\"
not supported."
;
}
else
{
s
.
setMetricType
(
it
->
second
);
}
}
else
{
LOG
(
warning
)
<<
" metric
\"
"
<<
val
.
second
.
data
()
<<
"
\"
not known."
;
}
}
else
if
(
boost
::
iequals
(
val
.
first
,
"nodeName"
)){
s
.
setNodeName
(
val
.
second
.
data
());
}
}
}
void
GpfsmonConfigurator
::
sensorGroup
(
GpfsmonSensorGroup
&
s
,
CFG_VAL
config
)
{
ADD
{
//ToDo do I need something here?
}
}
src/sensors/gpfsmon/
g
pfsmonConfigurator.h
→
src/sensors/gpfsmon/
G
pfsmonConfigurator.h
View file @
12cbba8c
...
@@ -11,20 +11,23 @@
...
@@ -11,20 +11,23 @@
#include
"../../includes/ConfiguratorTemplate.h"
#include
"../../includes/ConfiguratorTemplate.h"
#include
"GpfsmonSensorGroup.h"
#include
"GpfsmonSensorGroup.h"
class
g
pfsmonConfigurator
:
public
ConfiguratorTemplate
<
GpfsmonSensorBase
,
GpfsmonSensorGroup
>
{
class
G
pfsmonConfigurator
:
public
ConfiguratorTemplate
<
GpfsmonSensorBase
,
GpfsmonSensorGroup
>
{
public:
public:
g
pfsmonConfigurator
();
G
pfsmonConfigurator
();
virtual
~
g
pfsmonConfigurator
();
virtual
~
G
pfsmonConfigurator
();
protected:
protected:
/* Overwritten from ConfiguratorTemplate */
/* Overwritten from ConfiguratorTemplate */
void
sensorBase
(
GpfsmonSensorBase
&
s
,
CFG_VAL
config
)
override
;
void
sensorBase
(
GpfsmonSensorBase
&
s
,
CFG_VAL
config
)
override
;
void
sensorGroup
(
GpfsmonSensorGroup
&
s
,
CFG_VAL
config
)
override
;
void
sensorGroup
(
GpfsmonSensorGroup
&
s
,
CFG_VAL
config
)
override
;
private:
std
::
map
<
std
::
string
,
GPFS_METRIC
>
_metricMap
;
};
};
extern
"C"
ConfiguratorInterface
*
create
()
{
extern
"C"
ConfiguratorInterface
*
create
()
{
return
new
g
pfsmonConfigurator
;
return
new
G
pfsmonConfigurator
;
}
}
extern
"C"
void
destroy
(
ConfiguratorInterface
*
c
)
{
extern
"C"
void
destroy
(
ConfiguratorInterface
*
c
)
{
...
...
src/sensors/gpfsmon/GpfsmonSensorBase.h
View file @
12cbba8c
...
@@ -28,8 +28,8 @@
...
@@ -28,8 +28,8 @@
class
GpfsmonSensorBase
:
public
SensorBase
{
class
GpfsmonSensorBase
:
public
SensorBase
{
public:
public:
GpfsmonSensorBase
(
const
std
::
string
&
name
,
GPFS_METRIC
metric_type
,
const
std
::
string
&
node_
name
)
:
GpfsmonSensorBase
(
const
std
::
string
&
name
)
:
SensorBase
(
name
),
_metric_type
(
metric_type
),
_node_name
(
node_name
)
{
SensorBase
(
name
),
_metric_type
(
GPFS_METRIC
::
SIZE
)
{
setDelta
(
true
);
setDelta
(
true
);
}
}
...
...
src/sensors/gpfsmon/GpfsmonSensorGroup.cpp
View file @
12cbba8c
...
@@ -26,14 +26,11 @@ bool SensorCompare::operator()(const Gpfs_SB& lhs, const Gpfs_SB & rhs) const {
...
@@ -26,14 +26,11 @@ bool SensorCompare::operator()(const Gpfs_SB& lhs, const Gpfs_SB & rhs) const {
GpfsmonSensorGroup
::
GpfsmonSensorGroup
(
const
std
::
string
&
name
)
:
GpfsmonSensorGroup
::
GpfsmonSensorGroup
(
const
std
::
string
&
name
)
:
SensorGroupTemplate
(
name
)
{
SensorGroupTemplate
(
name
)
{
createTempFile
();
createTempFile
();
searchDummy
=
std
::
make_shared
<
GpfsmonSensorBase
>
(
"
"
,
GPFS_METRIC
::
SIZE
,
""
);
searchDummy
=
std
::
make_shared
<
GpfsmonSensorBase
>
(
"
Dummy"
);
}
}
GpfsmonSensorGroup
::~
GpfsmonSensorGroup
()
{
GpfsmonSensorGroup
::~
GpfsmonSensorGroup
()
{
/*
data
.
clear
();
* TODO
* Tear down attributes
*/
}
}
void
GpfsmonSensorGroup
::
start
()
{
void
GpfsmonSensorGroup
::
start
()
{
...
@@ -75,61 +72,51 @@ void GpfsmonSensorGroup::read() {
...
@@ -75,61 +72,51 @@ void GpfsmonSensorGroup::read() {
//ToDo parse nodename here
//ToDo parse nodename here
std
::
string
nodename
=
"blabla"
;
std
::
string
nodename
=
"blabla"
;
searchDummy
->
setNodeName
(
nodename
);
std
::
string
::
size_type
bytereads_pos
=
toparse
.
find
(
"_br_ "
);
std
::
string
::
size_type
bytereads_pos
=
toparse
.
find
(
"_br_ "
);
std
::
string
::
size_type
bytewrite_pos
=
toparse
.
find
(
" _bw_ "
);
std
::
string
::
size_type
bytewrite_pos
=
toparse
.
find
(
" _bw_ "
);
if
(
bytereads_pos
!=
std
::
string
::
npos
&&
bytewrite_pos
!=
std
::
string
::
npos
){
if
(
bytereads_pos
!=
std
::
string
::
npos
&&
bytewrite_pos
!=
std
::
string
::
npos
){
//cout << "token_substr = " << toparse.substr(bytereads_pos + 5, bytewrite_pos - bytereads_pos) << endl;
data
[
IOBYTESREAD
]
=
std
::
stoull
(
toparse
.
substr
(
bytereads_pos
+
5
,
bytewrite_pos
-
bytereads_pos
));
data
[
IOBYTESREAD
]
=
std
::
stoull
(
toparse
.
substr
(
bytereads_pos
+
5
,
bytewrite_pos
-
bytereads_pos
));
//cout << "iobytesread = " << iobytesread << endl;
}
else
{
}
else
{
//ToDo log error?
break
;
break
;
}
}
std
::
string
::
size_type
opens_pos
=
toparse
.
find
(
" _oc_ "
);
std
::
string
::
size_type
opens_pos
=
toparse
.
find
(
" _oc_ "
);
if
(
opens_pos
!=
std
::
string
::
npos
){
if
(
opens_pos
!=
std
::
string
::
npos
){
//cout << "token_substr = " << toparse.substr(bytewrite_pos + 6, opens_pos - bytewrite_pos) << endl;
data
[
IOBYTESWRITE
]
=
std
::
stoull
(
toparse
.
substr
(
bytewrite_pos
+
6
,
opens_pos
-
bytewrite_pos
));
data
[
IOBYTESWRITE
]
=
std
::
stoull
(
toparse
.
substr
(
bytewrite_pos
+
6
,
opens_pos
-
bytewrite_pos
));
//cout << "iobyteswrite = " << iobyteswrite << endl;
}
else
{
}
else
{
break
;
break
;
}
}
std
::
string
::
size_type
closes_pos
=
toparse
.
find
(
" _cc_ "
);
std
::
string
::
size_type
closes_pos
=
toparse
.
find
(
" _cc_ "
);
if
(
closes_pos
!=
std
::
string
::
npos
){
if
(
closes_pos
!=
std
::
string
::
npos
){
//cout << "token_substr = " << toparse.substr(opens_pos + 6, closes_pos - opens_pos) << endl;
data
[
IOOPENS
]
=
std
::
stoull
(
toparse
.
substr
(
opens_pos
+
6
,
closes_pos
-
opens_pos
));
data
[
IOOPENS
]
=
std
::
stoull
(
toparse
.
substr
(
opens_pos
+
6
,
closes_pos
-
opens_pos
));
//cout << "ioopens = " << ioopens << endl;
}
else
{
}
else
{
break
;
break
;
}
}
std
::
string
::
size_type
reads_pos
=
toparse
.
find
(
" _rdc_ "
);
std
::
string
::
size_type
reads_pos
=
toparse
.
find
(
" _rdc_ "
);
if
(
reads_pos
!=
std
::
string
::
npos
){
if
(
reads_pos
!=
std
::
string
::
npos
){
//cout << "token_substr = " << toparse.substr(closes_pos + 6, reads_pos - closes_pos) << endl;
data
[
IOCLOSES
]
=
std
::
stoull
(
toparse
.
substr
(
closes_pos
+
6
,
reads_pos
-
closes_pos
));
data
[
IOCLOSES
]
=
std
::
stoull
(
toparse
.
substr
(
closes_pos
+
6
,
reads_pos
-
closes_pos
));
//cout << "iocloses = " << iocloses << endl;
}
else
{
}
else
{
break
;
break
;
}
}
std
::
string
::
size_type
writes_pos
=
toparse
.
find
(
" _wc_ "
);
std
::
string
::
size_type
writes_pos
=
toparse
.
find
(
" _wc_ "
);
if
(
writes_pos
!=
std
::
string
::
npos
){
if
(
writes_pos
!=
std
::
string
::
npos
){
//cout << "token_substr = " << toparse.substr(reads_pos + 7, writes_pos - reads_pos) << endl;
data
[
IOREADS
]
=
std
::
stoull
(
toparse
.
substr
(
reads_pos
+
7
,
writes_pos
-
reads_pos
));
data
[
IOREADS
]
=
std
::
stoull
(
toparse
.
substr
(
reads_pos
+
7
,
writes_pos
-
reads_pos
));
//cout << "ioreads = " << ioreads << endl;
}
else
{
}
else
{
break
;
break
;
}
}
std
::
string
::
size_type
dir_pos
=
toparse
.
find
(
" _dir_"
);
std
::
string
::
size_type
dir_pos
=
toparse
.
find
(
" _dir_"
);
if
(
dir_pos
!=
std
::
string
::
npos
){
if
(
dir_pos
!=
std
::
string
::
npos
){
//cout << "token_substr = " << toparse.substr(writes_pos + 6, dir_pos - writes_pos) << endl;
data
[
IOWRITES
]
=
std
::
stoull
(
toparse
.
substr
(
writes_pos
+
6
,
dir_pos
-
writes_pos
));
data
[
IOWRITES
]
=
std
::
stoull
(
toparse
.
substr
(
writes_pos
+
6
,
dir_pos
-
writes_pos
));
//cout << "iowrites = " << iowrites << endl;
}
else
{
}
else
{
break
;
break
;
}
}
for
(
unsigned
int
i
=
0
;
i
<
static_cast
<
unsigned
int
>
(
GPFS_METRIC
::
SIZE
);
++
i
){
for
(
unsigned
int
i
=
1
;
i
<
static_cast
<
unsigned
int
>
(
GPFS_METRIC
::
SIZE
);
++
i
){
reading
.
value
=
data
[
i
];
reading
.
value
=
data
[
i
];
searchDummy
->
setNodeName
(
nodename
);
searchDummy
->
setMetricType
(
static_cast
<
GPFS_METRIC
>
(
i
));
searchDummy
->
setMetricType
(
static_cast
<
GPFS_METRIC
>
(
i
));
auto
found
=
std
::
lower_bound
(
_sensors
.
begin
(),
_sensors
.
end
(),
searchDummy
,
SensorCompare
());
auto
found
=
std
::
lower_bound
(
_sensors
.
begin
(),
_sensors
.
end
(),
searchDummy
,
SensorCompare
());
if
(
found
!=
_sensors
.
end
()){
if
(
found
!=
_sensors
.
end
()){
...
@@ -169,3 +156,10 @@ void GpfsmonSensorGroup::createTempFile(){
...
@@ -169,3 +156,10 @@ void GpfsmonSensorGroup::createTempFile(){
LOG
(
error
)
<<
"Gpfsmon: unable to create temporary file for mmpmon"
;
LOG
(
error
)
<<
"Gpfsmon: unable to create temporary file for mmpmon"
;
}
}
}
}
GpfsmonSensorGroup
&
GpfsmonSensorGroup
::
operator
=
(
const
GpfsmonSensorGroup
&
other
){
SensorGroupTemplate
<
GpfsmonSensorBase
>::
operator
=
(
other
);
data
=
other
.
data
;
//copy of vectors
searchDummy
=
std
::
make_shared
<
GpfsmonSensorBase
>
(
"Dummy"
);
//new pointer instead of shared...
return
*
this
;
}
src/sensors/gpfsmon/GpfsmonSensorGroup.h
View file @
12cbba8c
...
@@ -23,17 +23,19 @@ public:
...
@@ -23,17 +23,19 @@ public:
void
start
()
override
;
void
start
()
override
;
void
stop
()
override
;
void
stop
()
override
;
const
static
int
BUFFER_SIZE
=
255
;
//!< constant buffer that is parse by a line given from the popen command
GpfsmonSensorGroup
&
operator
=
(
const
GpfsmonSensorGroup
&
other
);
private:
private:
void
read
()
override
;
void
read
()
override
;
void
readAsync
()
override
;
void
readAsync
()
override
;
void
createTempFile
();
void
createTempFile
();
const
std
::
string
&
cmd_io
=
"/usr/lpp/mmfs/bin/mmpmon -p -i /tmp/gpfsmon"
;
const
std
::
string
cmd_io
=
"/usr/lpp/mmfs/bin/mmpmon -p -i /tmp/gpfsmon"
;
//todo change to real command
Gpfs_SB
searchDummy
;
Gpfs_SB
searchDummy
;
std
::
vector
<
uint64_t
>
data
;
//todo change file
std
::
vector
<
uint64_t
>
data
;
constexpr
static
int
BUFFER_SIZE
=
255
;
//!< constant buffer that is parse by a line given from the popen command
};
};
...
...
src/sensors/gpfsmon/gpfsmonConfigurator.cpp
deleted
100644 → 0
View file @
06d035bb
/*
* gpfsmonConfigurator.cpp
*
* Created on: 26.11.2018
* Author: Your name goes here!
*/
#include
"gpfsmonConfigurator.h"
gpfsmonConfigurator
::
gpfsmonConfigurator
()
{
/*
* TODO
* If you want sensor, group or entity to be named differently in the config file, you can change it here
*/
_groupName
=
"group"
;
_baseName
=
"sensor"
;
}
gpfsmonConfigurator
::~
gpfsmonConfigurator
()
{}
void
gpfsmonConfigurator
::
sensorBase
(
GpfsmonSensorBase
&
s
,
CFG_VAL
config
)
{
ADD
{
/*
* TODO
* Add ATTRIBUTE macros for sensorBase attributes
*/
//ATTRIBUTE("attributeName", attributeSetter);
}
}
void
gpfsmonConfigurator
::
sensorGroup
(
GpfsmonSensorGroup
&
s
,
CFG_VAL
config
)
{
ADD
{
/*
* TODO
* Add ATTRIBUTE macros for sensorGroup attributes
*/
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment