From c6426e70fb38cef43f0ec7c0802619185a31186a Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sat, 6 May 2023 23:27:14 +0800 Subject: [PATCH 1/7] correct the channel example --- docs/Manual.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/Manual.md b/docs/Manual.md index a6520eea..49ce92f9 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -1228,15 +1228,15 @@ For example: ```YAML http: - name: probe A - channels : [ Dev_Channel, Manager_Channel ] + channels : [ Mgmt_Channel ] shell: - name: probe B - channels: [ Ops_Channel ] + channels: [ Dev_Channel, QA_Channel ] notify: - discord: Discord - channels: [ Dev_Channel, Ops_Channel ] + channels: [ Mgmt_Channel, Dev_Channel ] - email: Gmail - channels: [ Mgmt_Channel ] + channels: [ QA_Channel ] ``` Then, we will have the following diagram @@ -1245,7 +1245,7 @@ Then, we will have the following diagram ┌───────┐ ┌──────────────┐ │Probe B├─────────►│ Mgmt_Channel ├────┐ └───────┘ └──────────────┘ │ - │ + http │ │ ┌─────────────┐ │ ┌─────────┐ ┌─────►│ Dev_Channel ├─────▼───► Discord │ @@ -1253,7 +1253,7 @@ Then, we will have the following diagram ┌───────┐ │ │Probe A├───┤ └───────┘ │ - │ ┌────────────┐ ┌─────────┐ + shell │ ┌────────────┐ ┌─────────┐ └─────►│ QA_Channel ├──────────► Gmail │ └────────────┘ └─────────┘ ``` From b8960bd13724c7061920588b0fefda0bfc6cf2e3 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sat, 6 May 2023 23:33:30 +0800 Subject: [PATCH 2/7] correct the how to disable the pid file --- docs/Manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Manual.md b/docs/Manual.md index 49ce92f9..1c726fc7 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -1274,7 +1274,7 @@ pid: /var/run/easeprobe.pid - If the file already exists, EaseProbe would overwrite it. - If the file cannot be written, EaseProbe would exit with an error. -If you want to disable the PID file, you can configure the pid file to "". +If you want to disable the PID file, you can configure the pid file to "-". ```YAML settings: From c834b0b080be9eba36aa29080e799f97271dd46f Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sat, 6 May 2023 23:45:37 +0800 Subject: [PATCH 3/7] add description how to disable sla persistent data in json scheme --- conf/conf.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/conf.go b/conf/conf.go index f7b2b963..52afda5f 100644 --- a/conf/conf.go +++ b/conf/conf.go @@ -109,7 +109,7 @@ type SLAReport struct { Schedule Schedule `yaml:"schedule" json:"schedule" jsonschema:"type=string,enum=none,enum=minutely,enum=hourly,enum=daily,enum=weekly,enum=monthly,title=Schedule,description=the schedule of SLA report"` Time string `yaml:"time" json:"time,omitempty" jsonschema:"format=time,title=Time,description=the time of SLA report need to send out,example=23:59:59+08:00"` //Debug bool `yaml:"debug" json:"debug,omitempty" jsonschema:"title=Debug,description=if true the SLA report will be printed to stdout,default=false"` - DataFile string `yaml:"data" json:"data,omitempty" jsonschema:"title=Data File,description=the data file of SLA report, absolute path"` + DataFile string `yaml:"data" json:"data,omitempty" jsonschema:"title=Data File,description=the data file of SLA report, absolute path. ('-' means no SLA persistent data)"` Backups int `yaml:"backups" json:"backups,omitempty" jsonschema:"title=Backups,description=the number of backups of SLA report,default=5"` Channels []string `yaml:"channels" json:"channels,omitempty" jsonschema:"title=Channels,description=the channels of SLA report"` } From 52ac822fe0b73aaa8ca5728ea6a05f5be0d26199 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sun, 7 May 2023 10:24:24 +0800 Subject: [PATCH 4/7] correct the disable pid file description in doc and json scheme --- conf/conf.go | 2 +- docs/Manual.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/conf.go b/conf/conf.go index 52afda5f..fccb82c9 100644 --- a/conf/conf.go +++ b/conf/conf.go @@ -126,7 +126,7 @@ type HTTPServer struct { type Settings struct { Name string `yaml:"name" json:"name,omitempty" jsonschema:"title=EaseProbe Name,description=The name of the EaseProbe instance,default=EaseProbe"` IconURL string `yaml:"icon" json:"icon,omitempty" jsonschema:"title=Icon URL,description=The URL of the icon of the EaseProbe instance"` - PIDFile string `yaml:"pid" json:"pid,omitempty" jsonschema:"title=PID File,description=The PID file of the EaseProbe instance ('-' means no PID file)"` + PIDFile string `yaml:"pid" json:"pid,omitempty" jsonschema:"title=PID File,description=The PID file of the EaseProbe instance (leave this empty means no PID file)"` Log Log `yaml:"log" json:"log,omitempty" jsonschema:"title=EaseProbe Log,description=The log settings of the EaseProbe instance"` TimeFormat string `yaml:"timeformat" json:"timeformat,omitempty" jsonschema:"title=Time Format,description=The time format of the EaseProbe instance,default=2006-01-02 15:04:05Z07:00"` TimeZone string `yaml:"timezone" json:"timezone,omitempty" jsonschema:"title=Time Zone,description=The time zone of the EaseProbe instance,example=Asia/Shanghai,example=Europe/Berlin,default=UTC"` diff --git a/docs/Manual.md b/docs/Manual.md index 1c726fc7..af0e212b 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -1274,7 +1274,7 @@ pid: /var/run/easeprobe.pid - If the file already exists, EaseProbe would overwrite it. - If the file cannot be written, EaseProbe would exit with an error. -If you want to disable the PID file, you can configure the pid file to "-". +If you want to disable the PID file, just simply not configure this. ```YAML settings: From fcd0cc923aa068f352cdd17d96aa0626ea2c7f61 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sun, 7 May 2023 11:05:08 +0800 Subject: [PATCH 5/7] add ~/GitHub/easeprobe configuration for pid file --- cmd/easeprobe/main.go | 9 +++++++-- conf/conf.go | 2 +- docs/Manual.md | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/easeprobe/main.go b/cmd/easeprobe/main.go index 9173ac4d..cdf567e4 100644 --- a/cmd/easeprobe/main.go +++ b/cmd/easeprobe/main.go @@ -102,7 +102,8 @@ func main() { } // Create the pid file if the file name is not empty - if len(strings.TrimSpace(c.Settings.PIDFile)) > 0 { + c.Settings.PIDFile = strings.TrimSpace(c.Settings.PIDFile) + if len(c.Settings.PIDFile) > 0 && c.Settings.PIDFile != "-" { d, err := daemon.NewPIDFile(c.Settings.PIDFile) if err != nil { log.Errorf("Fatal: Cannot create the PID file: %s!", err) @@ -111,7 +112,11 @@ func main() { log.Infof("Successfully created the PID file: %s", d.PIDFile) defer d.RemovePIDFile() } else { - log.Info("Skipping PID file creation (pidfile empty).") + if len(c.Settings.PIDFile) == 0 { + log.Info("Skipping PID file creation (pid file is empty).") + } else { + log.Info("Skipping PID file creation (pid file is set to '-').") + } } c.InitAllLogs() diff --git a/conf/conf.go b/conf/conf.go index fccb82c9..76a7ea34 100644 --- a/conf/conf.go +++ b/conf/conf.go @@ -126,7 +126,7 @@ type HTTPServer struct { type Settings struct { Name string `yaml:"name" json:"name,omitempty" jsonschema:"title=EaseProbe Name,description=The name of the EaseProbe instance,default=EaseProbe"` IconURL string `yaml:"icon" json:"icon,omitempty" jsonschema:"title=Icon URL,description=The URL of the icon of the EaseProbe instance"` - PIDFile string `yaml:"pid" json:"pid,omitempty" jsonschema:"title=PID File,description=The PID file of the EaseProbe instance (leave this empty means no PID file)"` + PIDFile string `yaml:"pid" json:"pid,omitempty" jsonschema:"title=PID File,description=The PID file of the EaseProbe instance ('' or '-' means no PID file)"` Log Log `yaml:"log" json:"log,omitempty" jsonschema:"title=EaseProbe Log,description=The log settings of the EaseProbe instance"` TimeFormat string `yaml:"timeformat" json:"timeformat,omitempty" jsonschema:"title=Time Format,description=The time format of the EaseProbe instance,default=2006-01-02 15:04:05Z07:00"` TimeZone string `yaml:"timezone" json:"timezone,omitempty" jsonschema:"title=Time Zone,description=The time zone of the EaseProbe instance,example=Asia/Shanghai,example=Europe/Berlin,default=UTC"` diff --git a/docs/Manual.md b/docs/Manual.md index af0e212b..54b0eb45 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -1274,11 +1274,11 @@ pid: /var/run/easeprobe.pid - If the file already exists, EaseProbe would overwrite it. - If the file cannot be written, EaseProbe would exit with an error. -If you want to disable the PID file, just simply not configure this. +If you want to disable the PID file, you can set it to "-" or "". ```YAML settings: -pid: "" # EaseProbe won't create a PID file + pid: "" # EaseProbe won't create a PID file ``` ## 5.2 Log file Rotation From 9ed5de16b1f0a2264818461e4a031c65cd1ffac5 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sun, 7 May 2023 11:11:56 +0800 Subject: [PATCH 6/7] refine the channel diagram --- docs/Manual.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/Manual.md b/docs/Manual.md index 54b0eb45..d6733311 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -1242,19 +1242,19 @@ notify: Then, we will have the following diagram ``` -┌───────┐ ┌──────────────┐ -│Probe B├─────────►│ Mgmt_Channel ├────┐ -└───────┘ └──────────────┘ │ - http │ - │ - ┌─────────────┐ │ ┌─────────┐ - ┌─────►│ Dev_Channel ├─────▼───► Discord │ - │ └─────────────┘ └─────────┘ -┌───────┐ │ -│Probe A├───┤ -└───────┘ │ - shell │ ┌────────────┐ ┌─────────┐ - └─────►│ QA_Channel ├──────────► Gmail │ +┌─────────┐ ┌──────────────┐ +│ Probe A ├─────────►│ Mgmt_Channel ├──────────┐ +└─────────┘ └──────────────┘ │ + http │ + │ + ┌─────────────┐ ┌────▼────┐ + ┌───►│ Dev_Channel ├───────►│ Discord │ + │ └─────────────┘ └─────────┘ +┌─────────┐ │ +│ Probe B ├───┤ +└─────────┘ │ + shell │ ┌────────────┐ ┌─────────┐ + └───►│ QA_Channel ├─────────►│ Gmail │ └────────────┘ └─────────┘ ``` From c398b53bea41f14ae6158ca3efcef8be228dda0a Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sun, 7 May 2023 11:14:49 +0800 Subject: [PATCH 7/7] refine the channel diagram --- docs/Manual.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/Manual.md b/docs/Manual.md index d6733311..ce5b82fc 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -1242,20 +1242,20 @@ notify: Then, we will have the following diagram ``` -┌─────────┐ ┌──────────────┐ -│ Probe A ├─────────►│ Mgmt_Channel ├──────────┐ -└─────────┘ └──────────────┘ │ - http │ - │ - ┌─────────────┐ ┌────▼────┐ - ┌───►│ Dev_Channel ├───────►│ Discord │ - │ └─────────────┘ └─────────┘ +┌─────────┐ ┌──────────────┐ +│ Probe A ├───────►│ Mgmt_Channel ├──────────┐ +└─────────┘ └──────────────┘ │ + http │ + │ + ┌──────────────┐ ┌────▼────┐ + ┌───►│ Dev_Channel ├────►│ Discord │ + │ └──────────────┘ └─────────┘ ┌─────────┐ │ │ Probe B ├───┤ └─────────┘ │ - shell │ ┌────────────┐ ┌─────────┐ - └───►│ QA_Channel ├─────────►│ Gmail │ - └────────────┘ └─────────┘ + shell │ ┌──────────────┐ ┌─────────┐ + └───►│ QA_Channel ├────►│ Gmail │ + └──────────────┘ └─────────┘ ``` # 5. Administration