Skip to content
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: 进程采集支持维度动态发现 --Story=119424982 --story=119424982 #2690

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<template>
<div class="process-params">
<div
v-show="false"
class="form-item"
v-show="false"
>
<!-- 插件选择部分优先级提高,故隐藏此处 -->
<label class="item-label required">{{ $t('插件') }}</label>
Expand All @@ -42,65 +42,71 @@
<label class="item-label required">{{ $t('进程匹配') }}</label>
<div class="item-content">
<bk-radio-group
v-model="params.match_type"
class="process-match"
v-model="params.match_type"
>
<bk-radio value="command">
{{ $t('命令行匹配') }}
</bk-radio>
<bk-radio
value="pid"
class="ml20"
value="pid"
>
{{ $t('PID文件') }}
</bk-radio>
</bk-radio-group>
<div v-if="params.match_type === 'command'">
<verify-input
class="small-input validate-icon"
position="right"
:show-validate.sync="rules.match_pattern"
:validator="{ content: $t('必填项') }"
position="right"
>
<bk-input
v-model="params.match_pattern"
class="mt10 small-input"
v-model="params.match_pattern"
:placeholder="$t('进程关键字')"
>
<template slot="prepend">
<div
class="group-text"
:placeholder="$t('进程关键字')"
>
<div class="group-text">
{{ $t('包含') }}
</div>
</template>
</bk-input>
</verify-input>

<bk-input
v-model="params.exclude_pattern"
class="mt10 small-input"
v-model="params.exclude_pattern"
:placeholder="$t('进程排除正则')"
>
<template slot="prepend">
<div
class="group-text"
:placeholder="$t('进程排除正则')"
>
<div class="group-text">
{{ $t('排除') }}
</div>
</template>
</bk-input>
<bk-input
class="mt10 small-input"
v-model="params.extract_pattern"
:placeholder="$t('维度提取')"
>
<template slot="prepend">
<div class="group-text">
{{ $t('维度提取') }}
</div>
</template>
</bk-input>
</div>
<template v-else-if="params.match_type === 'pid'">
<verify-input
class="small-input validate-icon"
position="right"
:show-validate.sync="rules.pid_path"
:validator="{ content: $t('必填项') }"
position="right"
>
<bk-input
v-model="params.pid_path"
class="mt10 small-input"
v-model="params.pid_path"
:placeholder="$t('PID的绝对路径')"
/>
</verify-input>
Expand All @@ -121,11 +127,11 @@
<div class="item-content">
<bk-switcher
v-model="params.port_detect"
show-text
:on-text="$t('开')"
:off-text="$t('关')"
:on-text="$t('开')"
size="small"
theme="primary"
show-text
/>
</div>
</div>
Expand Down Expand Up @@ -154,6 +160,7 @@ export default {
process_name: '',
match_pattern: '',
exclude_pattern: '',
extract_pattern: '',
port_detect: true,
labels: {},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@
<span class="item-name">{{ $t('排除') }}</span>
<span class="item-content">{{ basicInfo.exclude_pattern }}</span>
</li>
<li class="param-list-item">
<span class="item-name">{{ $t('维度提取') }}</span>
<span class="item-content">{{ basicInfo.extract_pattern }}</span>
</li>
</ul>
</template>
<template v-else>
Expand Down Expand Up @@ -582,7 +586,7 @@ export default {
};
}
if (data.extend_info.process) {
const { process } = data.extend_info;
const { process: processInfo } = data.extend_info;
this.basicInfoMap = {
...this.basicInfoMap,
match: this.$t('进程匹配'),
Expand All @@ -595,13 +599,15 @@ export default {
port_detect: portDetect,
match_pattern: matchPattern,
exclude_pattern: excludePattern,
extract_pattern: extractPattern,
pid_path: pidPath,
} = process;
} = processInfo;
this.basicInfo = {
...this.basicInfo,
match: matchType,
match_pattern: matchPattern,
exclude_pattern: excludePattern,
extract_pattern: extractPattern,
pid_path: pidPath,
process_name: processName || '--',
port_detect: `${portDetect}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import { PLUGIN_MANAGE_AUTH } from '../authority-map';
import './collector-configuration.scss';

enum ETargetColumn {
IP = 'IP',
agentStatus = 'agentStatus',
catetory = 'catetory',
cloudName = 'cloudName',
IP = 'IP',
name = 'name',
objectType = 'objectType',
}
Expand Down Expand Up @@ -150,13 +150,15 @@ export default class CollectorConfiguration extends tsc<IProps> {
port_detect: portDetect,
match_pattern: matchPattern,
exclude_pattern: excludePattern,
extract_pattern: extractPattern,
pid_path: pidPath,
} = process;
this.basicInfo = {
...this.basicInfo,
match: matchType,
match_pattern: matchPattern,
exclude_pattern: excludePattern,
extract_pattern: extractPattern,
pid_path: pidPath,
process_name: processName || '--',
port_detect: `${portDetect}`,
Expand Down Expand Up @@ -337,7 +339,7 @@ export default class CollectorConfiguration extends tsc<IProps> {
(() => {
if (key === 'name') {
return [
<span>
<span key={1}>
{this.input.show ? (
<bk-input
ref={`input${key}`}
Expand Down Expand Up @@ -393,8 +395,16 @@ export default class CollectorConfiguration extends tsc<IProps> {
<span class='detail-item-val process'>
{this.basicInfo?.[key] === 'command'
? [
<div class='match-title'>{this.matchType?.[this.basicInfo?.[key]]}</div>,
<ul class='param-list'>
<div
key={'match-title'}
class='match-title'
>
{this.matchType?.[this.basicInfo?.[key]]}
</div>,
<ul
key={'param-list'}
class='param-list'
>
<li class='param-list-item'>
<span class='item-name'>{this.$t('包含')}</span>
<span class='item-content'>{this.basicInfo?.match_pattern}</span>
Expand All @@ -403,11 +413,22 @@ export default class CollectorConfiguration extends tsc<IProps> {
<span class='item-name'>{this.$t('排除')}</span>
<span class='item-content'>{this.basicInfo?.exclude_pattern}</span>
</li>
<li class='param-list-item'>
<span class='item-name'>{this.$t('维度提取')}</span>
<span class='item-content'>{this.basicInfo?.extract_pattern}</span>
</li>
</ul>,
]
: [
<div class='match-title'>{this.matchType?.[this.basicInfo?.[key]]}</div>,
<div>{`${this.$t('PID的绝对路径')}:${this.basicInfo?.pid_path}`}</div>,
<div
key={'match-title'}
class='match-title'
>
{this.matchType?.[this.basicInfo?.[key]]}
</div>,
<div
key={'param-list'}
>{`${this.$t('PID的绝对路径')}:${this.basicInfo?.pid_path}`}</div>,
]}
</span>
);
Expand All @@ -419,7 +440,7 @@ export default class CollectorConfiguration extends tsc<IProps> {
{this.runtimeParams.length
? formItem(
this.$t('运行参数'),
<ul class='param-list mt--6'>
<ul class='param-list mt--6'>
{this.runtimeParams.map((item, index) => (
<li
key={index}
Expand Down