Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MadOrkestra committed Feb 10, 2024
0 parents commit be7e0a1
Show file tree
Hide file tree
Showing 32 changed files with 407 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SERVER PORT
# This exposes the web frontend and the API, make sure you adapt your firewall settings accordingly if needed
# If you need/want SSL and or authentication, this can easily be done via Caddy:
# https://caddyserver.com/docs/quick-starts/reverse-proxy
SERVER_PORT=3008

# LOG FILE
# Absolute path to your Iagon Node logfile. Should end with info.log
LOGFILE=/home/username/iagon-node-logs/info.log

# NODE BINARY
# Absolute path to your executable node binary
NODE_BIN=/home/username/iagon-node/./iag-cli-linux
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Mad Orkestra (mad@madorkestra.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# IAG Node Monitor
Web Frontend to monitor the status and base metrics of your Iagon Storage Node CLI.

Iagon is a decentralized Web3 cloud storage provider on Cardano: https://iagon.com/

![Image Screenshot](screenshots/GF8PrhNWQAECPc4.jpg )


## Requirements
- Iagon Storage Node CLI
https://github.com/Iagonorg/mainnet-node-CLI

- NodeJS v18+
https://nodejs.org

# Installation
- Download the latest release from https://github.com/MadOrkestra/iagon-node-monitor/releases

- Unzip on the machine where your Iagon Node CLI is running
- Enter the directory and run `npm install`

- Add a free server port and paths to the Node CLI binary and the info.log to the .env.example file and rename it to .env

- Run `node server.js` in the monitor directory to start the the monitoring server

## Optional - Run persistent with PM2
To start the monitor on startup/after reboot, here is how to do this with PM2 (https://pm2.keymetrics.io/):
- run `npm install pm2 -g` to install PM2
- run `pm2 startup` and follow the instructions to start PM2 on boot
- run `pm2 start server.js` in the monitor directory to start it
- run `pm2 save` to save your configuration

## Optional - SSL / Authentication
If you want to install the frontend as standalone Web App or need SSL / Authentication, Caddy is probably the easiest way: https://caddyserver.com/docs/quick-starts/reverse-proxy


# How to use

Open a webbrowser at http://[*IP of your Node*]:[*Server Port*] - that's it. If you run it with SSL (see above), you can install it as standalone web app. The interface is pretty straight forward and shows Node status, Bandwidth data, Read/Write speeds, errors over time and the Node logfile.

- Shortcuts
- `L` to open the logfile view
- `Escape` to close it
- Logs are pulled automatically from the logfile every 5 minutes
- Status is checked every 60 seconds


# Notes / Known Issues
- Depending on the size of your logfile this might take a while to startup. For performance reasons pings and ping requests are not shown in the logview.

- If you are running your Node on a public server, make sure to adapt your firewall settings accordingly or add authentication

- Not all errors displayed in the monitor need your attention, some are only of interest to Iagon. Check the logview for details.

- The charts get cluttered if your Node has been running for a while. Updating soon.

- This has a bunch of workarounds to get the infomation out of the Node and output it correctly, so it will most likely break after a Node update if Iagon decides to make changes to their logs.

- Tested on Ubuntu 22.04.3 LTS and MacOS Ventura. Other Linux distros will most likely work, but if you are running your Node on Windows, you'll have to figure it out on your own (please drop me a DM how it goes)

# What else?

I created this out of personal necessity and will keep updating it as long as I run my own Node. If you like it, feel free to send some ADA or IAG to my wallet at $madorkestra (https://handle.me/madorkestra) to keep me motivated.

Enjoy!
26 changes: 26 additions & 0 deletions lib/helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import path from "path";
import { readdir, stat } from "fs/promises";
import { exec } from "child_process";

const dirSize = async (directory) => {
const files = await readdir(directory);
const stats = files.map((file) => stat(path.join(directory, file)));

return (await Promise.all(stats)).reduce(
(accumulator, { size }) => accumulator + size,
0
);
};

function execShellCommand(cmd) {
return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
if (error) {
console.warn(error);
}
resolve(stdout ? stdout : stderr);
});
});
}

export { dirSize, execShellCommand };
16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "iagon-node-monitor",
"version": "0.3.0",
"description": "",
"main": "index.js",
"type": "module",
"keywords": [],
"author": "Mad Orkestra (mad@madorkestra.com)",
"license": "MIT",
"dependencies": {
"compression": "^1.7.4",
"cors": "^2.8.5",
"dotenv": "^16.4.1",
"express": "^4.18.2"
}
}
1 change: 1 addition & 0 deletions public/_app/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const env={"PUBLIC_API":"/api"}
1 change: 1 addition & 0 deletions public/_app/immutable/assets/0.dmjwYnvx.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/_app/immutable/assets/2.TFHM3M9J.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/_app/immutable/assets/_layout.dmjwYnvx.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/_app/immutable/assets/_page.TFHM3M9J.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/_app/immutable/chunks/entry.Y_rNbAtn.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/_app/immutable/chunks/index.E7Qtlpdg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/_app/immutable/chunks/index.Prhg8isu.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit be7e0a1

Please sign in to comment.