Recently, I encountered a situation where I needed to gather crucial information from multiple systems within an Openstack environment during boot time. To tackle this challenge, I decided to develop a simple and efficient solution using Python and the Flask web framework. In this article, I will guide you through the creation of a Python Flask App that effectively collects the necessary data from various systems in Openstack.

Before we dive into the implementation details, let’s briefly discuss the importance of gathering information during the boot process. When launching instances in an Openstack cloud, it is essential to retrieve specific details from each system for further configuration and deployment purposes. This information may include network settings, security configurations, software installations, and more. By obtaining this critical data during the boot phase, we can ensure that the instances are provisioned with correct and relevant information, minimizing post-deployment errors and manual configurations.

The project can be found on Github here:

GitHub – braindonors/systeminfocollector: Tool to capture System Information from Windows and *nix hosts and store it in a database(opens in a new tab)

Tool to capture System Information from Windows and *nix hosts and store it in a database – GitHub –

Feel free to contribute to this, as I’d like to see it be used in creative ways,

Keep in mind, that I purposefully DID NOT include or spend time on the UI Aspect.

— From Git Hub —

Sysinfo Python app to store system data in a python database

Usage:

Start in Docker or via Apache web (Both of these need additional configuration which I haven’t built out yet.

from the app folder:

system: ~$ cd ./systeminfocollector
system: ~/systeminfocollector$ pip install -r requirements.txt
system: ~/systeminfocollector$ python3 ./app.py

Primary usage:

curl http://webserver/sysinfo.sh | bash 

curl http://webserver/sysinfo.py | python3 

PS> iex (iwr "http://webserver/sysinfo.ps1").Content

  • Either will work with their respective operating systems
  • you can even wrap the commands in an SSH session or command:
  • ssh root@system -C ‘curl … ‘
  • Internally, the app generates the python file with the correct url to post the data to, the bash version does the same, except encodes the python script as base64 and injects it into a bash wrapper.

the script will prefer that dmidecode is on the system, but will not install it if missing.


Discover more from Christine Alifrangis

Subscribe to get the latest posts sent to your email.

Leave a Reply