FireBase

This page is outdated - Firebase was absorbed into Google

Acknowledgement: The scripts described on this page were first created by H. Will Kruse (http://hwillkruse.com/).

You can sign up for a basic FireBase account for free at https://www.firebase.com/. When you create a new application, you will create a URL that points at your data, and you can go to the management page for the application to see that data that is currently stored there, starting of course with an empty database.

To get started, I often look for an example. In this case we create a simple database that keeps track of a list of hosts. For each host we store a current alarm value, so we can highlight hosts that should be looked at. In turn, each host entry contains a list of services and their current status. We then use scripts to populate the database from our hosts, and use a web page to display the data. In a sense, we have created a very simple network monitoring application.

Attached below are two archives with sample file to create this application; each archive contains the same set of files, including this README file:

This directory contains:

profkruse-monitor.json # json-structured data file to initialize the database

Red_Alarm.ps1 # Powershell script that sets the alarm value for the host to "Red"

set_alarm.sh # bash script similar to the script above, set the alarm to a user-defined value

monitor.html # Web page that displays the content of the FireBase database

register_host.ps1 # Powershell script that creates a node in the Firebase database for the host it is cunning on

register_host.sh # Same as above, but as a bash shell script

service_status.ps1 # Powershell script that runs a command to retrieve the status of a service, then stores the

# data in FireBase

service_status.sh # Same as above, as a bash shell script

Use the provided json file to create a set of sample data. Your database should now look something like this:

Next, load the Monitor.html file in a browser (for continued use you would serve this file from a static web server). You should see something similar to:

You can directly edit data in the FireBase dashboard. When you do, the data displayed in the browser will change in real time. (The "Current" value under the "Alarm" node will determine the highlighting of the system name).

Next, examine the sample scripts provided. There are three pairs of scripts:

    1. The "register" scripts will create a new system node in the database

    2. The "service" scripts need to be modified to retrieve a status for the desired service so the script can send the data to FireBase

    3. The "alarm" scripts show how to change the alarm value.

All scripts require that you change the FireBase URL to the one you created.