diff options
author | Markos Fountoulakis <44345837+mfundul@users.noreply.github.com> | 2019-12-19 11:01:59 +0200 |
---|---|---|
committer | Andrew Moss <1043609+amoss@users.noreply.github.com> | 2019-12-19 10:01:59 +0100 |
commit | ce9f70d7b3696a54f099628f3337f5c4d5bd1407 (patch) | |
tree | d8f0e7bbdd1a070c2dcf619e62c6e5ff4faaccfc /daemon/main.c | |
parent | c1436efd00c5b9afdb3779585eb194ea8388a932 (diff) |
Agent claiming (#7525)
Initial infrastructure support for agent claiming.
This feature is not currently enabled as we are still finalizing the details of the cloud infrastructure w.r.t. agent claiming. The feature will be enabled when we are ready
to release it.
Diffstat (limited to 'daemon/main.c')
-rw-r--r-- | daemon/main.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/daemon/main.c b/daemon/main.c index b00de00628..1dcdb6edd2 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -351,6 +351,8 @@ int help(int exitcode) { " set netdata.conf option from the command line.\n\n" " -W simple-pattern pattern string\n" " Check if string matches pattern and exit.\n\n" + " -W \"claim -token=TOKEN -rooms=ROOM1,ROOM2\"\n" + " Claim the agent to the workspace rooms pointed to by TOKEN and ROOM*.\n\n" ); fprintf(stream, "\n Signals netdata handles:\n\n" @@ -926,6 +928,7 @@ int main(int argc, char **argv) { { char* stacksize_string = "stacksize="; char* debug_flags_string = "debug_flags="; + char* claim_string = "claim"; #ifdef ENABLE_DBENGINE char* createdataset_string = "createdataset="; char* stresstest_string = "stresstest="; @@ -1086,6 +1089,10 @@ int main(int argc, char **argv) { printf("%s\n", value); return 0; } + else if(strncmp(optarg, claim_string, strlen(claim_string)) == 0) { + /* will trigger a claiming attempt when the agent is initialized */ + claiming_pending_arguments = optarg + strlen(claim_string); + } else { fprintf(stderr, "Unknown -W parameter '%s'\n", optarg); return help(1); @@ -1271,6 +1278,14 @@ int main(int argc, char **argv) { get_system_info(system_info); rrd_init(netdata_configured_hostname, system_info); + + // ------------------------------------------------------------------------ + // Claim netdata agent to a cloud endpoint + + if (claiming_pending_arguments) + claim_agent(claiming_pending_arguments); + load_claiming_state(); + // ------------------------------------------------------------------------ // enable log flood protection |