-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support host monitor #1890
base: main
Are you sure you want to change the base?
Changes from all commits
3e12438
8f9f8ee
0455a6c
5435d03
6f8d8d4
f7b71ab
cc1f455
0693bb1
77f1384
719fb39
84332c9
3fd57b3
f2e1885
3b27c1b
2cb4b7b
c4614a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -504,13 +504,13 @@ size_t FetchECSMetaCallback(char* buffer, size_t size, size_t nmemb, std::string | |
HostIdentifier::HostIdentifier() { | ||
#ifdef __ENTERPRISE__ | ||
getECSMetaFromFile(); | ||
updateHostId(); | ||
#else | ||
ECSMeta ecsMeta; | ||
if (FetchECSMeta(ecsMeta)) { | ||
UpdateECSMetaAndHostid(ecsMeta); | ||
} | ||
#endif | ||
updateHostId(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
bool HostIdentifier::UpdateECSMetaAndHostid(const ECSMeta& meta) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,10 +81,15 @@ class HostIdentifier { | |
} | ||
|
||
bool UpdateECSMetaAndHostid(const ECSMeta& meta); | ||
bool FetchECSMeta(ECSMeta& metaObj); | ||
void DumpECSMeta(); | ||
#ifdef __ENTERPRISE__ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不要用这么怪的方式 |
||
bool FetchECSMeta(ECSMeta& metaObj); | ||
#endif | ||
|
||
private: | ||
#ifndef __ENTERPRISE__ | ||
bool FetchECSMeta(ECSMeta& metaObj); | ||
#endif | ||
void getECSMetaFromFile(); | ||
// 从云助手获取序列号 | ||
void getSerialNumberFromEcsAssist(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2024 iLogtail Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "EntityConstants.h" | ||
|
||
namespace logtail { | ||
|
||
const std::string DEFAULT_CONTENT_KEY_ENTITY_TYPE = "__entity_type__"; | ||
const std::string DEFAULT_CONTENT_KEY_ENTITY_ID = "__entity_id__"; | ||
const std::string DEFAULT_CONTENT_KEY_DOMAIN = "__domain__"; | ||
const std::string DEFAULT_CONTENT_VALUE_DOMAIN_ACS = "acs"; | ||
const std::string DEFAULT_CONTENT_VALUE_DOMAIN_INFRA = "infra"; | ||
const std::string DEFAULT_HOST_TYPE_ECS = "acs.ecs.instance"; | ||
const std::string DEFAULT_HOST_TYPE_HOST = "acs.host.instance"; | ||
const std::string DEFAULT_CONTENT_KEY_FIRST_OBSERVED_TIME = "__first_observed_time__"; | ||
const std::string DEFAULT_CONTENT_KEY_LAST_OBSERVED_TIME = "__last_observed_time__"; | ||
const std::string DEFAULT_CONTENT_KEY_KEEP_ALIVE_SECONDS = "__keep_alive_seconds__"; | ||
const std::string DEFAULT_CONTENT_KEY_METHOD = "__method__"; | ||
const std::string DEFAULT_CONTENT_VALUE_METHOD_UPDATE = "update"; | ||
const std::string DEFAULT_CONTENT_VALUE_METHOD_EXPIRE = "expire"; | ||
|
||
// process entity | ||
const std::string DEFAULT_CONTENT_VALUE_ENTITY_TYPE_ECS_PROCESS = "acs.ecs.process"; | ||
const std::string DEFAULT_CONTENT_VALUE_ENTITY_TYPE_HOST_PROCESS = "infra.host.process"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_PID = "pid"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 字段是如何跟安全保持一致的? |
||
const std::string DEFAULT_CONTENT_KEY_PROCESS_PPID = "ppid"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_USER = "user"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_COMM = "comm"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_KTIME = "ktime"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_CWD = "cwd"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_BINARY = "binary"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_ARGUMENTS = "arguments"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_LANGUAGE = "language"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_CONTAINER_ID = "container_id"; | ||
|
||
const std::string DEFAULT_CONTENT_KEY_SRC_DOMAIN = "__src_domain__"; | ||
const std::string DEFAULT_CONTENT_KEY_SRC_ENTITY_TYPE = "__src_entity_type__"; | ||
const std::string DEFAULT_CONTENT_KEY_SRC_ENTITY_ID = "__src_entity_id__"; | ||
const std::string DEFAULT_CONTENT_KEY_DEST_DOMAIN = "__dest_domain__"; | ||
const std::string DEFAULT_CONTENT_KEY_DEST_ENTITY_TYPE = "__dest_entity_type__"; | ||
const std::string DEFAULT_CONTENT_KEY_DEST_ENTITY_ID = "__dest_entity_id__"; | ||
const std::string DEFAULT_CONTENT_KEY_RELATION_TYPE = "__relation_type__"; | ||
} // namespace logtail |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2024 iLogtail Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <string> | ||
|
||
namespace logtail { | ||
|
||
extern const std::string DEFAULT_ENV_KEY_HOST_TYPE; | ||
extern const std::string DEFAULT_HOST_TYPE_ECS; | ||
extern const std::string DEFAULT_HOST_TYPE_HOST; | ||
extern const std::string DEFAULT_CONTENT_KEY_ENTITY_TYPE; | ||
extern const std::string DEFAULT_CONTENT_KEY_ENTITY_ID; | ||
extern const std::string DEFAULT_CONTENT_KEY_DOMAIN; | ||
extern const std::string DEFAULT_CONTENT_VALUE_DOMAIN_ACS; | ||
extern const std::string DEFAULT_CONTENT_VALUE_DOMAIN_INFRA; | ||
extern const std::string DEFAULT_CONTENT_KEY_FIRST_OBSERVED_TIME; | ||
extern const std::string DEFAULT_CONTENT_KEY_LAST_OBSERVED_TIME; | ||
extern const std::string DEFAULT_CONTENT_KEY_KEEP_ALIVE_SECONDS; | ||
extern const std::string DEFAULT_CONTENT_KEY_METHOD; | ||
extern const std::string DEFAULT_CONTENT_VALUE_METHOD_UPDATE; | ||
extern const std::string DEFAULT_CONTENT_VALUE_METHOD_EXPIRE; | ||
|
||
// process entity | ||
extern const std::string DEFAULT_CONTENT_VALUE_ENTITY_TYPE_ECS_PROCESS; | ||
extern const std::string DEFAULT_CONTENT_VALUE_ENTITY_TYPE_HOST_PROCESS; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_PID; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_PPID; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_USER; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_COMM; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_KTIME; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_CWD; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_BINARY; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_ARGUMENTS; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_LANGUAGE; | ||
extern const std::string DEFAULT_CONTENT_KEY_PROCESS_CONTAINER_ID; | ||
|
||
// link | ||
extern const std::string DEFAULT_CONTENT_KEY_SRC_DOMAIN; | ||
extern const std::string DEFAULT_CONTENT_KEY_SRC_ENTITY_TYPE; | ||
extern const std::string DEFAULT_CONTENT_KEY_SRC_ENTITY_ID; | ||
extern const std::string DEFAULT_CONTENT_KEY_DEST_DOMAIN; | ||
extern const std::string DEFAULT_CONTENT_KEY_DEST_ENTITY_TYPE; | ||
extern const std::string DEFAULT_CONTENT_KEY_DEST_ENTITY_ID; | ||
extern const std::string DEFAULT_CONTENT_KEY_RELATION_TYPE; | ||
} // namespace logtail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
调整的入口单一,没必要的入口去掉