Agent-Konfiguration erstellen
Erstellen Sie eine Agent-Konfiguration in Logging, um Metrikdaten in eine benutzerdefinierte Metrik aufzunehmen.
Aktualisierungen der Agent-Konfiguration werden erkannt und automatisch geladen.
Die neu erstellte Agent-Konfiguration wird auf der Seite Agent-Konfigurationen aufgeführt. Verwenden Sie den Befehl oci logging agent-configuration create und die erforderlichen Parameter, um eine Agent-Konfiguration zu erstellen:
oci logging agent-configuration create compartment-id compartment_ocid --is-enabled [true|false] --service-configuration service_configuration [OPTIONS]
Beispielbefehl und JSON-Dateienoci logging agent-configuration create --description <description> \ --display-name <display_name> --group-association file://group-association.json \ --compartment-id <compartment_id> --is-enabled true \ --service-configuration file://create-service-configuration.json --wait-for-state SUCCEEDED --max-wait-seconds 60
group-association.json
:{ "groupList": [ "<dynamic_group_id>" ] }
create-service-configuration.json
:{ "configurationType": "MONITORING", "applicationConfigurations": [ { "sourceType": "KUBERNETES", "source": { "name": "KUBERNETES-uniqueid", "scrapeTargets": [ { "resourceType": "PODS", "k8sNamespace": "k8s-namespace" } ] }, "destination": { "compartmentId": "<compartment_id>", "metricsNamespace": "metricsnamespace" }, "filter": { "allowList": [ "regex-test" ], "denyList": [], "filterType": "KUBERNETES_FILTER", "name": "test" } } ] }
Eine vollständige Liste der Parameter und Werte für CLI-Befehle finden Sie in der CLI-Befehlsreferenz.
Führen Sie den Vorgang CreateUnifiedAgentConfiguration aus, um eine Agent-Konfiguration zu erstellen.
Beispiel-API-AnforderungPOST /20200531/unifiedAgentConfigurations Host: https://logging.us-phoenix-1.oci.oraclecloud.com <authorization and other headers> { "serviceConfiguration": { "configurationType": "MONITORING", "applicationConfigurations": [ { "sourceType": "KUBERNETES", "source": { "name": "KUBERNETES-uniqueid", "scrapeTargets": [ { "resourceType": "PODS", "k8sNamespace": "k8s-namespace" } ] }, "destination": { "compartmentId": "<compartment_id>", "metricsNamespace": "metricsnamespace" }, "filter": { "allowList": [ "regex-test" ], "denyList": [], "filterType": "KUBERNETES_FILTER", "name": "test" } } ] }, "displayName": "mar-test", "isEnabled": true, "groupAssociation": { "groupList": [ "<dynamic_group_id>" ] }, "description": "test", "compartmentId": "<compartment_id>" }