On-Air 2.0

On-Air Light

It has been about 2 years since I have been running the “on-air” light at my house. This is a life saver when working from home. It might have helped this guy on the BBC interview out: The idea is whenever my status in Jabber matches one of the keywords I defined, the light is turned on. Instead of the girls bursting into my office during a call, I can hear them whispering, “shhhh dad is on a call”.

I originally wrote this in python. Since I have be doing all my work in node.js I thought it was time to convert and document the code for others to use. Here is a link to the github repo: https://github.com/bdm1981/onair.

As soon as the Cisco Spark API is ready, I will be updating to support Spark!

web interface
Web Interface
On-Air Light
On-Air Light

Node.js is all fun and games until…

Zabbix PM2 Graph

As many of you know, I have been doing a ton of development. Some for my work at Cisco and some for fun. I like using PM2 to manage my node processes, logging, restarts, etc. As my integrations and bots have started getting more use I became fascinated/addicted with watching the logs for errors.

PM2 Log examle
Here is a snapshot of the logs that were stealing my attention

This was all great until last week, I realized it was really distracting me from my real job! I decided it was time to take these my hobby bots/apps to the next level.

I set out to find a solution that would alert me if a PM2 process reset/stopped, PM2 died, my server went offline as well as capture stack traces if/when a node process threw an exception.  Keymetrics.io  Has an awesome option for this. If you are running node apps in production and are making money with them, this would be an excellent option. Since my apps are mostly running for free, I kept looking. I already have Zabbix set up to monitor the infrastructure for Douglas Automotive and was excited when I found a module was already written for Zabbix to monitor PM2!

Zabbix PM2 Graph
Zabbix PM2 graph displaying node process memory usage

This was fairly painless to configure. I will post some details below. Zabbix has me covered for the process monitoring, server load, resets, etc. But I still needed a solution for stack traces.

There are lots of options out there for capturing and analyzing logs in the cloud. Many of them come with a hefty monthly price tag. After trying a couple options. I decided to use sentry.io, setting up an account and integrating into node was very simple.

Sample stack trace captured by sentry.io

Here is an example of a stack trace from some tests I was doing.

With these two solutions in place, I hope to maintain my sanity and continue to write more code that other people find useful! I am always looking for better ways to do things. If you have a logging/monitoring solution that is better, let me know!

Zabbix Config Detail:

You can find the Zabbix PM2 module here. I am running Zabbix on an EC2 Amazon Linux AMI. The example startup files were written for Debian where Amazon Linux is more like CentOS/RHEL. After lots of trial and error I was able to make the following script work.