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

[Proposal] Add sorting option with sequence number #130

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ Use the sample [config.cfg](https://github.com/valeriansaliou/vigil/blob/master/

* `id` (type: _string_, allowed: any unique lowercase string, no default) — Unique identifier of the probed service node (not visible on the status page)
* `label` (type: _string_, allowed: any string, no default) — Name of the probed service node (visible on the status page)
* `sequence` (type: _uin16_, allowed: any number, no default) — Sort the fields based on that number
* `mode` (type: _string_, allowed: `poll`, `push`, `script`, `local`, no default) — Probe mode for this node (ie. `poll` is direct HTTP, TCP or ICMP poll to the URLs set in `replicas`, while `push` is for Vigil Reporter nodes, `script` is used to execute a shell script and `local` is for Vigil Local nodes)
* `replicas` (type: _array[string]_, allowed: TCP, ICMP or HTTP URLs, default: empty) — Node replica URLs to be probed (only used if `mode` is `poll`)
* `scripts` (type: _array[string]_, allowed: shell scripts as source code, default: empty) — Shell scripts to be executed on the system as a Vigil sub-process; they are handy to build custom probes (only used if `mode` is `script`)
Expand Down
1 change: 1 addition & 0 deletions src/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ pub struct ConfigProbeServiceNode {
pub id: String,
pub label: String,
pub mode: Mode,
pub sequence: Option<u16>,
pub replicas: Option<Vec<String>>,
pub scripts: Option<Vec<String>>,

Expand Down
13 changes: 12 additions & 1 deletion src/prober/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,18 @@ pub fn initialize_store() {
}
}

probe.nodes.insert(node.id.to_owned(), probe_node);
match node.sequence {
None => {
probe
.nodes
.insert(format!("z{}", node.id.to_owned()), probe_node);
}
Some(v) => {
probe
.nodes
.insert(format!("{}{}", v, node.id.to_owned()), probe_node);
}
}
}

store.states.probes.insert(service.id.to_owned(), probe);
Expand Down