The new reporting system was implemented to address a number of deficiencies in the previous system. By storing statistics data in a relational database, we are now able to view and analyze more information about the state of the configuration, including information about previous configuration. Specific features in the new system include:
There is a known issue when using an sqlite database on an ext4 filesystem. You will want to remount the filesystem without barriers (-o barrier=0) in order to speed up the operations of the database. For more information, please see http://phoronix-test-suite.com/pipermail/trondheim-pts_phoronix-test-suite.com/2009-March/000095.html.
Be sure to include the specified fields included in the example bcfg2.conf file. These can be specified in either /etc/bcfg2.conf, if it is readable by the webserver user, or /etc/bcfg2-web.conf. Any database supported by Django can be used. As of version 1.3, South is used to control schema changes. If your database is not supported by South, any updates will need to be applied manually. Sqlite is configured by default. Please see the database section to configure alternative databases.
If you are using an sqlite database, the directory containing the database file will need to be writable by the web server. The reason for this is that sqlite will create another file for its journal when it tries to update the database file.
Distributed environments can share a single remote database for reporting.
After configuring your database be sure to run bcfg2-admin reports init to create the schema.
To enable statistics collection in the bcfg2-server, add Reporting to the plugins line in your bcfg2.conf and restart the bcfg2-server. A report collecting daemon should be run to import the collected statistics into the backend. Please see the section Report Collector for more information.
Detailed installation instructions can be found here.
Reports no longer needs to be installed at the root URL for a given host. Therefore, reports no longer require their own virtual host.
In order to make this work, you will need to specify your web prefix by adding a web_prefix setting in the [statistics] section of your bcfg2.conf.
When running with SELINUX enabled, you can have potential problems with the WSGISocketPrefix. One solution that works without too much trouble is modifying your prefix so that it is located in a standard location:
An example site config is included below:
<IfModule mod_wsgi.c> # # Read an alternate configuration file # # SetEnv BCFG2_CONFIG_FILE /etc/bcfg2_testing.conf # # If the root is changed update the static content alias as well # WSGIScriptAlias /bcfg2 "/usr/share/bcfg2/reports.wsgi" WSGISocketPrefix run WSGIDaemonProcess Bcfg2.Server.Reports processes=1 threads=10 WSGIProcessGroup Bcfg2.Server.Reports # # Manually set this to override the static content # #SetEnv bcfg2.media_url /bcfg2/site_media/ # # This should have the same prefix as WSGIScriptAlias # Alias "/bcfg2/site_media/" "/usr/share/bcfg2/site_media/" <Directory "/usr/share/bcfg2/site_media/"> Options None AllowOverride None order deny,allow deny from all allow from 127.0.0.1 </Directory> </IfModule>
This configuration is suitable for use with the default installation from an RPM or deb package.
At this point you should be able to point your web browser to http://localhost/bcfg2 and see the new reports.
Convert database config
Beginning with 1.3 the database configuration moved from [statistics] to [database] in bcfg2.conf and bcfg2-web.conf. The old settings will be accepted but a deprecation warning will be displayed.
Replace the DBStats plugin with the Reporting plugin.
The reporting schema is now managed using South instead of a set of custom scripts. This creates the new schema and imports all of the historic data to the new format.
After the database is upgraded all of the old tables are left intact. To remove them any table starting with reports_ can be dropped.
Add “transport = LocalFilesystem” under “[reporting]” in bcfg2.conf. Restart the bcfg2-server and start the bcfg2-report-collector.
Most of the configuration is handled through the /etc/bcfg2.conf or alternatively /etc/bcfg2-web.conf.
An example using the defaults is listed below:
[database] engine = sqlite3 name = '/var/lib/bcfg2/etc/bcfg2.sqlite' user = password = host = port = [statistics] config = /etc/bcfg2-web.conf time_zone = web_debug = False [reporting] transport = DirectStore web_prefix = file_limit = 1m
If you choose to use a different database, you’ll need to edit /etc/bcfg2.conf. These fields should be updated in the [database] section:
If mysql is used as a backend, it is recommended to use InnoDB for the storage engine.
A transport is required to pass the data collected from the bcfg2-server to the bcfg2-report-collector. At the time of this writing two transports are available:
Future transports will allow multiple servers to pass data to a single or multiple bcfg2-report-collector processes. New installations default to and should use the LocalFilesystem transport. Upgrades will use DirectStore by default in the 1.3 release.
If DirectStore is used, the bcfg2-report-collector process will refuse to run since this method is not compatible with an external process.
This transport uses a single redis instance for communication between bcfg2-server and bcfg2-report-collector. Multiple servers can write to a single redis instance and multiple report collectors may be run as well.
An example configuration with the default values:
[reporting] transport = RedisTransport redis_host = 127.0.0.1 redis_port = 6379 redis_db = 0
bcfg2-admin commands operate slightly differently in this mode. Instead of querying the database directly, rpc commands are issued to the report collectors. This only affects the minestruct and pull commands.
At the time of this writing the version of python-redis in EPEL is too old to use with this transport. Current versions of the python-redis package require python >= 2.5.
This section does not apply when the DirectStore transport is used.
The bcfg2-report-collector gathers statistics from the bcfg2-server process and records them in the backend database.
Options are similar to the bcfg2-server daemon:
-D <pidfile> Daemonize process, storing pid -o <path> Set path of file log -h Print this usage message -E <encoding> Encoding of cfg files -W <conffile> Web interface configuration file -Q <repository path> Server repository path -C <conffile> Specify configuration file --version Print the version and exit -d Enable debugging output -v Enable verbose output
The bcfg2-report-collector is not set to start by default
The bcfg2-admin tool provides management and maintenance capabilities for the reporting database. A few useful Django commands are provided as well.
bcfg2-reports allows you to retrieve data from the database about clients, and the states of their current interactions. It also allows you to change the expired/unexpired states.
The utility runs as a standalone application. It does, however, use the models from /src/lib/Server/Reports/reports/models.py.
A number of different options can be used to change what bcfg2-reports displays:
Usage: python bcfg2-reports [option] ... Options and arguments (and corresponding environment variables): -a : shows all hosts, including expired hosts -b NAME : single-host mode - shows bad entries from the current interaction of NAME -c : shows only clean hosts -d : shows only dirty hosts -e NAME : single-host mode - shows extra entries from the current interaction of NAME -h : shows help and usage info about bcfg2-reports -m NAME : single-host mode - shows modified entries from the current interaction of NAME -s NAME : single-host mode - shows bad, modified, and extra entries from the current interaction of NAME -t NAME : single-host mode - shows total number of managed and good entries from the current interaction of NAME -x NAME : toggles expired/unexpired state of NAME --badentry=KIND,NAME : shows only hosts whose current interaction has bad entries in of KIND kind and NAME name; if a single argument ARG1 is given, then KIND,NAME pairs will be read from a file of name ARG1 --modifiedentry=KIND,NAME : shows only hosts whose current interaction has modified entries in of KIND kind and NAME name; if a single argument ARG1 is given, then KIND,NAME pairs will be read from a file of name ARG1 --extraentry=KIND,NAME : shows only hosts whose current interaction has extra entries in of KIND kind and NAME name; if a single argument ARG1 is given, then KIND,NAME pairs will be read from a file of name ARG1 --fields=ARG1,ARG2,... : only displays the fields ARG1,ARG2,... (name,time,state,total,good,bad) --sort=ARG1,ARG2,... : sorts output on ARG1,ARG2,... (name,time,state,total,good,bad) --stale : shows hosts which haven't run in the last 24 hours