This script is based on zabbix 2.0 automatic host inventory and on CPU-Z hardware information application
The template included uses active checks. Your zabbix agent must be configured for active checks otherwise the server won't receive any data.
Many thanks to CPUID for creating and keeping cpuz as freeware
Description
The intended usage of this solution is to tune-up the zabbix host inventory capabilities and turn it into something useful. By default zabbix only allows text fields that can only hold a small amount of information and are damn hard to read.
This solutions uses a host script and some hacks in the frontend phps to allow for tables to be displayed. It also makes use of both WMI and cpuz to extract the most relevant information from the host. The following fields are automatically filled by the template:
Name: fqdn name of the host
OS: full name, version, edition of the os and bitness
Hardware (full details): motherboard and bios info, processors info, ram memory info, disks info, volumes info, virtualization roles (h-v supported for now)
Software (full details): installed software (add/remove list), installed roles/services (2008), installed components (2000/2003), active directory roles
Host networks: network adapters info, routing table, persistent routes
This is an example of the type of host information I get now:

Usage
Download the archive, extract the XML template, import it into the frontend and link the hosts to it. Make sure all hosts are configured with "automatic" host inventory. Download both the x86 and x64 versions of the cpuz application (the zips without installation) from their website and rename the executables to cpuz32.exe and cpuz64.exe.
Copy the vbs scripts and the two cpu-z executables to your zabbix agent folder and configure the following line in your zabbix_agentd.conf file, replacing the path in the UserParameter with your zabbix agent installation path, restart the agent.
SSH to your zabbix server and make the following changes to these files:
Optionally, add the following URL to each host in maps: http://zabbix.company.com/hostinventories.php?hostid={HOST.ID} replacing the zabbix.company.com placeholder with your actuall zabbix server address.
Gotchas
The first php file edit is to disable html parsing. This enables the browser to interpret html code literally so we can show tables in the host inventory screen. This is a dirty hack that is applied globally.
If you have some php skills you can easily modify the CForms classes to disable html parsing only for the hosts inventory screen.
The second php edit is to disable the <pre> tag which turns everything between them into plain text. This enables the browser to interpret html code literally so we can show tables in the host inventory screen.
On the first poll, the INV Software and INV Hardware items may receive empty strings. This is normal (details below). To have instant data, just restart the agent again after 2 minutes.
The tables appear empty when using the "black and blue" theme. This is due to my awesome css skills and hopefully a temporary issue. Switch to the default theme and all will be well.
If you have any issues importing this template, please upgrade to zabbix 2.0.1 and php 5.3 or higher.
Update 1
Added windows 2000/2003 installed components to software inventory. Make sure you reimport the template.

Moved software and hardware querying out of process because querying the system could often take longer than 30 seconds, causing the agent to kill the script and return nothing. When zabbix agent receives a request to poll the INV OOP item it starts the zabbix_inv_inventory.vbs script that proceeds to do the following:
Launches zabbix_vbs_logger.vbs with some parameters that tells it to re-execute zabbix_inv_inventory.vbs, attach to the output stream and save everything in the zabbix_inv_inventory.log file.
The logger is launched using wmiprvse.exe, escaping the job object of the zabbix agent. This means that when the initial zabbix_inv_inventory.vbs terminates, the logger survives (it would normally be terminated as part of the job object), queries the system for software and hardware information and saves them to a file.
When zabbix agent receives a request to poll the INV Hardware or INV Software items, it attempts to read the saved file and return the read data. If the saved file does not exist yet, no data is sent. But from the second poll forwards, the file exists and the contents are sent.
This means you always have a maximum of 12 hours delay between the actual querying of the system and the zabbix server getting the data. This may sound bad but it's the only way I can guarantee that the script is not killed because of timeout. If the delay is too big for your taste just edit the interval for the following INV Software, INV Hardware and INV OOP items.
Update 2
CSS Styles are now returned only once, in the INV CSS table styles item which maps to the Secondary POC notes inventory field. Previously css styles were returned in each of the items/fields together with the actual table html data. It seems that the inventory fields have some length restrictions and this should make the strings shorter.
Don't forget to reimport the template. Do restart your zabbix agent twice (with 2 minutes delay in between) to make sure the server gets the latest data immediately.
The template included uses active checks. Your zabbix agent must be configured for active checks otherwise the server won't receive any data.
Many thanks to CPUID for creating and keeping cpuz as freeware
Description
The intended usage of this solution is to tune-up the zabbix host inventory capabilities and turn it into something useful. By default zabbix only allows text fields that can only hold a small amount of information and are damn hard to read.
This solutions uses a host script and some hacks in the frontend phps to allow for tables to be displayed. It also makes use of both WMI and cpuz to extract the most relevant information from the host. The following fields are automatically filled by the template:
Name: fqdn name of the host
OS: full name, version, edition of the os and bitness
Hardware (full details): motherboard and bios info, processors info, ram memory info, disks info, volumes info, virtualization roles (h-v supported for now)
Software (full details): installed software (add/remove list), installed roles/services (2008), installed components (2000/2003), active directory roles
Host networks: network adapters info, routing table, persistent routes
This is an example of the type of host information I get now:

