Coder Social home page Coder Social logo

nanotools / nanonodemonitor Goto Github PK

View Code? Open in Web Editor NEW
139.0 20.0 67.0 3.43 MB

Nano Node Monitor is a server-side PHP-based monitor for a Nano node.

License: GNU General Public License v3.0

PHP 64.98% CSS 20.95% JavaScript 4.67% Shell 0.80% Dockerfile 0.54% Handlebars 8.05%
nano nano-node node monitor nanocurrency nanodev cryptocurrency

nanonodemonitor's Introduction

Nano Node Monitor

GitHub release StyleCI Docker Pulls

Nano Node Monitor is a server-side PHP-based monitor for Nano and Banano nodes. It connects to a running node via RPC and displays it's status on a simple webpage. Being server-side, it does not expose the RPC interface of the Nano node to the public.

Nano Light Nano Dark Banano Light Banano Dark
Light Dark Banano Banano Dark

Docker Installation

Pulling Docker image

sudo docker pull nanotools/nanonodemonitor

Running

Standalone

sudo docker run -d -p 80:80 -v ~:/opt --restart=unless-stopped nanotools/nanonodemonitor

This will create a directory called nanoNodeMonitor inside your home directory with the config.php inside it. Edit it according to your needs and you're good to go!

Docker Compose

  1. Create a directory called nano and go inside it: mkdir nano && cd nano

  2. Create a new file called docker-compose.yml with the following contents (but replace the TAG with a proper version):

version: '3'
services:
  monitor:
    image: "nanotools/nanonodemonitor:TAG"
    restart: "unless-stopped"
    ports:
     - "80:80"
    volumes:
     - "~:/opt"
  node:
    image: "nanocurrency/nano:TAG"
    restart: "unless-stopped"
    ports:
     - "7075:7075"
     - "127.0.0.1:7076:7076"
    volumes:
     - "~:/root"
  1. Nice! Now execute sudo docker-compose up -d to start everything.

  2. Inside your home directory you will find a new directory called nanoNodeMonitor, edit the config.php: cd ~/nanoNodeMonitor

  3. You will have to change the node IP to the name of the nodes Docker container e.g. nano_node_1. Edit the other things as well if you want to.

  4. Done!

Manual Installation

Prerequisites

  • Running Nano Node with RPC enabled (Tutorial)

  • Webserver with PHP 8.0

  • PHP-Curl Module

    sudo apt-get install php-curl

Installation

In your empty webserver directory, e.g. /var/www/html, execute:

git clone https://github.com/NanoTools/nanoNodeMonitor .

If you want it to run a subdirectory remove the . at the end.

In the modules folder, create your own config file by executing:

cp config.sample.php config.php

Usage

You will have to add your node's account to the config file config.php by modifying the following lines. Make sure to remove the // in front of $nanoNodeAccount:

// account of this node
$nanoNodeAccount = 'nano_1youraccountname24cq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';

Official documentation for creating an account on the node via RPC can be found at the following URL:

https://docs.nano.org/running-a-node/voting-as-a-representative/#step-2-setup-representative-account

If you are running a standalone node you might need to modify the IP-address and the port for the RPC in the file config.php. It should match the corresponding entries in ~/Nano/config.json, e.g.

// ip address for RPC (default: [::1])
$nanoNodeRPCIP   = '127.0.0.1';

// ip address for RPC (default: 7076)
$nanoNodeRPCPort = '7076';

Creating a Theme

If you're interested in creating your own theme in addition to the official Light, Dark, and Banano themes, we've made it very simple for you to do so. Check out the Wiki for more info.

Support

Donations to the development of Nano Node Monitor are very welcome to:

nano_1ninja7rh37ehfp9utkor5ixmxyg8kme8fnzc4zty145ibch8kf5jwpnzr3r

Or sponsor the development on GitHub! Thanks!

nanonodemonitor's People

Contributors

