Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 7b6c853a authored by Michael Ott's avatar Michael Ott
Browse files

Beautify usage output, streamline parameters with other DCDB tools, and use...

Beautify usage output, streamline parameters with other DCDB tools, and use more meaningful parameter characters
parent 53421384
......@@ -50,6 +50,14 @@
using namespace std;
#define LISTENHOST "localhost"
#define LISTENPORT "1883"
#define CASSANDRAHOST "127.0.0.1"
#define CASSANDRAPORT "9042"
#define RESTAPIHOST "0.0.0.0"
#define RESTAPIPORT "8080"
#define TTL "0"
int keepRunning;
bool statistics;
uint64_t msgCtr;
......@@ -192,15 +200,25 @@ int mqttCallback(SimpleMQTTMessage *msg)
* Print usage information
*/
void usage() {
printf("Usage: collectagent [-D] [-s] [-l <host>] [-h <host>] [-t <ttl>]\n");
printf("Collectagent will accept remote connections by listening to the\n");
printf("specified listen address (-l <host>) at port 1883 (default MQTT port).\n");
printf("It will also connect to cassandra to the specifiec addres (-h <host>).\n");
printf("The default <host> is localhost/127.0.0.1.\n");
printf("If the -t option is specified, data will be inserted with the specified\n");
printf("TTL in seconds.\n");
printf("If the -D option is specified, CollectAgent will run as daemon.\n");
printf("With the -s option, CollectAgent will print message statistics.\n\n");
/*
1 2 3 4 5 6 7 8
012345678901234567890123456789012345678901234567890123456789012345678901234567890
*/
cout << "Usage:" << endl;
cout << " collectagent [-m<host>] [-r<host>] [-c<host>] [-t<ttl>] [-d] [-s]" << endl;
cout << " collectagent -h" << endl;
cout << endl;
cout << "Options:" << endl;
cout << " -m<host> MQTT listen address [default: " << LISTENHOST << ":" << LISTENPORT << "]" << endl;
cout << " -r<host> REST API listen address [default: " << RESTAPIHOST << ":" << RESTAPIPORT << "]" << endl;
cout << " -c<host> Cassandra host [default: " << CASSANDRAHOST << ":" << CASSANDRAPORT << "]" << endl;
cout << " -t<ttl> Cassandra insert TTL [default: " << TTL << "]" << endl;
cout << endl;
cout << " -d Daemonize" << endl;
cout << " -s Print message statistics" << endl;
cout << " -h This help page" << endl;
cout << endl;
}
int main(int argc, char* const argv[]) {
......@@ -222,32 +240,34 @@ int main(int argc, char* const argv[]) {
int ret;
std::string listenHost, cassandraHost, restApiHost, ttl;
std::string listenPort, cassandraPort, restApiPort;
listenHost="localhost";
cassandraHost="127.0.0.1";
restApiHost="0.0.0.0";
ttl="0";
listenHost = LISTENHOST;
cassandraHost = CASSANDRAHOST;
restApiHost = RESTAPIHOST;
ttl = "0";
statistics = false;
while ((ret=getopt(argc, argv, "h:l:r:t:Ds?"))!=-1) {
while ((ret=getopt(argc, argv, "l:c:r:t:dDsh"))!=-1) {
switch(ret) {
case 'h':
cassandraHost = optarg;
break;
case 'l':
listenHost = optarg;
break;
case 'c':
cassandraHost = optarg;
break;
case 'r':
restApiHost = optarg;
break;
case 't':
ttl = optarg;
break;
case 'd':
case 'D':
dcdbdaemon();
break;
case 's':
statistics = true;
break;
case '?':
case 'h':
default:
usage();
exit(EXIT_FAILURE);
......@@ -262,21 +282,21 @@ int main(int argc, char* const argv[]) {
listenPort = listenHost.substr(pos+1);
listenHost.erase(pos);
} else {
listenPort = "1883";
listenPort = LISTENPORT;
}
pos = cassandraHost.find(":");
if (pos != string::npos) {
cassandraPort = cassandraHost.substr(pos+1);
cassandraHost.erase(pos);
} else {
cassandraPort = "9042";
cassandraPort = CASSANDRAPORT;
}
pos = restApiHost.find(":");
if (pos != string::npos) {
restApiPort = restApiHost.substr(pos+1);
restApiHost.erase(pos);
} else {
restApiPort = "8080";
restApiPort = RESTAPIPORT;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment