Added a readme, and made the script not depend on a hardcoded install dir

This commit is contained in:
Erik Thuning 2024-03-19 16:58:05 +01:00
parent b6d0ceae97
commit de5e7f2e45
4 changed files with 27 additions and 17 deletions

25
README.md Normal file

@ -0,0 +1,25 @@
# Netmonitor - track routers, switches and clients on a network
This script maps the active client devices in a network, by talking to
the router and switches. Each client is tracked by MAC address, VLAN and
network outlet.
## Configuration
- `router.conf`
Contains the name or IP address of the router. Only one allowed.
- `secret.conf`
Contains the snmp secret used to authenticate with the router.
- `switches.conf`
Lists the names or IP addresses of switches to be monitored,
one per line.
- `vlans.conf`
Lists the VLAN numbers to be monitored, one per line.
When reading `switches.conf` and `vlans.conf`, the script ignores
everything after the first word on each line, so each item can be
commented:
```
some.switch.example the switch under my desk
another.switch.example the other one
```

@ -1,9 +1,9 @@
#!/bin/bash
set -e
cd /opt/netmonitor
cd "$(dirname "$(readlink -f "$0")")"
router="nod-gw1.su.se"
router="$(cat ./router.conf)"
switches="./switches.conf"
vlans="./vlans.conf"
logfolder="/var/log/netmonitor"

@ -1,10 +0,0 @@
nodhk06-p3-1.local.su.se
nodhh01-p3-1.local.su.se
nodhj01-p3-1.local.su.se
nodhm01-p3-1.local.su.se
nodhe01-p2-1.local.su.se
nodhd01-p2-1.local.su.se
nodhf01-p2-1.local.su.se
nodhc01-p0-1.local.su.se
nodhb01-p0-1.local.su.se
nodhg01-p2-1.local.su.se

@ -1,5 +0,0 @@
201 studentnät 177.*
758 pi-nät svart
401 servernät 161.*
157 servernät 157.*
158 personalnät 158.*