Skip to content

Commit

Permalink
Correct the document and json scheme (#346)
Browse files Browse the repository at this point in the history
* correct the channel example

* correct the how to disable the pid file

* add description how to disable  sla persistent data in json scheme

* correct the disable pid file description in doc and json scheme

* add ~/GitHub/easeprobe configuration for pid file

* refine the channel diagram

* refine the channel diagram
  • Loading branch information
haoel authored May 8, 2023
1 parent 9ff1722 commit 866c6f4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
9 changes: 7 additions & 2 deletions cmd/easeprobe/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand All @@ -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 ('' 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"`
Expand Down
40 changes: 20 additions & 20 deletions docs/Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -1228,34 +1228,34 @@ 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

```
┌─────── ┌──────────────┐
│Probe B├─────────►│ Mgmt_Channel ├────┐
└───────┘ └──────────────┘ │
┌─────────────┐ ┌────────┐
┌─────►│ Dev_Channel ├─────▼───► Discord │
└───────────── └─────────┘
┌───────┐ │
│Probe A├───┤
└───────┘ │
┌──────────── ┌─────────┐
└─────►│ QA_Channel ├──────────► Gmail │
└──────────── └─────────┘
┌─────────┐ ┌──────────────┐
Probe A ├───────►│ Mgmt_Channel ├──────────┐
└─────────┘ └──────────────┘
http
┌─────────────┐ ┌────────┐
┌───►│ Dev_Channel ├────►│ Discord │
└──────────────┘ └─────────┘
┌─────────┐ │
Probe B ├───┤
└─────────┘ │
shell │ ┌──────────────┐ ┌─────────┐
└───►│ QA_Channel ├────►│ Gmail │
└──────────────┘ └─────────┘
```
# 5. Administration
Expand All @@ -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, you can configure the pid file to "".
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
Expand Down

0 comments on commit 866c6f4

Please sign in to comment.