Will Hallam
ServiceNow Employee
ServiceNow Employee

find_real_file.png

My home on-prem MID server, mounted under my desk

NOTE: the procedures described within are not supported by ServiceNow

Introduction - a Micro-MID?

A key component to the power of the ServiceNow platform is the MID server.  This device is what provides visibility into your IT estate for your instance, be it servers, IoT-enabled devices, network components, etc.  The standard way to deploy a MID into an environment is to provision a bare-metal or virtualized Linux or Windows server, then install the requisite MID package and connect it to your instance.

But what if you want to discover/manage/monitor/orchestrate assets which are in locations not conducive to this approach?  For example, a small business or office, minimally-provisioned remote location, or point-of-sale installation such as vending machines or kiosk-driven commerce ecosystem?  This is the question I set out to answer; my findings are contained herein.

Enter the Pi

The many virtues of the Raspberry Pi (or "RPi") hardware series are a matter of canon at this point.  Their manifold use cases range from smart mirrors, to retro gaming, to media streaming.  Based on that and the fact it runs a Debian-based Linux OS, it seemed a good fit as a micro footprint MID server.  A search of the ServiceNow Community showed a few posts from prior years indicating some activity in that area, which bolstered my cautious optimism.  Upon examining the standard ZIP archive which delivers the Linux MID server, I saw that it included a wrapper binary compatible with the RPi's ARM CPU.  The embedded JRE was only for x86_64, but this did not prove to be a showstopper as there are instructions provided for pointing the MID at an alternative JRE.

Down to Brass Tacks

Here are the steps I followed to get my RPi MID up and running:

  • My RPi config consists of an RPi 3 Model B+ running the current Raspberry Pi OS (32-bit) distribution
    • NOTE: ServiceNow is removing support for 32-bit MID servers with the Rome release; the latest RPi hardware, RPi 4, can run a 64-bit version of Raspberry Pi OS however
  • Visit the MID Server->Downloads page of your instance
  • Click the checkbox next to "Download MID Server as ZIP archive"

find_real_file.png

  • Downloading the Linux ZIP archive
  • Transfer the archive to the RPi
  • Extract the archive to a suitable directory, e.g.
mkdir /opt/mid
cd /opt/mid; unzip /tmp/mid.quebec-12-09-2020__patch4-hotfix1-06-03-2021_06-07-2021_1407.linux.x86-64.zip

  • Move the built-in JRE subdirectory aside (the MID would not connect to my instance until I did this), e.g.
cd /opt/mid/agent;mv jre .hidden-jre
  • Per the ServiceNow documentation (https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/product/mid-server/task/t_InstallAMIDServerOnLinux.html#t_InstallAMIDServerOnLinux), point the MID agent at your local JRE by modifying or adding the following line in /opt/mid/agent/conf/wrapper-override.conf:
wrapper.java.command=/usr/bin/java
  • Create a non-privileged user to run the MID agent, e.g.
useradd midguy
  • Execute /opt/mid/agent/installer.sh and respond to the prompts as you normally would
  • Modify the following entry in the systemd unit file /etc/systemd/system/mid.service to read as follows:
PIDFile=/opt/mid/agent/work/mid.pid
  • Modify the following entry in file /opt/mid/agent/bin/mid.shconf as follows:
SYSTEMD_KILLMODE=control-group
  • Ensure the timezone on your RPi matches that of the instance, as a mismatch may prevent validation of the MID

Conclusion/Next Steps

After following the steps above, my RPi MID registered with my instance and validated successfully.  I did limit the capabilities on it to the following:

  • REST
  • Resolve DNS
  • SOAP
  • SSH
  • SNMP

Thus far I've used it to perform a discovery on the home network in which it lives.  I expect it should function as any other Linux MID, albeit less performant and at a suitably smaller scale.  Some thoughts which have occurred regarding next steps include integration with home automation or possibly some homegrown tie-ins with atypical hardware via the RPi's GPIO header.  I'm also considering taking this MID on the road by adding a 3G/4G modem.

 

NOTE: the procedures described within are not supported by ServiceNow

Comments
tim_broberg
ServiceNow Employee
ServiceNow Employee

I love it!

Tony Chatfield1
Kilo Patron

Excellent job

Will Hallam
ServiceNow Employee
ServiceNow Employee

As a follow-on to the 32-bit deprecation message I saw when first adding the RPi MID, I successfully loaded the same hardware with a 64-bit Ubuntu server image and am now running the MID from that platform.

Version history
Last update:
‎06-28-2021 12:16 PM
Updated by: