The Node-Red flow was originally setup to provide a URL endpoint that accepts a minimal number of query parameters (e.g. hostname). The flow would then make http requests to the Pi Lab Metric's Node that is powered by Prometheus to retrieve the metrics. The metrics were then formatted and pushed directly to the Pi Lab Twitter feed.
I am now on version 4 of the flow. The latest iteration is completely self contained inside Node-Red. The flow runs every 30 minutes and does
ping checks to ensure that the nodes are online before gathering the metrics for each node and sending out tweets. This allows me to reduce the overhead for each of the nodes in the Pi Lab cluster and have things more centralized.
I have also added an SMS alert node that, after a failed
ping check, sends an email that is then forwarded via text message to my mobile phone using this AT&T feature.
Below is a screenshot of the flow.
I am very impressed with Node-Red. I definitely recommend it for anyone who enjoys coding and automation.
Thanks to some great feedback from r/nodered I have re-factored the flow to use the
joinnode so I can remove the use of flow variables. This should fix the issues I was seeing when a request to the flow would occur before the previous request had completed.
I have updated this blog post with the latest information on this project.
I have added Node CPU temperature checks to alert me if a node has exceeded a configurable threshold.
I have added a new flow that tweets the current average web stats from the Pi Lab Statcounter account.
I have updated the flow to have better formatting of the message payload.
I have added a new flow that tweets a JPEG snapshot of the Pi Lab Live Stream every 30 minutes.
I have added a Current Date/Time node to ensure that the Tweets are unique.
I have downgraded the Node-Red Node to a Raspberry Pi 3 Model B and repurpsed the original Node-Red Node into a Pi Lab Web Cluster production node.