Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Adding or Modifying Application Discovery Rules

Updated on 2024-04-15 GMT+08:00

Function

This API is used to add or modify one or more application discovery rules. A maximum of 100 rules can be added to a project.

URI

PUT /v1/{project_id}/aom/application-discovery-rules

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID obtained from IAM. Generally, a project ID contains 32 characters.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

Content-Type

Yes

String

Content type, which is application/json.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

app_rules

Yes

Array of AppRuleV1 objects

Application Discovery Rules

Table 4 AppRuleV1

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID obtained from IAM. Generally, a project ID contains 32 characters.

id

Yes

String

Rule ID. When creating an application discovery rule, leave this parameter blank. When modifying an application discovery rule, enter a rule ID.

name

Yes

String

Rule name. The value can contain a maximum of 64 characters. It must start with a lowercase letter and cannot end with a hyphen (-). Only digits, lowercase letters, and hyphens are allowed.

enable

Yes

Boolean

Whether a rule is enabled. Value: true or false.

host_id

No

Array of strings

Host ID (not used currently and can be left empty).

event_name

Yes

String

aom_inventory_rules_event Rule event name. For service discovery, the fixed name is aom_inventory_rules_event.

spec

Yes

AppRulesSpecV1 object

Additional information.

create_time

No

String

Creation time. When creating an application discovery rule, leave this parameter blank. When modifying an application discovery rule, enter the returned createTime.

desc

No

String

Rule description.

Table 5 AppRulesSpecV1

Parameter

Mandatory

Type

Description

app_type

No

String

Service type, which is used only for rule classification and UI display. You can enter any field. For example, enter Java or Python to specify a technology stack. You can also enter collector or database to specify a function.

attr_list

No

Array of strings

Attribute list (not used currently and can be left empty).

discovery_rule

Yes

Array of DiscoveryRuleV1 objects

Discovery rule. When it is an array consisting of multiple conditions, only the processes that meet all the conditions are filtered.If the value of checkType is cmdLine, set the value of checkMode to contain. checkContent is in the format of ["xxx"], indicating that the process must contain the xxx parameter. If the value of checkType is env, set the value of checkMode to contain. checkContent is in the format of ["k1","v1"], indicating that the process must contain the environment variable whose name is k1 and value is v1. If the value of checkType is scope, set the value of checkMode to equals. checkContent is in the format of ["hostId1","hostId2"], indicating that the rule takes effect only on specified nodes. If no nodes are specified, the rule applies to all nodes of the project.

name_rule

Yes

NameRuleV1 object

Naming rules for discovered services and applications.

detect_log

No

String

Whether to enable log collection. Value: true or false

log_file_fix

No

Array of strings

Log file suffix. Value: log, trace, or out

priority

Yes

Integer

Rule priority. Value: 1–9999 (default)

is_detect

Yes

String

Whether the scenario is a pre-check scenario. No rules will be saved in the pre-check scenario. This scenario is designed only to check whether a rule can detect node processes before it is delivered. true or false

data_source

No

String

Data source.

editable

No

String

Whether a rule can be modified. If editable is set to "false", the rule is a system rule and cannot be deleted.

is_default_rule

Yes

String

Whether the current rule is the default one. Value: true or false

log_path_rule

No

Array of NameRuleContent objects

Log path configuration rule.If cmdLineHash is a fixed string, a log path or log file is specified. Otherwise, only the files whose names end with .log and .trace are collected. If the value of nameType is cmdLineHash, args is in the format of ["00001"] and value is in the format of ["/xxx/xx.log"], indicating that the log path is /xxx/xx.log when the startup command is 00001.

aom_metric_relabel_configs

No

Array of Map<String,String> objects

Metric configuration.

Table 6 DiscoveryRuleV1

Parameter

Mandatory

Type

Description

check_type

Yes

String

Match type. Value: cmdLine, env, or scope

check_mode

Yes

String

Match condition. Value: contain or equals

check_content

Yes

Array of strings

Matched value.

Table 7 NameRuleV1

Parameter

Mandatory

Type

Description

app_name_rule

No

Array of NameRuleContent objects

Component naming rule.

application_name_rule

No

Array of NameRuleContent objects

Application naming rule.

environment

No

Array of NameRuleContent objects

Environment information.

Table 8 NameRuleContent

Parameter

Mandatory

Type

Description

name_type

No

String

Value type.

args

No

Array of strings

Command.

value

No

Array of strings

Log path.

Response Parameters

Status code: 200

Table 9 Response body parameters

Parameter

Type

Description

id

Array of strings

Application discovery rule ID.

Example Requests

Add or modify one or more application discovery rules.

PUT https://{Endpoint}/v1/{project_id}/aom/application-discovery-rules

{
  "app_rules" : [ {
    "id" : "44d6c4bb-f673-4bf4-8d33-313832f37b28",
    "name" : "bytest",
    "create_time" : "",
    "project_id" : "5a6036f48e954fcd84d198cb28db311a",
    "enable" : true,
    "host_id" : [ ],
    "event_name" : "aom_inventory_rules_event",
    "spec" : {
      "detect_log" : "true",
      "log_file_fix" : [ "log", "trace" ],
      "discovery_rule" : [ {
        "check_type" : "cmdLine",
        "check_mode" : "contain",
        "check_content" : [ "default" ]
      }, {
        "check_type" : "scope",
        "check_mode" : "equals",
        "check_content" : [ "44d6c4bb-f673-4bf4-8d33-313832f37b28" ]
      } ],
      "attr_list" : [ "cmdLine" ],
      "is_detect" : "false",
      "priority" : 1,
      "name_rule" : {
        "app_name_rule" : [ {
          "name_type" : "cmdLineHash",
          "args" : [ "00000000001" ],
          "value" : [ "serviceName1" ]
        }, {
          "name_type" : "cmdLine",
          "args" : [ "/var/paas/kubernetes/", "/kubeconfig" ]
        }, {
          "name_type" : "env",
          "args" : [ "APP_NAME" ]
        }, {
          "name_type" : "str",
          "args" : [ "kube" ]
        } ],
        "application_name_rule" : [ {
          "name_type" : "cmdLineHash",
          "args" : [ "00000000001" ],
          "value" : [ "applicationName1" ]
        }, {
          "name_type" : "str",
          "args" : [ "kubeproxy" ]
        } ]
      },
      "app_type" : "",
      "is_default_rule" : "false",
      "log_path_rule" : [ {
        "name_type" : "cmdLineHash",
        "args" : [ "00000000001" ],
        "value" : [ "/xx/xxx/xx.log", "/xx/xxx/xx" ]
      } ]
    }
  } ]
}

Example Responses

None

Status Codes

Status Code

Description

200

OK

The request is successful.

400

Bad Request

The client should not repeat the request without modifications.

401

Unauthorized

The authentication information is incorrect or invalid.

403

ForbiddenThe server has received the request and understood it, but the server is refusing to respond to it. The client should not repeat the request without modifications.

500

Internal Server Error

The server has received the request but could not understand it.

503

Service Unavailable

The client should not repeat the request without modifications.

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback