This advanced guide will expose Domain of One’s Own administrators to command line interfaces that allow you to generate structured data reports from Installatron. The uses for this range wildly from understanding what software your users are installing to version reporting and other analytics. For the purposes of this guide we will use the Terminal available in WHM, however the same commands can be executed by SSH as root or within any bash script that has root access.
Installatron has a command line interface with a variety of commands that you can run that are documented at Installatron Command-line Interfaces. The primary command that will output all data from all installations is /usr/local/installatron/installatron --installs
Keep in mind that Installatron stores and will expose sensitive data via this command, in particular the database credentials for each install and the layout of files and tables that makeup each install. However the output of the command is huge for even smaller servers, so we need a way to filter the output of this command.
We have a tool installed on each server called jq which is a command line json processor. Because the output from Installatron’s command line interface is json, we can pipe that command to jq to filter and generate interesting reports. You can find a lot of documentation around the filters available with jq at jq Manual (development version) but let’s look at some real world examples within our context.
We can pass a search parameter to Installatron with the -q flag so /usr/local/installatron/installatron --installs --q scalar
will only display information on Scalar installs. Now if we pipe that to jq we can have it count the number of installs like this: /usr/local/installatron/installatron --installs --q scalar | jq '.data | length'
jq defines .data as the top level of the json object and we can not only use the length operator to get the number of items in the object, we can also have it filter and print specific data from each item. Let’s say you want to see a breakdown of the software version of each install for a particular application. The command /usr/local/installatron/installatron --installs --q scalar | jq '.data | .[].version'
will print each software version of Scalar installed on the server.
This allows us to easily identify out of date software. More practically a request we get often is for a list of URLs for all software installs on a particular software. Since Installatron stores the URL as part of the json object this is now a simple one-line query `/usr/local/installatron/installatron --installs | jq ‘.data | .[].url’
Add > file.txt to the end of any command to save the output to a text file for later processing and reporting.
This only begins to cover the surface of what’s possible when using Installatron’s command line interface in conjunction with jq to filter and parse the results and generate the data you need from the server. We’d love to how you might use this data in interesting ways to report on and expose the activity happening in your community.