alexreyne avatar arranharty123 avatar bitdesert avatar crcarlo avatar darrenalex avatar dbachm123 avatar guilhermelawless avatar joohansson avatar jromero avatar justdmitry avatar laurentiu-andronache avatar matrixpna avatar meltingice avatar nbeard49 avatar nifni avatar otahirs avatar sebrock avatar steamrunner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nanonodemonitor's Issues

Installation Directory

To update and execute git pul it is instructed to switch to the Installation Directory. I'm not sure which directory that is. Any more specific directions?

Thanks

Shawn

Fit everything without scrolling

Is it possible to fit everything in standard resolution on screen without having to scroll? I enjoy the new layout done by BitDesert, but it would be great to not have to scroll to see all the data.

Division by zero in functions.php

From apache error log:

[Mon Nov 05 14:09:44.727164 2018] [php7:notice] [pid 26610] [client 127.0.0.1:33190] PHP Notice: Trying to get property 'count' of non-object in /var/www/monitor/modules/functions.php on line 405
[Mon Nov 05 14:09:44.727263 2018] [php7:warn] [pid 26610] [client 127.0.0.1:33190] PHP Warning: Division by zero in /var/www/monitor/modules/functions.php on line 417

Wrong system load

Maybe I understand the load wrong but my show 1.7 but my server has a CPU load of 34%. Memory seems to be correct though.

Delegators not updating

I don't think my delegator count has updated in at least a week. I realize this is likely a Ninja issue, but wondering if there can be a config option to hit your own node on some frequency for the delegator RPC call? I know it's a heavy call so perhaps not on by default, but I would make the choice to have my node do it say every four hours.

api.php opens the Nano node itself to DDoS attacks

Because api.php doesn't offer any kind of caching layer between the public web and the node RPC, it would be pretty easy to overload the Nano node by DDoS'ing /api.php.

At a quick glance, each run of api.php makes 5 RPC calls, so even at a mild 200 requests per second to api.php, we're hitting the Nano RPC at 1000 times/second. I haven't tested it personally but that is a substantial load that I'm not sure it could handle. If you're able to gather even a portion of the nodes running nanoNodeMonitor, you could probably take down a nice chunk of the network via simple HTTP DDoS attacks.

Github rate limit

When running nanomonitor I'm getting through the max allowed of 60 requests for unauthorized api attempts rather quickly, my guess is the version check when others are polling the nanonodemonitor api.

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 21
X-RateLimit-Reset: 1538819471

Convert favicon to PNG for wider support

Currently the favicon is being generated with the following HTML:

<link rel="icon" href="static/img/nano-mark-light.svg">

Note that while the SVG format for favicons is supported by Firefox, it is not supported by Chrome.
See https://caniuse.com/#feat=link-icon-svg.

The following screenshot shows Chrome tab on top, Firefox tab on bottom:

screen shot 2018-09-30 at 11 33 37 pm

Please consider converting the favicon to PNG until browser support for SVG expands. Those of us who use Chrome for dev tools and keep a lot of tabs open would appreciate it. 👍

nginx error.log from /modules/functions.php

2018/04/13 14:09:45 [error] 87735#87735: *11480 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined variable: monitors in /var/www/html/monitor/modules/functions.php on line 189
PHP message: PHP Notice: Undefined property: stdClass::$ in /var/www/html/monitor/modules/functions.php on line 189
PHP message: PHP Notice: Trying to get property of non-object in /var/www/html/monitor/modules/functions.php on line 189" while reading response header from upstream, client: 98.188.54.10, server: 104.42.100.72, request: "GET /monitor/api.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.1-fpm.sock:", host: "rep.nanoisfast.com", referrer: "http://rep.nanoisfast.com/monitor/"

Suggestion for feature: Add QR code

I am new to this but had an idea that may be a good feature of the monitor to help decentralize the network for Nano - I have noticed that while the default monitor lists the wallet address it does have some room at the top of the page that could possibly accommodate a q.r. code also, With the Mobile wallets from Canoe and Nano coming out with QR scanner capabilities to change reps, It may not be a bad idea to incorporate showing the QR code for the Node to allow an easy way to help decentralize the network.

