Open catsmile100 opened 2 weeks ago
this script is very good and useful! I don't know JS (I mean I understand, but can't write), so I translated it to Python (without Telegram sending part) and use for daily monitoring. Thank you
yes please, the most important thing is the two main functions are still running, node information and node notification
Script Monitor Node Analog link Script : https://github.com/catsmile100/Validator-Testnet/blob/main/Analog/Monitor-Analog.md
This script is designed to monitor the status of a blockchain node and integrate it with a Telegram bot. It utilizes the local IP with port 9944 (default) as a means to fetch information from the node. Here's a more detailed explanation of how this script works:
Fetching Node Information The
getNodeInfo
function is used to retrieve various information from the blockchain node through several HTTP requests using axios. The information retrieved includes:Checking Synchronization Status The
checkSyncStatus
function is used to check if the blockchain node is out of sync. This function callsgetNodeInfo
and comparescurrentBlock
andhighestBlock
to determine if there's a significant difference (>= 10 blocks). If there's a significant difference, it indicates that the node is not synchronized.Sending Telegram Messages The
sendTelegramMessage
function is used to send messages to Telegram users via the bot. These messages can be information about the node status or notifications if the node is not synchronized.Initializing Telegram Bot This part initializes the Telegram bot with the provided token and sets up polling to receive messages. The bot will respond to the /start command from users and display the "INFO" button.
Handler for /start Command This section handles the /start command from users and displays the "INFO" button. When the "INFO" button is pressed, the bot will fetch node information and send it to the user.
Handler for Callback Query This section handles the callback query when the user presses the "INFO" button. It calls
getNodeInfo
and sends the node information to the user.Interval for Checking Synchronization Status This part sets the interval to check the synchronization status of the node every 60 seconds. If the node is not synchronized, the bot will send a message to a specific chat ID to notify that the node is not synchronized.
Conclusion This script allows you to monitor the real-time status of a blockchain node and receive notifications via a Telegram bot. By utilizing the local IP and port 9944, this script can fetch crucial information from the node and deliver it to Telegram users, ensuring that you always have the latest information about your node status.
Motivation
The need to ensure the continuous and optimal operation of blockchain nodes is crucial, especially for systems that rely on real-time data and transactions. In situations where nodes go out of sync, it can lead to significant issues such as data inconsistency, transaction delays, and potential financial losses. Therefore, there is a necessity for a robust monitoring system that can provide timely alerts and detailed information about node status.
Problem Statement
Monitoring blockchain nodes manually is inefficient and prone to human error. Without automated monitoring, detecting issues such as node desynchronization or network connectivity problems can be delayed, leading to extended downtimes and operational inefficiencies. There's a clear need for an automated, reliable, and user-friendly solution to keep track of node health and status.
Suggested Solution
The suggested solution is to implement a script that automates the monitoring process of blockchain nodes and integrates it with a Telegram bot. This script should:
Additional Information
To evaluate this suggestion, consider the following:
This script aims to provide a seamless and efficient solution for monitoring blockchain nodes, ensuring minimal downtime and optimal performance.
source : https://github.com/catsmile100/Validator-Testnet/blob/main/Analog/Monitor-Analog.md https://catsmile.tech/