ICMP monitoring and notification tool (Gmail OAuth)
./host-monitor -ip ip/range -mail [email protected] [-i interval] [-t timeout] [-debug] [-mailTest]
-debug Debug logging -help Show help tooltips -i int Interval in seconds between each check (default 60) -ip value IP range (CIDR or single IP) to monitor - e.g. 192.168.1.1 or 192.168.1.0/24 (can be repeated to specify multiple ip/ranges) -mail string Mail to notify -mailTest Do not send any mail, only try to connect and trigger notifications. -t int Timeout in milliseconds for ICMP (default 1000ms)
Generate credentials for Google OAuth
- Access Google API Console
- Create a new project (or select an existing one)
- Go to OAuth Consent Screen and add a new user using your email
- Go to Credentials and create a new OAuth client ID:
- Application type: Web application
- Authorized Redirect URIs:
- Use the IP of the system that will launch the tool. It can be localhost if the system has a graphical browser (required to login the first time)
- Save the credential and download its JSON as
credentials.jsonin the same folder as its executable
When launching the tool for the first time, it will output a URL that will need to be opened in a browser. It can be opened in another computer if the credential was created with an IP instead of localhost
The URL redirects to Google Auth. After login into the corresponding account and authorizing the app, it will create a token.json and start the app.
Afterwards, the token will be refreshed automatically.
Token.json was removed or any other issues with token verification
If the token is removed, the authorization process will not set up automatic token refresh. To enable it again, the authorization needs to be revoked.
In case of any other errors regarding google auth, the same process applies.
- Access Google Account Security
- Go to Third Party apps -> Manage third-party access
- Remove access to the app
- Repeat the First launch process