Skip to content

Commit

Permalink
Merge pull request #25 from bakraw/testing
Browse files Browse the repository at this point in the history
Testing - 2024-06-07 10:25
  • Loading branch information
bakraw authored Jun 7, 2024
2 parents 5122ca2 + 8f6f1bc commit d34922f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions conf/prometheus_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ scrape_configs:
metrics_path: /snmp
params:
module: [global]
auth: [private]
auth: [public_v2] # <---- Modifier pour passer sur 'private' (SNMPv3)
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
Expand All @@ -40,7 +40,7 @@ scrape_configs:
metrics_path: /snmp
params:
module: [mikrotik]
auth: [private]
auth: [public_v2] # <---- Modifier pour passer sur 'private' (SNMPv3)
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
Expand Down
4 changes: 2 additions & 2 deletions conf/snmp_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ auths:
security_level: authPriv
auth_protocol: SHA
priv_protocol: AES
password: {MOT DE PASSE AUTHENTIFICATION} # Remplacer
priv_password: {MOT DE PASSE CHIFFREMENT} # Remplacer
password: admin # <---- Remplacer
priv_password: admin # <---- Remplacer
version: 3
public_v1:
community: public
Expand Down
4 changes: 2 additions & 2 deletions src/mikromap-cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module mikromap-cli
go 1.19

require (
github.com/pborman/getopt/v2 v2.1.0 // indirect
github.com/sethvargo/go-password v0.3.0 // indirect
github.com/pborman/getopt/v2 v2.1.0
github.com/sethvargo/go-password v0.3.0
)
20 changes: 16 additions & 4 deletions src/mikromap-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func addRouter() {
Lat: lat,
Lon: lon,
Adresse: adresse,
Username: username,
Username: strings.ToUpper(username),
Statut: 0,
RTT: 0.0,
Visible: isVisible,
Expand Down Expand Up @@ -399,23 +399,35 @@ func removeRouter() {
// Suppression de l'élément du struct dataRouters puis écriture de routers.json
for i, v := range dataRouters {
if v.IP == addrIP {
dataRouters = append(dataRouters[0:i], dataRouters[i+1:]...)
if i == len(dataRouters)-1 {
dataRouters = dataRouters[:len(dataRouters)-1]
} else {
dataRouters = append(dataRouters[0:i], dataRouters[i+1:]...)
}
}
}
writeJSON(dataRouters)

// Suppression de l'élément du struct dataGlobal puis écriture de global_targets.json
for i, v := range dataGlobal[0].Targets {
if v == addrIP {
dataGlobal[0].Targets = append(dataGlobal[0].Targets[0:i], dataGlobal[0].Targets[i+1:]...)
if i == len(dataGlobal)-1 {
dataGlobal = dataGlobal[:len(dataGlobal)-1]
} else {
dataGlobal[0].Targets = append(dataGlobal[0].Targets[0:i], dataGlobal[0].Targets[i+1:]...)
}
}
}
writePromTargets(dataGlobal, "global_targets.json")

// Suppression de l'élément du struct dataMikrotik puis écriture de mikrotik_targets.json
for i, v := range dataMikrotik[0].Targets {
if v == addrIP {
dataMikrotik[0].Targets = append(dataMikrotik[0].Targets[0:i], dataMikrotik[0].Targets[i+1:]...)
if i == len(dataMikrotik)-1 {
dataMikrotik = dataMikrotik[:len(dataMikrotik)-1]
} else {
dataMikrotik[0].Targets = append(dataMikrotik[0].Targets[0:i], dataMikrotik[0].Targets[i+1:]...)
}
}
}
writePromTargets(dataMikrotik, "mikrotik_targets.json")
Expand Down

0 comments on commit d34922f

Please sign in to comment.