Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
4db1e2f6
Commit
4db1e2f6
authored
Dec 12, 2018
by
Micha Mueller
Browse files
Reading values are now stored in signed int64_t for consistency with collectAgent and database
parent
9a937fe9
Changes
11
Show whitespace changes
Inline
Side-by-side
src/HttpsServer.cpp
View file @
4db1e2f6
...
...
@@ -322,7 +322,7 @@ HttpsServer::~HttpsServer() {
}
std
::
string
HttpsServer
::
calcAvg
(
SensorBase
&
s
,
uint64_t
time
)
{
u
int64_t
avg
=
0
;
int64_t
avg
=
0
;
const
reading_t
*
const
cache
=
s
.
getCache
();
unsigned
count
=
0
;
...
...
src/includes/SensorBase.h
View file @
4db1e2f6
...
...
@@ -14,7 +14,7 @@
#include
<boost/lockfree/spsc_queue.hpp>
typedef
struct
{
u
int64_t
value
;
int64_t
value
;
uint64_t
timestamp
;
}
reading_t
;
...
...
@@ -80,7 +80,7 @@ public:
void
setName
(
const
std
::
string
&
name
,
int
cpuID
=-
1
)
{
_name
=
formatName
(
name
,
cpuID
);
}
void
setMqtt
(
const
std
::
string
&
mqtt
)
{
_mqtt
=
mqtt
;
}
void
setCacheInterval
(
unsigned
cacheInterval
)
{
_cacheInterval
=
cacheInterval
;
}
void
setLastRawValue
(
u
int64_t
value
)
{
_lastRawValue
.
value
=
value
;
}
void
setLastRawValue
(
int64_t
value
)
{
_lastRawValue
.
value
=
value
;
}
const
std
::
size_t
getSizeOfReadingQueue
()
const
{
return
_readingQueue
->
read_available
();
}
std
::
size_t
popReadingQueue
(
reading_t
*
reads
,
std
::
size_t
max
)
const
{
return
_readingQueue
->
pop
(
reads
,
max
);
}
...
...
src/sensors/bacnet/BACnetClient.cpp
View file @
4db1e2f6
...
...
@@ -233,7 +233,7 @@ void BACnetClient::readPropertyAckHandler(uint8_t * service_request, uint16_t se
//bacapp_print_value(stdout, &object_value);
//TODO what kind of data is returned? which cases do we need to handle? fit they into
u
int64_t at all??
//TODO what kind of data is returned? which cases do we need to handle? fit they into int64_t at all??
switch
(
value
.
tag
)
{
case
BACNET_APPLICATION_TAG_NULL
:
LOG
(
trace
)
<<
"TAG_NULL"
;
...
...
src/sensors/gpfsmon/GpfsmonSensorGroup.cpp
View file @
4db1e2f6
...
...
@@ -106,37 +106,37 @@ bool GpfsmonSensorGroup::parseLine(std::string &&toparse){
std
::
string
::
size_type
bytewrite_pos
=
toparse
.
find
(
" _bw_ "
);
if
(
bytereads_pos
!=
std
::
string
::
npos
&&
bytewrite_pos
!=
std
::
string
::
npos
){
_data
[
IOBYTESREAD
]
=
std
::
sto
u
ll
(
toparse
.
substr
(
bytereads_pos
+
5
,
bytewrite_pos
-
bytereads_pos
));
_data
[
IOBYTESREAD
]
=
std
::
stoll
(
toparse
.
substr
(
bytereads_pos
+
5
,
bytewrite_pos
-
bytereads_pos
));
}
else
{
return
false
;
}
std
::
string
::
size_type
opens_pos
=
toparse
.
find
(
" _oc_ "
);
if
(
opens_pos
!=
std
::
string
::
npos
){
_data
[
IOBYTESWRITE
]
=
std
::
sto
u
ll
(
toparse
.
substr
(
bytewrite_pos
+
6
,
opens_pos
-
bytewrite_pos
));
_data
[
IOBYTESWRITE
]
=
std
::
stoll
(
toparse
.
substr
(
bytewrite_pos
+
6
,
opens_pos
-
bytewrite_pos
));
}
else
{
return
false
;
}
std
::
string
::
size_type
closes_pos
=
toparse
.
find
(
" _cc_ "
);
if
(
closes_pos
!=
std
::
string
::
npos
){
_data
[
IOOPENS
]
=
std
::
sto
u
ll
(
toparse
.
substr
(
opens_pos
+
6
,
closes_pos
-
opens_pos
));
_data
[
IOOPENS
]
=
std
::
stoll
(
toparse
.
substr
(
opens_pos
+
6
,
closes_pos
-
opens_pos
));
}
else
{
return
false
;
}
std
::
string
::
size_type
reads_pos
=
toparse
.
find
(
" _rdc_ "
);
if
(
reads_pos
!=
std
::
string
::
npos
){
_data
[
IOCLOSES
]
=
std
::
sto
u
ll
(
toparse
.
substr
(
closes_pos
+
6
,
reads_pos
-
closes_pos
));
_data
[
IOCLOSES
]
=
std
::
stoll
(
toparse
.
substr
(
closes_pos
+
6
,
reads_pos
-
closes_pos
));
}
else
{
return
false
;
}
std
::
string
::
size_type
writes_pos
=
toparse
.
find
(
" _wc_ "
);
if
(
writes_pos
!=
std
::
string
::
npos
){
_data
[
IOREADS
]
=
std
::
sto
u
ll
(
toparse
.
substr
(
reads_pos
+
7
,
writes_pos
-
reads_pos
));
_data
[
IOREADS
]
=
std
::
stoll
(
toparse
.
substr
(
reads_pos
+
7
,
writes_pos
-
reads_pos
));
}
else
{
return
false
;
}
std
::
string
::
size_type
dir_pos
=
toparse
.
find
(
" _dir_"
);
if
(
dir_pos
!=
std
::
string
::
npos
){
_data
[
IOWRITES
]
=
std
::
sto
u
ll
(
toparse
.
substr
(
writes_pos
+
6
,
dir_pos
-
writes_pos
));
_data
[
IOWRITES
]
=
std
::
stoll
(
toparse
.
substr
(
writes_pos
+
6
,
dir_pos
-
writes_pos
));
}
else
{
return
false
;
}
...
...
src/sensors/gpfsmon/GpfsmonSensorGroup.h
View file @
4db1e2f6
...
...
@@ -35,7 +35,7 @@ private:
const
std
::
string
_cmd_io
=
"/usr/lpp/mmfs/bin/mmpmon -p -i /tmp/gpfsmon"
;
//todo change to real command
std
::
vector
<
u
int64_t
>
_data
;
//!< temp variable in parseLine defined here for efficiency.
std
::
vector
<
int64_t
>
_data
;
//!< temp variable in parseLine defined here for efficiency.
constexpr
static
int
BUFFER_SIZE
=
255
;
//!< constant buffer that is used to parse line by line (from popen)
};
...
...
src/sensors/ipmi/IPMIHost.cpp
View file @
4db1e2f6
...
...
@@ -143,7 +143,7 @@ bool IPMIHost::getSdrRecord(uint16_t recordId, std::vector<uint8_t>& record) {
return
success
;
}
u
int64_t
IPMIHost
::
sendRawCmd
(
const
std
::
vector
<
uint8_t
>&
rawCmd
,
int64_t
IPMIHost
::
sendRawCmd
(
const
std
::
vector
<
uint8_t
>&
rawCmd
,
uint16_t
start
,
uint16_t
stop
)
{
uint8_t
buf
[
256
];
int
len
=
-
1
;
...
...
@@ -193,9 +193,9 @@ uint64_t IPMIHost::sendRawCmd(const std::vector<uint8_t>& rawCmd,
_errorCount
=
0
;
u
int64_t
val
=
0
;
int64_t
val
=
0
;
for
(
i
=
start
;
i
<=
stop
;
i
++
)
{
val
|=
((
u
int64_t
)
buf
[
i
])
<<
(
stop
-
i
)
*
8
;
val
|=
((
int64_t
)
buf
[
i
])
<<
(
stop
-
i
)
*
8
;
}
return
val
;
...
...
src/sensors/ipmi/IPMIHost.h
View file @
4db1e2f6
...
...
@@ -22,7 +22,7 @@ public:
/* Translate recordId to SDR record */
bool
getSdrRecord
(
uint16_t
recordId
,
std
::
vector
<
uint8_t
>&
record
);
/* Send raw command to BMC. Returns sensor reading as responded by BMC. */
u
int64_t
sendRawCmd
(
const
std
::
vector
<
uint8_t
>&
rawCmd
,
uint16_t
start
,
uint16_t
stop
);
int64_t
sendRawCmd
(
const
std
::
vector
<
uint8_t
>&
rawCmd
,
uint16_t
start
,
uint16_t
stop
);
/* Read the sensor specified by its record id. Returns sensor reading. */
double
readSensorRecord
(
std
::
vector
<
uint8_t
>&
record
);
...
...
src/sensors/pdu/PDUSensorGroup.cpp
View file @
4db1e2f6
...
...
@@ -115,7 +115,7 @@ void PDUSensorGroup::read() {
if
(
readStr
==
""
)
{
throw
std
::
runtime_error
(
"Value not found!"
);
}
reading
.
value
=
sto
u
l
(
readStr
);
reading
.
value
=
sto
l
l
(
readStr
);
#ifdef DEBUG
LOG
(
debug
)
<<
_groupName
<<
"::"
<<
s
->
getName
()
<<
":
\"
"
<<
reading
.
value
<<
"
\"
"
;
#endif
...
...
src/sensors/perfevent/PerfSensorBase.h
View file @
4db1e2f6
...
...
@@ -13,7 +13,7 @@
class
PerfSensorBase
:
virtual
public
SensorBase
{
public:
static
constexpr
u
int64_t
MAXCOUNTERVALUE
=
U
LLONG_MAX
;
//ToDo check if it is not
U
LLONG_MAX, or make it configurable!
static
constexpr
int64_t
MAXCOUNTERVALUE
=
LLONG_MAX
;
//ToDo check if it is not LLONG_MAX, or make it configurable!
PerfSensorBase
(
const
std
::
string
&
name
)
:
SensorBase
(
name
),
...
...
src/sensors/perfevent/PerfSensorGroup.cpp
View file @
4db1e2f6
...
...
@@ -192,7 +192,8 @@ void PerfSensorGroup::read() {
}
//iterate over all values returned by ::read()
for
(
unsigned
i
=
0
;
i
<
rf
->
nr
;
i
++
)
{
uint64_t
val
=
rf
->
values
[
i
].
value
;
//TODO Perfcounter use unsigned 64bit. What happens with values > 63bit ?
int64_t
val
=
rf
->
values
[
i
].
value
;
//iterate over all counters and find the one with matching id
for
(
unsigned
j
=
0
;
j
<
_sensors
.
size
();
j
++
)
{
if
(
rf
->
values
[
i
].
id
==
_ids
[
j
])
{
...
...
src/sensors/snmp/SNMPConnection.cpp
View file @
4db1e2f6
...
...
@@ -122,12 +122,12 @@ void SNMPConnection::init() {
_isInitialized
=
true
;
}
u
int64_t
SNMPConnection
::
issueGet
(
const
oid
*
const
OID
,
size_t
OIDLen
)
{
int64_t
SNMPConnection
::
issueGet
(
const
oid
*
const
OID
,
size_t
OIDLen
)
{
struct
snmp_session
*
ss
;
struct
snmp_pdu
*
pdu
,
*
response
;
struct
variable_list
*
vp
;
int
status
;
u
int64_t
ret
=
0
;
int64_t
ret
=
0
;
ss
=
snmp_open
(
&
_snmpSession
);
...
...
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