[添加]prometheus远程提交时的数据源可以自己填写
This commit is contained in:
@@ -11,6 +11,15 @@ scrape_configs:
|
|||||||
scrape_interval: {{ getv "/time/opcua_scrape_interval"}}{{ getv "/time/opcua_scrape_interval_unit" }}
|
scrape_interval: {{ getv "/time/opcua_scrape_interval"}}{{ getv "/time/opcua_scrape_interval_unit" }}
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: [ '127.0.0.1:8191' ]
|
- targets: [ '127.0.0.1:8191' ]
|
||||||
|
labels:
|
||||||
|
__hostname__: {{ getv "/remote_write/data_source_label" }}
|
||||||
|
relabel_configs:
|
||||||
|
- source_labels:
|
||||||
|
- "__hostname__"
|
||||||
|
regex: (.*)
|
||||||
|
target_label: source
|
||||||
|
action: replace
|
||||||
|
replacement: {{ getv "/remote_write/data_source_label" }}
|
||||||
{{ if getv "/remote_write/state" }}
|
{{ if getv "/remote_write/state" }}
|
||||||
remote_write:
|
remote_write:
|
||||||
- url: {{ getv "/remote_write/url" }}
|
- url: {{ getv "/remote_write/url" }}
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ class ManageRemoteWrite extends SettingsPage
|
|||||||
->url()
|
->url()
|
||||||
->placeholder("http://remote-storage.example.com/api/v1/write"),
|
->placeholder("http://remote-storage.example.com/api/v1/write"),
|
||||||
|
|
||||||
|
// 数据源名陈
|
||||||
|
Forms\Components\TextInput::make('data_source_label')
|
||||||
|
->label("数据源名称")
|
||||||
|
->required(),
|
||||||
|
|
||||||
// 每个分片的最大队列容量
|
// 每个分片的最大队列容量
|
||||||
Forms\Components\TextInput::make('queue_config_capacity')
|
Forms\Components\TextInput::make('queue_config_capacity')
|
||||||
->label("队列容量")
|
->label("队列容量")
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class RemoteWriteSettings extends Settings
|
|||||||
public bool $state;
|
public bool $state;
|
||||||
public string $auth_mode;
|
public string $auth_mode;
|
||||||
public string $url;
|
public string $url;
|
||||||
|
public ?string $data_source_label;
|
||||||
public int $queue_config_capacity;
|
public int $queue_config_capacity;
|
||||||
public int $queue_config_max_samples_per_send;
|
public int $queue_config_max_samples_per_send;
|
||||||
public string $queue_config_batch_send_deadline;
|
public string $queue_config_batch_send_deadline;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ return new class extends SettingsMigration
|
|||||||
|
|
||||||
// 添加 Prometheus remote_write 配置参数
|
// 添加 Prometheus remote_write 配置参数
|
||||||
$this->migrator->add('remote_write.url', 'http://remote-storage.example.com/api/v1/write'); // 远程存储的URL
|
$this->migrator->add('remote_write.url', 'http://remote-storage.example.com/api/v1/write'); // 远程存储的URL
|
||||||
|
$this->migrator->add('remote_write.data_source_label',); // 数据源名称
|
||||||
$this->migrator->add('remote_write.queue_config_capacity', 10000); // 每个分片的最大队列容量
|
$this->migrator->add('remote_write.queue_config_capacity', 10000); // 每个分片的最大队列容量
|
||||||
$this->migrator->add('remote_write.queue_config_max_samples_per_send', 2000); // 每次发送的最大样本数
|
$this->migrator->add('remote_write.queue_config_max_samples_per_send', 2000); // 每次发送的最大样本数
|
||||||
$this->migrator->add('remote_write.queue_config_batch_send_deadline', '5s'); // 每次发送批次的最大等待时间
|
$this->migrator->add('remote_write.queue_config_batch_send_deadline', '5s'); // 每次发送批次的最大等待时间
|
||||||
|
|||||||
Reference in New Issue
Block a user