Git Product home page Git Product logo

signum-node-health-check's People

Contributors

ohager avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

signum-node-health-check's Issues

script error

When "error" script is not defined as an absolute path, unhandled error is reported:

$ signumhealth -V
1.1.0
$ cat error.sh 
#!/bin/sh

echo "ERROR: $0"
$ signumhealth -n http://localhost:8125 -s error.sh
2022-10-21T19:43:20.702Z
http://localhost:8125 - height: 1071428
https://europe.signum.network - height: 1071655
Node [http://localhost:8125] is 227 block(s) behind of Node [https://europe.signum.network] - syncing...
Signature Check:
http://localhost:8125 - signature (height: 1071428): 87feff6fe0c0086cfbe92a527aa9d0b9e12f2e3cf2b74005fc51a07a646a5908bbbf47f688bf77617b6fdb8e5cbe39ef97933dcc0f769f0dad03b1f4507eb908
https://europe.signum.network - signature (height: 1071428): 7a4781a8bf7fa83161eba1406b85d1ed2faa97048aa43183f63bfb92c798930fd65665fe4b2b28711b64e1bab72e0bd48a788de5074f239bff40e5131322d118
❌ 2022-10-21T19:43:20.748Z Health Check failed Node [http://localhost:8125] is forked from [https://europe.signum.network] - Try popping off to get in sync again
Executing [error.sh Error: Node [http://localhost:8125] is forked from [https://europe.signum.network] - Try popping off to get in sync again]
events.js:377
      throw er; // Unhandled 'error' event
      ^

Error: spawn error.sh ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:274:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn error.sh',
  path: 'error.sh',
  spawnargs: [
    Error: Node [http://localhost:8125] is forked from [https://europe.signum.network] - Try popping off to get in sync again
        at checkNode (/usr/local/lib/node_modules/signum-node-health-check/src/checkNode.js:46:11)
        at processTicksAndRejections (internal/process/task_queues.js:95:5)
        at async /usr/local/lib/node_modules/signum-node-health-check/src/index.js:22:22
  ]
}

Absolute path to the script is passed, it works:

$ signumhealth -n http://localhost:8125 -s "$PWD/error.sh"
2022-10-21T19:43:52.072Z
http://localhost:8125 - height: 1071428
https://europe.signum.network - height: 1071656
Node [http://localhost:8125] is 228 block(s) behind of Node [https://europe.signum.network] - syncing...
Signature Check:
http://localhost:8125 - signature (height: 1071428): 87feff6fe0c0086cfbe92a527aa9d0b9e12f2e3cf2b74005fc51a07a646a5908bbbf47f688bf77617b6fdb8e5cbe39ef97933dcc0f769f0dad03b1f4507eb908
https://europe.signum.network - signature (height: 1071428): 7a4781a8bf7fa83161eba1406b85d1ed2faa97048aa43183f63bfb92c798930fd65665fe4b2b28711b64e1bab72e0bd48a788de5074f239bff40e5131322d118
❌ 2022-10-21T19:43:52.120Z Health Check failed Node [http://localhost:8125] is forked from [https://europe.signum.network] - Try popping off to get in sync again
Executing [/home/ubuntu/signum-node/error.sh Error: Node [http://localhost:8125] is forked from [https://europe.signum.network] - Try popping off to get in sync again]
ERROR: /home/ubuntu/signum-node/error.sh

When error script doesn't have execution right, it fails (in bad way) too:

$ chmod -x error.sh
$ signumhealth -n http://localhost:8125 -s "$PWD/error.sh"
2022-10-21T19:46:12.502Z
http://localhost:8125 - height: 1071428
https://europe.signum.network - height: 1071656
Node [http://localhost:8125] is 228 block(s) behind of Node [https://europe.signum.network] - syncing...
Signature Check:
http://localhost:8125 - signature (height: 1071428): 87feff6fe0c0086cfbe92a527aa9d0b9e12f2e3cf2b74005fc51a07a646a5908bbbf47f688bf77617b6fdb8e5cbe39ef97933dcc0f769f0dad03b1f4507eb908
https://europe.signum.network - signature (height: 1071428): 7a4781a8bf7fa83161eba1406b85d1ed2faa97048aa43183f63bfb92c798930fd65665fe4b2b28711b64e1bab72e0bd48a788de5074f239bff40e5131322d118
❌ 2022-10-21T19:46:12.545Z Health Check failed Node [http://localhost:8125] is forked from [https://europe.signum.network] - Try popping off to get in sync again
Executing [/home/ubuntu/signum-node/error.sh Error: Node [http://localhost:8125] is forked from [https://europe.signum.network] - Try popping off to get in sync again]
events.js:377
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/ubuntu/signum-node/error.sh EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:274:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /home/ubuntu/signum-node/error.sh',
  path: '/home/ubuntu/signum-node/error.sh',
  spawnargs: [
    Error: Node [http://localhost:8125] is forked from [https://europe.signum.network] - Try popping off to get in sync again
        at checkNode (/usr/local/lib/node_modules/signum-node-health-check/src/checkNode.js:46:11)
        at processTicksAndRejections (internal/process/task_queues.js:95:5)
        at async /usr/local/lib/node_modules/signum-node-health-check/src/index.js:22:22
  ]
}

From my point of view, signumhealth should check during start if script is available (it can see it) and that permissions are ok (script is executable). This simple check during start will assure that script will be called when node is in a trouble... Or there should be a new switch to "simulate" trouble, to test that error script is executed....

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.