The Simple Network Monitor (SNM) is a small service to monitor other hosts or network devices. It checks cyclic the availability of certain services. The SNM saves all probes in a database and creates charts out of it.
In all cases the application will be available under http://localhost:8080/, it is possible to access the application from outside by replacing localhost with your hostname or IP address.
Download the Jar file from the Github release page and run the Jar with with following command.
java -jar snm.jar
Requirements:
- Java 8
- Monitor Plugins must be available in the PATH
- nmap must be available in the PATH
Install docker on your system.
Then just run the following command:
docker run -dit --name simple-network-monitor --network host --restart unless-stopped johannesschafer/simple-network-monitor
Run with an persisted H2 db:
docker run -dit --name simple-network-monitor --network host -e "DB_URL=jdbc:h2:/db/snmdb" --restart unless-stopped johannesschafer/simple-network-monitor
This setup is using the network mode host
. No port mapping is needed, it exposes the real network interface directly in the docker container. The reason for this is, that some operations only work correctly when the network interface is not virtual. E.g. the arp
or etherwake
command.
The network mode host
only works correctly on Linux machines. Please use a port mapping on other machines instead, e.g. --publish 8080:8080
instead of --network host
.
docker run -dit --name simple-network-monitor --publish 8080:8080 --restart unless-stopped johannesschafer/simple-network-monitor
There are several setups prepared in the docker-compose directory. Just check out the files from there and run one of the following variants.
h2 db in memory
docker-compose up -d
h2 db in file
docker-compose -f docker-compose.yml -f docker-compose.h2.yml up -d
maria db
docker-compose -f docker-compose.yml -f docker-compose.mariadb.yml up -d
mysql
docker-compose -f docker-compose.yml -f docker-compose.mysql.yml up -d
postgres
docker-compose -f docker-compose.yml -f docker-compose.postgres.yml up -d
Please also check the content of the compose files, there are more options described.
To stop and shutdown a running compose setup just run docker-compose down --remove-orphans
. This also removes all container.
Install docker on your system. A good description can be found here: https://blog.alexellis.io/getting-started-with-docker-on-raspberry-pi/
Then just run the following command:
docker run -dit --name simple-network-monitor --network host --restart unless-stopped johannesschafer/simple-network-monitor-raspi
To persist the database add an -e "DB_URL=jdbc:h2:/db/snmdb"
after the run parameter.
On a Raspberry Pi 1 the startup can take several minutes, but it runs.
It is also possible to use the docker-compose files from docker-compose, just add change the image name of the snm service to johannesschafer/simple-network-monitor-raspi
.
To change the public port, just change the first 8080
to the port number you want.
The following settings can be set externally. By default all settings have useful values for a first test run. For a productive usage these settings should be adjusted.
Name | Description | Commandline | Docker | Default |
---|---|---|---|---|
H2 Console | Enables the H2 console | --spring.h2.console.enabled=... | H2_CONSOLE_ENABLED=... | false |
H2 allow others | Expose the H2 console to other clients than localhost | --spring.h2.console.settings.web-allow-others=... | H2_CONSOLE_WEB_ALLOW_OTHERS=... | false |
DB URL | Database URL | --spring.datasource.url=... | DB_URL=... | jdbc:h2:mem:snmdb |
DB Username | Database username | --spring.datasource.username=... | DB_USERNAME=... | sa |
DB Password | Database password | --spring.datasource.password=... | DB_PASSWORD=... | org.h2.Driver |
DB Driver | Database driver class name | --spring.datasource.driver-class-name=... | DB_DRIVER=... | |
hosts file | The name of the host file to load on startup | --hosts-file=... | HOSTS_FILE=... | hosts.json |
commands file | The name of the command file to load on startup | --commands-file=... | COMMANDS_FILE=... | commands.json |
setting file | The name of the setting file to load on startup | --settings-file=... | SETTINGS_FILE=... | settings.json |
Default Network | This network will be shown in the auto discovery dialog | --defaultNetwork=... | DEFAULT_NETWORK=... | 192.168.178.0/24 |
Unsecure Export | Set this value to true, to export also the passwords | --unsecureExport=... | UNSECURE_EXPORT=... | false |
Hibernate Dialect | --spring.jpa.properties.hibernate.dialect=... | DB_DIALECT=... |
For the file parameters, you can use an export of settings, commands or hosts from the application. The refer such a file set the value like --hosts-file=file:/myHosts.json
.