mirror of
https://github.com/netdata/netdata.git
synced 2025-04-14 17:48:37 +00:00

This PR merges the feature-branch to make the cloud live. It contains the following work: Co-authored-by: Andrew Moss <1043609+amoss@users.noreply.github.com(opens in new tab)> Co-authored-by: Jacek Kolasa <jacek.kolasa@gmail.com(opens in new tab)> Co-authored-by: Austin S. Hemmelgarn <austin@netdata.cloud(opens in new tab)> Co-authored-by: James Mills <prologic@shortcircuit.net.au(opens in new tab)> Co-authored-by: Markos Fountoulakis <44345837+mfundul@users.noreply.github.com(opens in new tab)> Co-authored-by: Timotej S <6674623+underhood@users.noreply.github.com(opens in new tab)> Co-authored-by: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com(opens in new tab)> * dashboard with new navbars, v1.0-alpha.9: PR #8478 * dashboard v1.0.11: netdata/dashboard#76 Co-authored-by: Jacek Kolasa <jacek.kolasa@gmail.com(opens in new tab)> * Added installer code to bundle JSON-c if it's not present. PR #8836 Co-authored-by: James Mills <prologic@shortcircuit.net.au(opens in new tab)> * Fix claiming config PR #8843 * Adds JSON-c as hard dep. for ACLK PR #8838 * Fix SSL renegotiation errors in old versions of openssl. PR #8840. Also - we have a transient problem with opensuse CI so this PR disables them with a commit from @prologic. Co-authored-by: James Mills <prologic@shortcircuit.net.au(opens in new tab)> * Fix claiming error handling PR #8850 * Added CI to verify JSON-C bundling code in installer PR #8853 * Make cloud-enabled flag in web/api/v1/info be independent of ACLK build success PR #8866 * Reduce ACLK_STABLE_TIMEOUT from 10 to 3 seconds PR #8871 * remove old-cloud related UI from old dashboard (accessible now via /old suffix) PR #8858 * dashboard v1.0.13 PR #8870 * dashboard v1.0.14 PR #8904 * Provide feedback on proxy setting changes PR #8895 * Change the name of the connect message to update during an ongoing session PR #8927 * Fetch active alarms from alarm_log PR #8944
83 lines
3.2 KiB
C
83 lines
3.2 KiB
C
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
/*
|
|
* netdata registry
|
|
*
|
|
* this header file describes the public interface
|
|
* to the netdata registry
|
|
*
|
|
* only these high level functions are exposed
|
|
*
|
|
*/
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// TODO
|
|
//
|
|
// 1. the default tracking cookie expires in 1 year, but the persons are not
|
|
// removed from the db - this means the database only grows - ideally the
|
|
// database should be cleaned in registry_db_save() for both on-disk and
|
|
// on-memory entries.
|
|
//
|
|
// Cleanup:
|
|
// i. Find all the PERSONs that have expired cookie
|
|
// ii. For each of their PERSON_URLs:
|
|
// - decrement the linked MACHINE links
|
|
// - if the linked MACHINE has no other links, remove the linked MACHINE too
|
|
// - remove the PERSON_URL
|
|
//
|
|
// 2. add protection to prevent abusing the registry by flooding it with
|
|
// requests to fill the memory and crash it.
|
|
//
|
|
// Possible protections:
|
|
// - limit the number of URLs per person
|
|
// - limit the number of URLs per machine
|
|
// - limit the number of persons
|
|
// - limit the number of machines
|
|
// - [DONE] limit the size of URLs
|
|
// - [DONE] limit the size of PERSON_URL names
|
|
// - limit the number of requests that add data to the registry,
|
|
// per client IP per hour
|
|
//
|
|
// 3. lower memory requirements
|
|
//
|
|
// - embed avl structures directly into registry objects, instead of DICTIONARY
|
|
// [DONE for PERSON_URLs, PENDING for MACHINE_URLs]
|
|
// - store GUIDs in memory as UUID instead of char *
|
|
// - do not track persons using the demo machines only
|
|
// (i.e. start tracking them only when they access a non-demo machine)
|
|
// - [DONE] do not track custom dashboards by default
|
|
|
|
#ifndef NETDATA_REGISTRY_H
|
|
#define NETDATA_REGISTRY_H 1
|
|
|
|
#include "../daemon/common.h"
|
|
|
|
#define NETDATA_REGISTRY_COOKIE_NAME "netdata_registry_id"
|
|
|
|
// initialize the registry
|
|
// should only happen when netdata starts
|
|
extern int registry_init(void);
|
|
|
|
// free all data held by the registry
|
|
// should only happen when netdata exits
|
|
extern void registry_free(void);
|
|
|
|
// HTTP requests handled by the registry
|
|
extern int registry_request_access_json(RRDHOST *host, struct web_client *w, char *person_guid, char *machine_guid, char *url, char *name, time_t when);
|
|
extern int registry_request_delete_json(RRDHOST *host, struct web_client *w, char *person_guid, char *machine_guid, char *url, char *delete_url, time_t when);
|
|
extern int registry_request_search_json(RRDHOST *host, struct web_client *w, char *person_guid, char *machine_guid, char *url, char *request_machine, time_t when);
|
|
extern int registry_request_switch_json(RRDHOST *host, struct web_client *w, char *person_guid, char *machine_guid, char *url, char *new_person_guid, time_t when);
|
|
extern int registry_request_hello_json(RRDHOST *host, struct web_client *w);
|
|
|
|
// update the registry config
|
|
extern void registry_update_cloud_base_url();
|
|
|
|
// update the registry monitoring charts
|
|
extern void registry_statistics(void);
|
|
|
|
extern char *registry_get_this_machine_guid(void);
|
|
extern char *registry_get_mgmt_api_key(void);
|
|
extern char *registry_get_this_machine_hostname(void);
|
|
|
|
extern int regenerate_guid(const char *guid, char *result);
|
|
|
|
#endif /* NETDATA_REGISTRY_H */
|