Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
dcdb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
dcdb
dcdb
Commits
31009e8c
Commit
31009e8c
authored
Aug 06, 2020
by
Michael Ott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove -d parameter for queries
parent
4d191371
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
20 deletions
+16
-20
tools/dcdbquery/dcdbquery.cpp
tools/dcdbquery/dcdbquery.cpp
+2
-7
tools/dcdbquery/query.cpp
tools/dcdbquery/query.cpp
+13
-12
tools/dcdbquery/query.h
tools/dcdbquery/query.h
+1
-1
No files found.
tools/dcdbquery/dcdbquery.cpp
View file @
31009e8c
...
...
@@ -54,7 +54,6 @@ void usage(void)
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
"Options:"
<<
std
::
endl
;
std
::
cout
<<
" -h<host> Cassandra host [default: "
<<
DEFAULT_CASSANDRAHOST
<<
":"
<<
DEFAULT_CASSANDRAPORT
<<
"]"
<<
endl
;
std
::
cout
<<
" -d Don't look up sensor name"
<<
std
::
endl
;
std
::
cout
<<
" -r Report timestamps in numerical format"
<<
std
::
endl
;
std
::
cout
<<
" -l Report times in local time (not UTC)"
<<
std
::
endl
;
}
...
...
@@ -111,18 +110,14 @@ int main(int argc, char * const argv[])
myQuery
=
new
DCDBQuery
();
/* Get the options */
bool
direct
=
false
;
int
ret
;
const
char
*
host
=
getenv
(
"DCDB_HOSTNAME"
);
if
(
!
host
)
{
host
=
"localhost"
;
}
while
((
ret
=
getopt
(
argcReal
,
argvReal
,
"+h:
d
rlf"
))
!=-
1
)
{
while
((
ret
=
getopt
(
argcReal
,
argvReal
,
"+h:rlf"
))
!=-
1
)
{
switch
(
ret
)
{
case
'd'
:
direct
=
true
;
break
;
case
'h'
:
host
=
optarg
;
break
;
...
...
@@ -162,7 +157,7 @@ int main(int argc, char * const argv[])
sensors
.
push_back
(
argvReal
[
arg
]);
}
myQuery
->
doQuery
(
host
,
sensors
,
start
,
end
,
direct
);
myQuery
->
doQuery
(
host
,
sensors
,
start
,
end
);
delete
myQuery
;
...
...
tools/dcdbquery/query.cpp
View file @
31009e8c
...
...
@@ -205,7 +205,7 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer
}
}
void
DCDBQuery
::
doQuery
(
const
char
*
hostname
,
std
::
list
<
std
::
string
>
sensors
,
DCDB
::
TimeStamp
start
,
DCDB
::
TimeStamp
end
,
bool
direct
)
void
DCDBQuery
::
doQuery
(
const
char
*
hostname
,
std
::
list
<
std
::
string
>
sensors
,
DCDB
::
TimeStamp
start
,
DCDB
::
TimeStamp
end
)
{
/* Create a new connection to the database */
connection
=
new
DCDB
::
Connection
();
...
...
@@ -267,17 +267,18 @@ void DCDBQuery::doQuery(const char* hostname, std::list<std::string> sensors, DC
queryCfg
.
unit
=
DCDB
::
UnitConv
::
fromString
(
modifierStr
);
}
}
if
(
!
direct
)
{
std
::
list
<
DCDB
::
PublicSensor
>
publicSensors
;
sensorConfig
.
getPublicSensorsByWildcard
(
publicSensors
,
sensorName
.
c_str
());
for
(
auto
sen
:
publicSensors
)
{
queries
.
insert
(
std
::
pair
<
DCDB
::
PublicSensor
,
queryConfig_t
>
(
sen
,
queryCfg
));
}
}
else
{
DCDB
::
PublicSensor
pS
;
pS
.
name
=
sensorName
;
pS
.
pattern
=
sensorName
;
queries
.
insert
(
std
::
pair
<
DCDB
::
PublicSensor
,
queryConfig_t
>
(
pS
,
queryCfg
));
std
::
list
<
DCDB
::
PublicSensor
>
publicSensors
;
sensorConfig
.
getPublicSensorsByWildcard
(
publicSensors
,
sensorName
.
c_str
());
if
(
publicSensors
.
size
()
>
0
)
{
for
(
auto
sen
:
publicSensors
)
{
queries
.
insert
(
std
::
pair
<
DCDB
::
PublicSensor
,
queryConfig_t
>
(
sen
,
queryCfg
));
}
}
else
{
DCDB
::
PublicSensor
pS
;
pS
.
name
=
sensorName
;
pS
.
pattern
=
sensorName
;
queries
.
insert
(
std
::
pair
<
DCDB
::
PublicSensor
,
queryConfig_t
>
(
pS
,
queryCfg
));
}
}
}
...
...
tools/dcdbquery/query.h
View file @
31009e8c
...
...
@@ -88,7 +88,7 @@ public:
void
check
(
std
::
list
<
std
::
string
>::
iterator
it
,
double
*
scalingFactor
);
void
checkModifier
(
std
::
list
<
std
::
string
>::
iterator
it
,
struct
outputFormat
*
format
);
void
doQuery
(
const
char
*
hostname
,
std
::
list
<
std
::
string
>
sensors
,
DCDB
::
TimeStamp
start
,
DCDB
::
TimeStamp
end
,
bool
direct
=
false
);
void
doQuery
(
const
char
*
hostname
,
std
::
list
<
std
::
string
>
sensors
,
DCDB
::
TimeStamp
start
,
DCDB
::
TimeStamp
end
);
DCDBQuery
();
virtual
~
DCDBQuery
()
{};
...
...
Write
Preview
Markdown
is supported
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