Feature Idea: local block count vs total known + time series graphing

It would be great if, in addition to providing "Current Block" count, a third party like https://www.nanode.co/ could be contacted to get the total block count from servers that are up to date. Then an ongoing comparison could be shown, including percentage synced. See added red text in screenshot below.

feature_idea

Secondarily, if the current block count and total block count were both tracked over time they could be represented graphically and their relationship could be easily reasoned about. For example, it could be ascertained whether the local node would ever catch up with the current block count based on how fast the total block count is growing vs how fast the local node is processing blocks. Such graphs could also show spikes of transactions that may cause local node to fall behind temporarily. The data could be stored in LocalStorage of the browser.

As Nano continues to be adopted and more transactions appear on the network, it will become more and more likely that some nodes will fall behind and never reach the end of the current blockchain, thus halting all pending transactions to/from wallets controlled by the node. This will pose a problem for application layer services. Having graphical tools to help manage these situations will greatly improve devops experience.

Thanks for considering.

Php5 / chroot compatibility

[this part is solved]
Hey,
IPv6 doesn't work, if I put in
$nanoNodeRPCIP = '::1';
in the config.php file, it says node isn't running

Missing json_encode and json_decode functions?

Any idea why I get these PHP errors after trying to run NNM?

[10-May-2020 14:24:02 UTC] PHP Fatal error: Uncaught Error: Call to undefined function json_decode() in /var/www/html/nanoNodeMonitor/modules/functions.php:134
Stack trace:
#0 /var/www/html/nanoNodeMonitor/modules/footer.php(33): getLatestReleaseVersion()
#1 /var/www/html/nanoNodeMonitor/modules/Cache.php(27): {closure}()
#2 /var/www/html/nanoNodeMonitor/modules/footer.php(35): Cache->fetch('footer-nano_3kw...', Object(Closure))
#3 /var/www/html/nanoNodeMonitor/index.php(43): include('/var/www/html/n...')
#4 {main}
thrown in /var/www/html/nanoNodeMonitor/modules/functions.php on line 134

[10-May-2020 14:24:18 UTC] PHP Fatal error: Uncaught Error: Call to undefined function json_encode() in /var/www/html/nanoNodeMonitor/modules/functions_rpc.php:6
Stack trace:
#0 /var/www/html/nanoNodeMonitor/modules/functions_rpc.php(35): postCurl(Resource id #14, Array)
#1 /var/www/html/nanoNodeMonitor/api.php(36): getVersion(Resource id #14)
#2 /var/www/html/nanoNodeMonitor/modules/Cache.php(27): {closure}()
#3 /var/www/html/nanoNodeMonitor/api.php(186): Cache->fetch('api-nano_3kwppx...', Object(Closure))
#4 {main}
thrown in /var/www/html/nanoNodeMonitor/modules/functions_rpc.php on line 6

Random Delegators/Uptime display issues

I have noticed that intermittently my uptime will go back to days/hours/minutes and delegators will show 0 (but voting weight still correct). It will usually last between API cache refreshes but then fix itself. Below is a screenshot of incorrect and then fixed:

image

image

Feature Idea: downtime notification

