• A Firm Beginning

    Blaine Murphy12/26/2017 at 16:02 0 comments

    I had some time this week to write the initial firmware for the NETCON indicator. I used an Arduino Nano clone I bought long ago and a handful of LEDs to hack up a prototype for testing the code. The test hardware is really basic (LEDs driven directly by GPIO without current limiting resistors) but allowed me to get some software working. The hardware currently consists of one LED per illuminated number and one LED for the NETCON label. The picture below is actually short one LED because I had a very limited supply in my junk box.

    I decided to use an Arduino clone because I had one on hand, but I decided against using the Arduino "IDE" and flavor of C++. Instead I wrote the firmware in C targeting the ATmega328P and the AVR-GCC toochain. Programming for a single IC makes the firmware less portable to other micros, but I'm using this project as an excuse to get more familiar with low-level hardware programming and C so that isn't really a concern of mine. The source for the firmware is available on GitHub.

    The operation of the device is very simple. Single character commands are issued from the host computer to the indicator via a 9600 baud serial connection over USB. ASCII characters are used for commands to make debugging and testing easier when using a serial terminal. The following is a table of the commands currently accepted by the firmware:

    1-5Turn on the NETCON label and the specified number
    oTurn off all LEDs
    tTurn on all LEDs for 1 second (test mode)

    On powerup the "t" command is executed to provide a power-on test of LEDs. The device expects periodic updates from host software. If a command is not recieved within 30 seconds of the previous command then the "o" command will be executed causing all LEDs to be turned off. This is a failsafe that signals a communication issue with the host and is intended to prevent a stale status from being displayed if the host software crashes.

    The next phase of the project is probably going to be the most fun. Once I get some LEDs in the mail I'll start working on building the physical indicator and implementing a proper circuit for driving LEDs. Now comes the hardest part: waiting on parts to arrive.

  • Scraping for Bruises

    Blaine Murphy12/18/2017 at 14:48 0 comments

    I recently started a new job where good network health is very important. My employer provides various services to a large number of sites that are monitored at a central location. There are several indicators of device status available in the facility, but no single score for overall network status.

    In the past week I had some down time so I wrote a small Python script that scrapes the web interface of the in-house network monitor and calculates a cumulative score for the overall health of the network. I can't publish the scraper script since it is dependent on the organization's monitoring setup and contains protected information, but I can explain how it works:

    The tool I'm scraping assigns a status to each network device. The script extracts statuses of all devices from the scraped page and assigns each status a numeric value. The statuses for all devices are summed and divided by the count of devices times the highest status number to create a weighed score. The score is mapped to a "NETCON" number between 1 and 5 (inclusive) and sent to a serial port as an ASCII numeral.

    The NETCON number uses the same scale as DEFCON and can be counter-intuitive if you're used to working with a severity scale where higher numbers indicate more serious issues. Luckily DEFCON uses somewhat intuitive colors to indicate the severity of each number, so user confusion should be minimized.

    This project will log the design and build of the device that receives the ASCII numeral and displays the according NETCON number. The overall goal is to create a lighted indicator that will quickly notify those monitoring the network of any serious issues or outages.