Usage
Download the archive, extract the XML template, import it into the frontend and link the hosts to it. Make sure all hosts are configured with "automatic" host inventory. Download both the x86 and x64 versions of the cpuz application (the zips without installation) from their website and rename the executables to cpuz32.exe and cpuz64.exe.
Copy the vbs scripts and the two cpu-z executables to your zabbix agent folder and configure the following line in your zabbix_agentd.conf file, replacing the path in the UserParameter with your zabbix agent installation path, restart the agent.
Code:
#inventory UserParameter = inventory[*],cscript "C:\Program Files\Zabbix agent\zabbix_inv_inventory.vbs" //Nologo "$1" "$2" "$3"
- Edit /var/www/html/include/classes/class.ctag.php
- Search for addItem function
- Comment the line $value = $this->encode(..)
- Edit the /var/www/html/include/forms.inc.php
- Search for insert_host_inventory_form function
- Copy the line $frmHostP->addRow(...) and comment the original
- Delete the 'pre' argument from the copied line (delete the comma also)
Optionally, add the following URL to each host in maps: http://zabbix.company.com/hostinventories.php?hostid={HOST.ID} replacing the zabbix.company.com placeholder with your actuall zabbix server address.
Gotchas
The first php file edit is to disable html parsing. This enables the browser to interpret html code literally so we can show tables in the host inventory screen. This is a dirty hack that is applied globally.
If you have some php skills you can easily modify the CForms classes to disable html parsing only for the hosts inventory screen.
The second php edit is to disable the <pre> tag which turns everything between them into plain text. This enables the browser to interpret html code literally so we can show tables in the host inventory screen.
On the first poll, the INV Software and INV Hardware items may receive empty strings. This is normal (details below). To have instant data, just restart the agent again after 2 minutes.
The tables appear empty when using the "black and blue" theme. This is due to my awesome css skills and hopefully a temporary issue. Switch to the default theme and all will be well.
If you have any issues importing this template, please upgrade to zabbix 2.0.1 and php 5.3 or higher.
Update 1
Added windows 2000/2003 installed components to software inventory. Make sure you reimport the template.

Moved software and hardware querying out of process because querying the system could often take longer than 30 seconds, causing the agent to kill the script and return nothing. When zabbix agent receives a request to poll the INV OOP item it starts the zabbix_inv_inventory.vbs script that proceeds to do the following:
Launches zabbix_vbs_logger.vbs with some parameters that tells it to re-execute zabbix_inv_inventory.vbs, attach to the output stream and save everything in the zabbix_inv_inventory.log file.
The logger is launched using wmiprvse.exe, escaping the job object of the zabbix agent. This means that when the initial zabbix_inv_inventory.vbs terminates, the logger survives (it would normally be terminated as part of the job object), queries the system for software and hardware information and saves them to a file.
When zabbix agent receives a request to poll the INV Hardware or INV Software items, it attempts to read the saved file and return the read data. If the saved file does not exist yet, no data is sent. But from the second poll forwards, the file exists and the contents are sent.
This means you always have a maximum of 12 hours delay between the actual querying of the system and the zabbix server getting the data. This may sound bad but it's the only way I can guarantee that the script is not killed because of timeout. If the delay is too big for your taste just edit the interval for the following INV Software, INV Hardware and INV OOP items.
Update 2
CSS Styles are now returned only once, in the INV CSS table styles item which maps to the Secondary POC notes inventory field. Previously css styles were returned in each of the items/fields together with the actual table html data. It seems that the inventory fields have some length restrictions and this should make the strings shorter.
Don't forget to reimport the template. Do restart your zabbix agent twice (with 2 minutes delay in between) to make sure the server gets the latest data immediately.



Comment