It would be nice if the monitor could show a notification if the node is down as per Ninja standards (hasn't voted in 15 min I believe). This could look similar to the notification that's displayed if your node is not on the latest version.

RPC enabled but connection refused

Hi there,
I followed all the steps, and it all seem to be OK but the curl command which returns:
user@host:~$ curl -g -d '{ "action": "version" }' '127.0.0.1:7076'
curl: (7) Failed to connect to 127.0.0.1 port 7076: Connection refused

instead of
{ "rpc_version": "1", "store_version": "10", "node_vendor": "RaiBlocks 9.0" }
as it should have

what am I doing wrong?

Show Node Location on Monitor Page

Node Monitor page does not show Node Location.
I would suggest adding a 'Location' field underneath 'Hostname' within the System Info table:

image

Table design would need to be adjusted to accommodate the extra row (and match the other two tables); however; I feel Node Location is a key piece of information that deserves a cemented listing.

Support for nano_ address prefix

I'm trying to change my account prefix to "nano_" to facilitate the name change. But it seems to break nodeNinja apis since it only recognizes "xrb_" for now. I'm wondering if you could add support for "nano_" so we can start to move away from "xrb_" and reduce confusion for newbies. Thanks!

index.php gives HTTP ERROR 500

Followed all at best knowledge, node and curl are working, also info.php and other test pages with php are working too.
the very first lines are not working:

<?php
// include config and functions
require_once($_SERVER["DOCUMENT_ROOT"] . '/modules/config.php');
require_once($_SERVER["DOCUMENT_ROOT"] . '/modules/functions.php');
?>

Solved. Came out that "modules" folder did not have 777 permissions.

Directory not empty

git clone https://github.com/dbachm123/phpNodeXRai.git . fatal: destination path '.' already exists and is not an empty directory.
Usually there are already files from nginx there, so better use a subfolder o update README.md

CoinMarketCap text dark/invisible

My node monitor and two others I checked now have the CoinMarketCap widget looking like my screenshot. The text is still there, just a very dark color. The issues is there both in the dark and light theme.

image

How about giving access to the "process_block" RPC function ?

What I'm thinking is we could have an endpoint to permit anyone to process a block to the network, this way users of Nano we'll always have an access to it

something like : Accept 100 process block calls per day as a default setting

We can even go as far as open the generate work with the same vision

How it will be used ?

Randomly pick a node on mynano.ninja ask for work and process the block
it could be added to wallets this way, they will no longer have a point of failure

For exemple if the backend of Natrium go offline it will be a little problem, but if the wallet could back off to a random node it could be amazing

File cache mixed up when several nodes are monitored

I have several different nodes (Nano, Nano Beta, Banano) running on same host. I set up three Node Monitors (different directories, different hostnames etc).

But it seems that all 3 monitor using same directory and files for cache, and all 3 monitors are showing same data (for one of currencies/nodes, last updated).

I known that I may pass cache-dir to cache options, but it seems not good. I think using currency as cache subdirectory is better solution.

Invalid response from api.php

The following response is happening a lot when frequently requesting a monitor url api.php.
The following happened 260 times out of 5700 (24h period). Requesting every 15 seconds.

<br />
<b>Warning</b>:  usort() expects parameter 1 to be array, string given in <b>/var/www/html/api.php</b> on line <b>83</b><br />
<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/var/www/html/api.php</b> on line <b>88</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /var/www/html/api.php:83) in <b>/var/www/html/modules/functions.php</b> on line <b>92</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /var/www/html/api.php:83) in <b>/var/www/html/modules/functions.php</b> on line <b>93</b><br />
{"nanoNodeAccount":"nano_1eph1eg3c8wy1u8p3deq4r95cq5wxidy3ncjtr7q97fu7gzm8aotzfpdq9eso".....<the rest of the json>...

NullCache returns empty results after system restart

After a VPS hard restart, I noticed that the api.php endpoint was returning a plain false and my monitor was empty: https://imgur.com/bSiJiCq

However the node was running normally answering all rpc/cli requests and the config file of the monitor was in place, filled correctly.

I've got no cache set up, so as a quick fix I tried to comment out all the cache lines at the beginning of the api.php file and return the $data object directly to returnJson() to finally get it up and running again.

I didnt have much time to further debug it, but I'll take a look at first chance.
Until then any thoughts are welcome...!

Menu does not appear on mobile

The “hamburger” menu you tap in the upper right to choose the monitor, contribute page, or GitHub does not appear on mobile. That being said, the functionality is there if you tap the right spot. Please see screenshots. This is also the case for the dark theme - I tested that as well.
img_594c4aadcb3f-1
img_594c4aadcb3f-2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.