diff --git a/conf/prometheus_config.yml b/conf/prometheus_config.yml index 3350402..4221452 100644 --- a/conf/prometheus_config.yml +++ b/conf/prometheus_config.yml @@ -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 @@ -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 diff --git a/conf/snmp_config.yml b/conf/snmp_config.yml index 741b8a0..295da01 100644 --- a/conf/snmp_config.yml +++ b/conf/snmp_config.yml @@ -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 diff --git a/src/mikromap-cli/go.mod b/src/mikromap-cli/go.mod index 8d8f2a1..db241cf 100644 --- a/src/mikromap-cli/go.mod +++ b/src/mikromap-cli/go.mod @@ -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 ) diff --git a/src/mikromap-cli/main.go b/src/mikromap-cli/main.go index a212c9d..a58fe7c 100644 --- a/src/mikromap-cli/main.go +++ b/src/mikromap-cli/main.go @@ -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, @@ -399,7 +399,11 @@ 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) @@ -407,7 +411,11 @@ func removeRouter() { // 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") @@ -415,7 +423,11 @@ func removeRouter() { // 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")