Skip to content

Commit

Permalink
Merge pull request #9 from northpowered/8-service-groups
Browse files Browse the repository at this point in the history
Service groups
  • Loading branch information
northpowered authored Sep 5, 2022
2 parents 02bb9e7 + e1edc3f commit a2afdfd
Show file tree
Hide file tree
Showing 9 changed files with 767 additions and 401 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __pycache__/
.vscode/
.mypy_cache/
config_sample.yml
config_potok.yml
# Distribution / packaging
.Python
build/
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Supported devices:
- Potok KM-122

TODO:
- Extend devices support
- Extending devices support
- Export data via logs (Loki way)
- Authentication via ssh with keys
- Logic for global_unit parameter
Expand Down Expand Up @@ -124,3 +124,20 @@ Configuration of *simplesla-local* device
target: '10.10.10.2'
delay: 4
```
#### Services groups
> To avoid multiple connections to one device, you can group your services, which should
be checked from one point
```yaml
ServicesGroups:
- name: mygroup
device: mydevice
policy: policy_for_all_subservices_without_own_policy
delay: 4 #the same for delay
services:
- name: serv1
target: '192.168.0.6'
policy: my_own_policy
- name: serv2
target: '10.3.5.3'
delay: 3
```
53 changes: 31 additions & 22 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,52 @@
server:
Server:
bind_address: '0.0.0.0' #Ipv4 for binding http server, ex. 127.0.0.1 or 0.0.0.0
port: 8800 #Port for binding http server, be carefull about permissions on different port
refresh_time: 2 #Prometheus endpoint update time, in seconds, ex. 2

global:
Global:
unit: 'ms'

local:
src_addr: '0.0.0.0'
Local:
src_addr: '0.0.0.0'
timeout: 1
ttl: 64
size: 56

devices:
- name: 'RT'
Devices:
- name: 'my_rt'
type: 'cisco'
transport: 'telnet'
address: '10.10.10.1'
transport: 'ssh'
address: '192.168.0.9'
username: 'admin'
password: 'password'
port: 22
- name: 'my_rt_2'
type: 'cisco'
transport: 'telnet'
address: '172.5.6.2'
username: 'cisco'
password: 'cisco'
port: 23

policies:
Policies:
- name: mypolicy
max_rtt: 0.15

services:
ServicesGroups:
- name: mygroup
device: 'my_rt_2'
delay: 6
services:
- name: serv1
target: '16.35.48.3'
delay: 3
policy: mypolicy
- name: serv2
target: '10.71.206.75'

Services:
- name: 'service01'
device: 'simplesla-local'
target: '192.168.0.2'
delay: 3
target: '192.168.0.1'
delay: 20
policy: mypolicy
- name: 'service02'
device: 'simplesla-local'
target: '172.16.0.2'
delay: 7
- name: 'testcisco'
device: 'RT'
target: '10.10.10.2'
delay: 4


6 changes: 4 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from sla.sla import Sla
import sys
import argparse
import os


if __name__ == "__main__":

__version__ = "1.0.3"
__version__ = "2.0.0"
__author__ = "https://github.com/northpowered"

ap = argparse.ArgumentParser()
Expand Down Expand Up @@ -37,6 +36,9 @@
if not log_dest:
log_dest = os.getenv("SSLA_LD", "stdout")
try:
from sla.config import config
config.load(args.get("config"))
from sla.sla import Sla
sla = Sla(
config_file=args.get("config"), log_level=log_level, log_dest=log_dest
)
Expand Down
Loading

0 comments on commit a2afdfd

Please sign in to comment.