45 lines
913 B
C
45 lines
913 B
C
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include "ic.h"
|
|
|
|
int main(int argc, char *argv[], char *argp[]){
|
|
char buf[300];
|
|
char host[64];
|
|
char orgID[64];
|
|
char token[128];
|
|
int stats = 0;
|
|
|
|
if (argc < 3){
|
|
printf("Usage: ./main <host> <orgID> <token>");
|
|
return 0;
|
|
}
|
|
printf("%s %s %s\n", argv[1], argv[2], argv[3]);
|
|
memcpy(host, argv[1], 64);
|
|
memcpy(orgID, argv[2], 64);
|
|
memcpy(token, argv[3], 128);
|
|
printf("Host: %s\n", host);
|
|
printf("orgID: %s\n", orgID);
|
|
printf("Token: %s\n", token);
|
|
|
|
ic_influx_database(host, 8086, "tcp_metrics");
|
|
ic_influx_orgID(orgID);
|
|
ic_influx_token(token);
|
|
ic_debug(2);
|
|
|
|
while(1){
|
|
snprintf(buf, 300, "host=%s", host);
|
|
ic_tags(buf);
|
|
|
|
ic_measure("tcp_reset");
|
|
|
|
stats += 1;
|
|
|
|
ic_measureend();
|
|
ic_push();
|
|
sleep(30);
|
|
}
|
|
|
|
return 0;
|
|
}
|