[Python] Simple APPlication INventory

Skia 437f62888e Tiny fix (le gaulois) 2 years ago
inventory 71c19e9609 Small JSON fix 2 years ago
static 2823f06099 Add help button with README and refactor some views 2 years ago
templates 437f62888e Tiny fix (le gaulois) 2 years ago
LICENSE 1e6bfc431f Rebase everything for public release 2 years ago
README.md 2823f06099 Add help button with README and refactor some views 2 years ago
__init__.py 1e6bfc431f Rebase everything for public release 2 years ago
app.py 6e4ff40d46 Update JSON dump to get the whole tree. May be useful 2 years ago
requirements.txt 8174e72a44 Update requirements.txt 2 years ago
settings.sample.py eccbde7695 Improve location guessing 2 years ago

README.md

SAPPIN (Simple APPlication INventory)

Purpose

This tool is made to generate a simple inventory of a whole architecture, based on the informations that Nagios/Icinga can provide through Livestatus.

It was designed for SAP ERP, but it can be applied to other similar applications. It still sadly has been tested only with SAP.

Some basic configuration must be done by hand to fit your architecture, then the script tries to fetch all the hosts from Livestatus based on the groups provided, and guesses to which Module/Environment the host belongs.

It has a web-based interface to display the database in a fancy way.

Web interface

The interface is made in four levels:

  • The main page, listing briefly almost everything
  • The detailed modules view, that displays all the informations about a given environment
  • The detailed environment view, that displays all the informations about a given environment
  • The detailed host view, that displays all the informations about a given host

The top-right corner panel allows to perform some operations:

  • Switching the base if there are more than one
  • Updating the last informations with Livestatus. This also reset the missing required extra fields!
  • Search the whole database
  • Access the admin panel where you can:
    • Dump the database extra informations that are not fetchable from Nagios (eg: for backup, or for migration) as a JSON file
    • See where informations are missing in Modules, Environments, and Hosts
    • The admin panel sets automatically the database to the default base (set in the DEFAULT_BASE variable in configuration)

Admin mode

One can switch to admin mode in order to do some basic privileged tasks. This is done by accessing the /admin/ page to get the right cookie.

Once in admin mode the following operations can be done:

  • Deleting a host: this must be made by hand. The script never deletes any information alone.
  • Adding and deleting extra informations to environments and hosts: don't forget to save your changes by clicking Save!
  • (re)Import a JSON file after a crash, migration, or because you lost some informations in the Admin Panel

Installation/Configuration

What follows is useful only for those who want (or have) to maintain an instance of SAPPIN.

Start by copying settings.sample.py to settings.py.
Take exemple from this file to make settings.py to fit your needs. The file should be self-explanatory through the comments.

Don't forget to create the appropriate folders. By default, you need ./data/files/.

To protect the admin mode, just restrict the access to the /getadmin/ URI at a reverse-proxy level, with the ACL you want.
The script does not provide any login capabilities, so it's the only way to restrict permissions, but it's also the most flexible regarding your architecture.

Backups

By default, it may be a good idea to backup the ./data/ folder, since it contains the databases and the uploaded files.
This folder can be changed in the settings in the UPLOAD_FOLDER and the SOURCE_BASE variables. Don't forget the backup the custom folders you set!

License

The MIT License (MIT)

Copyright (c) 2016 Skia

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.