Braintacle is hosted at https://github.com/hschletz/Braintacle.
Braintacle is a set of applications for managing hard- and software on a network. Braintacle keeps a semi-automatic inventory of computers, other network-connected devices and installed software, and provides a generic infrastructure for downloading files and executing commands on selected clients, allowing centralized software updates, remote configuration and more. For developers, a PHP API is provided to access the inventory and control the applications.
The application consists of several parts:
Braintacle does not implement different access privileges.
Braintacle allows editing existing packages. More precisely, by clicking on the name of a package you invoke the package builder with the old package's metadata already filled in. The package content itself does not get copied to the new package, so you have to upload a file again. This limitation is OK for the typical scenario where you deploy a new software version, so you would have to upload a new file anyway.
After the new package has been successfully built, it will optionally be deployed to clients which already had the old package marked for deployment. Then the old package is deleted. For this reason, the new package needs a different name (typically a different version number appended) because for a brief period of time, both packages exist and package names have to be unique. If anything goes wrong with building the new package, the old package will not be touched.
If you want to deploy a single file, having to wrap it into a ZIP archive before uploading can be annoying. Braintacle creates the archive on the fly if the uploaded file is not a ZIP archive (currently only implemented for Windows packages). Since the PHP Zip extension's capabilities are limited and ressource usage can grow high for huge files, you can bypass this feature by creating the archive manually before upload.
The original GUI allows specifying both the number of fragments and the fragment size. Changing one value automatically affects the other. Braintacle simplifies this process a bit, assuming that you don't want to have a package to have a particular number of fragments, but any number of fragments up to a certain size. You only specify the maximum fragment size (a default can be provided). The actual size may be lower because Braintacle splits the package into evenly-sized fragments up to the given limit.
Since the maximum fragment size is not stored anywhere (except for the default which may not apply to existing packages), it has to be estimated upon editing. The result will almost certainly be different from the original value, but still about the same magnitude. In particular, it would deliver the same number of fragments if the size of the new file had not changed.
Braintacle supports only 1 download server. This simplifies not only the code, but also the workflow. If ressource usage is a problem on your server, you should consider solving the problem outside the application. For example, you could force usage of a caching proxy on external sites or set up a load balancer. Once set up this may be easier to handle than having to deal with this everytime you build a new package.
The limitation to 1 download server allows package creation and activation to be merged into a single step. The download locations must be specified at build time, where defaults can be provided.
OCS Inventory provides a function called "software dictionaries" where pieces of installed software can be tagged to be ignored. This is intended for interaction with GLPI. The OCS Inventory console only provides an interface to define these lists, but does not make use of it.
The Braintacle console makes use of this list and does not display any software which is tagged to be ignored. There is an option to display all software anyway. Note that the database format for this list has changed and is no longer compatible with GLPI.
Some software (like MS Office 2007) causes multiple identical entries in a client's inventory. These duplicate entries are hidden by default, but can be shown with a single mouseclick if you are really interested.
Braintacle uses a different method to determine which network a client belongs to. In particular, it takes the netmask into account (for example, 192.168.0.0/16 is different from 192.168.0.0/24) and also ignores 127.0.0.0/8 completely as this is not a real network. Additionally, interfaces belonging to an inventoried client will never show up as unknown, even if the inventory is out of date.
Multiple packages can be deployed to a client at once instead of picking them one by one. This is particularly convenient for fresh installs where a lot of packages have to be installed.
The list of installable packages does not contain already installed packages, which would only end up with ERR_ALREADY_SETUP. If a package is not in the list, it would not be installable anyway. This also keeps the list as short as possible.
Braintacle supports a blacklist for asset tags, in addition to serials and MAC addresses.
The information to be merged can be specified in detail:
The braintacle-tool.php script provides some functions that are not provided by the web console. Available commands are listed when invoking the script without arguments. Help for individual commands is availabe via
braintacle-tool.php help <command>
A non-default config file can be set via the --config
command line
option or the BRAINTACLE_CONFIG environment variable. If not set, the default
file config/braintacle.ini is used. If both are set, the command line
option takes precedence.
The "database" subcommand is used to manage the database schema as part of the installation and upgrade process as described in INSTALL.md. There is an optional parameter for the log level (default: info):
--loglevel=emerg|alert|crit|err|warn|notice|info|debug
By default, obsolete tables and columns are only dropped if they would block the upgrade otherwise. A warning is issued for other obsolete tables and columns. The --prune or -p option will unconditionally drop these objects too.
The "export" subcommand exports all clients in the database to a given directory. It will generate 1 XML file per client. The generated files can optionally be validated via the --validate or -v switch.
The "import" subcommand imports the client from the given file (compressed or uncompressed XML). It is equivalent to the "Import" button in the console.
The "build" subcommand creates a package from the command line. This is useful if a file is too big to be uploaded to the webserver. It can also be used as part of a package builder script.
It is limited to the package builder defaults. Only the name and the file itself can be specified.
Don't forget to change permissions/ownership of the generated directory and files.
Otherwise the webserver won't be able to read and/or delete them.
You could also use su
to run this script with the UID of the webserver:
su -c 'php braintacle-tool.php build PackageName install-Package.exe' www-data
The "decode" subcommand decodes a compressed inventory file as created locally by some agents. It takes the file name as argument and prints the uncompressed XML data on the console or writes it to a file given by an optional second argument.
PHP 7 and the zlib extension are required for this tool.
The "apidoc" subcommand generates/updates the API documentation in the doc/api directory.