Check_mk Data Collector
This standalone PHP application collects data managed by check_mk's inventory feature. It synchronizes hardware information with an iTop instance using Synchronization Data Sources.
Collects Server and PC inventory along with Models, Brands, OS Families and Versions.
Connects to iTop via the web interface.
Requires direct (read) access to check_mk's inventory files. This means that it must be run on the machine check_mk is installed on (with adequate permissions). Alternatively, the inventory data files used by check_mk must be copied somewhere the application may access them.
Distinguishing between PCs and Servers must be achieved by manually specifying host name patterns. See Configuration below.
PHP Version 5.3.0
Read access on check_mk's inventory files
Access to the iTop REST service
Extract the contents of the archive.
conf/params.local.xmlwith your iTop credentials.
collectors/params.template.xmland edit the configuration options.
Edit the following parameters in
<itop_url>https://localhost/</itop_url> <itop_login>admin</itop_login> <itop_password>admin</itop_password>
|itop_url||URL to the iTop Application||https://localhost/itop|
|itop_login||User name for connecting to iTop. Must have admin rights for executing the data synchro.||admin|
|itop_password||Password for the iTop account.|
These parameters must also be set in
<default_org_id>Demo</default_org_id> <check_mk_dir>/var/lib/check_mk/inventory</check_mk_dir> <type_mapping type="array"> <pattern>/.*pc.*/PC</pattern> <pattern>/.*srv.*/Server</pattern> </type_mapping>
|default_org_id||The name of the iTop organization under which inventory items should be stored.||Demo|
|check_mk_dir||The directory where the collector should check for inventory data files.||/var/lib/check_mk/inventory/|
|type_mapping||The mapping table which specifies how hosts should
be categorized based on their host name in check_mk. Takes patterns
in the format
The following boolean parameters may be set in
<use_network_hostname>false</use_network_hostname> <skip_gz>true</skip_gz> <skip_dot>true</skip_dot>
|use_network_hostname||Use the host name used on the network by a given
inventory machine instead of using the host name stored it is
stored under in check_mk. Default is
|skip_gz||When looking for inventory files, skip .gz
counterparts if they are found. Default is
|skip_dot||Skip any dotfiles encountered in the inventory
file directory. Default is
collectors/params.template.xmlcontains default values for all configuration items and further documentation on their effects.
It may be useful to give a constant value that should be
assigned to a specific field that isn't otherwise filled by the
collector. This is done in
<default_fields type="hash"> <field_name>field value</field_name> <field_name2>another field value</field_name2> </default_fields>
business_criticityif they are in use. Only fields which both Servers and PCs have should be specified this way.
The data in check_mk is gathered from a variety of sources and thus may not always fit the existing iTop data. A mapping table is used to define how data should be converted to fit in with your needs when the above items are being added to iTop.
In this collector, this applies to Brand, OS Family and OS Version objects.
Mapping tables are edited in
collectors/params.distrib.xml. The file
collectors/params.template.xml, supplied in the
archive, contains examples and further documentation.
<osfamily_mapping type="array"> <pattern>/.*linux.*/Linux</pattern> <pattern>/.*windows.*/Windows</pattern> <pattern>/.*mac os.*/Mac OS</pattern> <pattern>/.*solaris.*/Solaris</pattern> <pattern>/.*bsd.*/BSD</pattern> <pattern>/.*/$1$s</pattern> </osfamily_mapping>
This will map Linux, Windows, Mac OS, Solaris and BSD OS family variations.
<pattern>/.*/$1$s</pattern> will allow the
collector to add any values which don't fit any other patterns to
iTop without manipulating them.
<pattern>/.*/$1$s</pattern>if you want OS Families (or OS Versions or Brands) which are not otherwise defined in the mapping table to be ignored. This is the default behaviour.
The first time the collector is run, the following command is recommended:
php exec.php --configure_only
This will create the Synchronization Data Sources if they don't already exist.
To collect the data without synchronizing with iTop, run
php exec.php --collect_only
This will store the collected data in CSV files in the
data/ subdirectory of the collector - this is useful
for checking the data before it is passed over to iTop. Mapped
values can be checked and mapping tables updated - however, note
that collection should be run again after such changes.
Finally, to perform iTop synchronization with the data collected:
php exec.php --synchro_only
Data collection and synchronization (and data source update/creation if necessary) can be performed in a single step if desired:
While this is simpler, it affords less control over the synchronization process.
More information on running the collector may be found on the itop-data-collector-base page.
Data Collection Reference
Servers and PCs
Servers and PCs have the same data collected about them.
|Field in iTop||check_mk inventory entry|
|name*||The check_mk host name, which is the name of the check_mk inventory data file, or networking host name (see Configuration above)|
|org_id*||Taken from default_org_id in configuration|
|cpu||hardware → cpu → model|
|ram||hardware → memory → total_ram_usable (in MiB)|
|osfamily_id||Mapped using data in either software→os→type or software→os→name using osfamily_mapping pattern list|
|osversion_id||Mapped from software→os→name using osversion_mapping pattern list|
|serial||hardware → system → serial|
|brand_id||Mapped from hardware→system→vendor using brand_mapping pattern list|
|model_id||Mapped from hardware→system→family|
* denotes mandatory fields - the rest can and will be ignored if the relevant data is not present in check_mk without preventing the object from being synchronized.