ZABBIX Forums  

Go Back   ZABBIX Forums > Zabbix Discussions and Feedback > Zabbix Cookbook

Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2012, 10:13
mmarkwitzz mmarkwitzz is offline
Member
 
Join Date: Jan 2011
Posts: 94
Default Complete HP server hardware monitoring ZBX2

This solution is based on zabbix 2.0 api and LLD which is only available in zabbix 2.0

The template included uses active checks. Your zabbix agent must be configured for active checks otherwise the server won't receive any data..

If you are still running zabbix 1.8 or later you can try an older template: http://www.zabbix.com/forum/showthread.php?t=21104

Description

This solutions gives you complete monitoring of HP servers hardware just like you would get in HP SIM, but using zabbix. The template only uses HP WBEM providers and the SMART Array Configuration Utility CLI (not mandatory) so there is no need to install HP SIM or make any SNMP configuration.

The template uses active checks and so it works with servers that are behind NAT, without the need to configure any port forwardings. Finally, this template works on low-end servers like ML110 which have embedded controllers and for which HP SIM is not available.

A complete overview of triggers can be viewed at: http://img820.imageshack.us/img820/8566/overviewic.jpg

You get monitoring for the following:
  • Eventlog entries generated by HP
  • Fans
  • Logical disks
  • Physical disks
  • Management processors (ILO)
  • Memory modules
  • NICs
  • Processors
  • Sensors
  • Smart array controllers

You also get temperature graphs for disks and sensors like so:




Usage

Download the archive, extract the XML template, import it into the frontend and link the hosts to it.

Copy the vbs scripts to your zabbix agent folder and configure the following lines in your zabbix_agentd.conf file, replacing the path in the UserParameter with your zabbix agent installation path, restart the agent.

Code:
#hp discovery
UserParameter = hp.discovery[*],cscript "C:\Program Files\Zabbix agent\zabbix_hp_discovery.vbs" //Nologo "$1"
#hp wbem
UserParameter = hp.wbem[*],cscript "C:\Program Files\Zabbix agent\zabbix_hp_wbem.vbs" //Nologo "$1" "$2" "$3"
#hp system
UserParameter = hp.system[*],cscript "C:\Program Files\Zabbix agent\zabbix_hp_system.vbs" //Nologo "$1"
#eventlog query
UserParameter = eventlog.query[*],cscript "C:\Program Files\Zabbix agent\zabbix_win_eventlog.vbs" //Nologo "$1" "$2"
# allow weird chars in userparameters arguments
UnsafeUserParameters=1
Download the perl scripts to you zabbix server, edit them, specifically the parameters below, and cron them (I personally user cron.hourly).

Code:
        $user = "Admin"; ### username
	$password = "zabbix"; ### password	
        $url = "http://127.0.0.1/api_jsonrpc.php"; ### intenal zabbix url
The scripts connect using $user and $password via json api (so the user needs API access, check that in the frontend) and creates the following graphs for all hosts linked to "HP Server" template.
For a detailed explanation of how the scripts work you can view the following post: http://www.zabbix.com/forum/showthread.php?t=26678
  • HP Sensor "ALL" temperature
  • HP Physical disk "ALL" temperature

Go to http://support.hp.com and get the HP WBEM providers for you server model from the downloads section. After installation you may need to restart your server. If the providers are not properly installed you will get an alert from the HP System Wbem providers not installed trigger.

Go to http://support.hp.com and get the HP Smart Array Configuration Utility and HP Smart Array Configuration Utility CLI for your server model from the downloads section. After installation you must run the Setup HP Array Configuration utility and selec the local application mode.
This step is optional, but allows monitoring the physical disks temperature, if the disk/controller firmware supports it (you can always try to upgrade the firmware).

Gotchas

For best results you can download the whole Product Support Pack and install the most recent software and firmware versions for all components, except the HP SIM Agent which is not needed.

If you are using any other of my templates, make sure your hosts only have one active instance of the WIN Eventlog OOP item. If there is more than one, disable the extra items.
The eventlog triggers send an alert containing information on the most recent events logged. For these to show up in the alert make sure you include the following macros in the alert message:

Eventlog info: {ITEM.LASTVALUE}

If you have any issues importing this template, please upgrade to zabbix 2.0.2 (not released at the date of this post) and php 5.3 or higher.

Update 1

I can confirm that importing templates with Discovery Rules is broken in zabbix 2.0.1 and will be fixed in zabbix 2.0.2.
A partial fix for this, until zabbix 2.0.2 is released, can be achieved by SSH to your zabbix server and making the following changes to these files:
  • Edit /var/www/html/include/classes/import/formatters/C20ImportFormatter.php
  • Search for getDiscoveryRules function
  • Modify the line:
  • if (!empty[$host['discovery_rules'])) {
  • with:
  • if (!empty[$template['discovery_rules'])) {

This will fix importing Discovery rules, item prototypes and trigger prototypes. Graph prototypes importing will still be broken, as they will get imported directly into the template, not in the discovery rules.

Update 2

Fixed a bug which caused the eventlog items to never be populated, by adding a new item in the template. Please download and import again.

Update 3

Decreased eventlog query time to 300s.
Attached Files
File Type: zip hp_server_monitor_zbx2.zip (35.8 KB, 1431 views)

Last edited by mmarkwitzz; 11-07-2012 at 08:22.
Reply With Quote
  #2  
Old 05-07-2012, 17:07
garyozzy garyozzy is offline
Junior Member
 
Join Date: Jun 2012
Posts: 5
Default

I get the following error on import:

Code:
    Created: Application "HP Eventlog" on "HP Server".
    Created: Application "HP Fans" on "HP Server".
    Created: Application "HP Logical disks" on "HP Server".
    Created: Application "HP Management" on "HP Server".
    Created: Application "HP Memory" on "HP Server".
    Created: Application "HP Network" on "HP Server".
    Created: Application "HP Physical disks" on "HP Server".
    Created: Application "HP Power supplies" on "HP Server".
    Created: Application "HP Processors" on "HP Server".
    Created: Application "HP Sensors" on "HP Server".
    Created: Application "HP SmartArray" on "HP Server".
    Created: Application "HP System" on "HP Server".
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    ltrim() expects parameter 1 to be string, array given [api/classes/CItemGeneral.php:326]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:760]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Array to string conversion [include/classes/db/DB.php:394]
    Error in query [INSERT INTO items (name,type,snmp_community,multiplier,snmp_oid,delay,history,trends,status,value_type,units,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,port,description,inventory_link,key_,trapper_hosts,hostid,flags,interfaceid,itemid) VALUES ('HP Eventlog ethernet error','7',Array,'0',Array,'700','1','365','0','4',Array,'0',Array,'0',Array,Array,'1','',Array,Array,'0','0',Array,Array,Array,Array,'0',Array,'0','eventlog.query[system,(source=HP\\sEthernet;type=Error|Warning)]',Array,'10163','0',NULL,26013)] [Unknown column 'Array' in 'field list']
    SQL statement execution has failed "INSERT INTO items (name,type,snmp_community,multiplier,snmp_oid,delay,history,trends,status,value_type,units,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,port,description,inventory_link,key_,trapper_hosts,hostid,flags,interfaceid,itemid) VALUES ('HP Eventlog ethernet error','7',Array,'0',Array,'700','1','365','0','4',Array,'0',Array,'0',Array,Array,'1','',Array,Array,'0','0',Array,Array,Array,Array,'0',Array,'0','eventlog.query[system,(source=HP\\sEthernet;type=Error|Warning)]',Array,'10163','0',NULL,26013)".
Any ideas?
Reply With Quote
  #3  
Old 05-07-2012, 17:17
mmarkwitzz mmarkwitzz is offline
Member
 
Join Date: Jan 2011
Posts: 94
Default

Try updating to 2.0.1 and php 5.3 as is indicated in the first post
Reply With Quote
  #4  
Old 06-07-2012, 11:37
abiboba abiboba is offline
Junior Member
 
Join Date: Jun 2012
Posts: 4
Default Error executing perl script

Hello,

thank you for sharing your great templates.

I tried to setup your script, but i have an error when i manually execute the perl scripts. I installed the template, copied the vbs scripts to the agent directory and setup the userparameter in zabbix_agentd.conf properly.
A also changed the passwort in the perl scripts.

The scripts stay in /etc/cron.hourly and when i run the script perl hp_phydisk_all_temperature.pl i get the following error.

Quote:
malformed JSON string, neither array, object, number, string or atom, at character offset 1 (before "(end of string)") at hp_phydisk_all_temperature.pl line 62.
I am using zabbix 2.0.1 and PHP 5.3.3 with debian squeeze.

Any ideas ?

Greets from germany

abiboba
Reply With Quote
  #5  
Old 06-07-2012, 11:54
mmarkwitzz mmarkwitzz is offline
Member
 
Join Date: Jan 2011
Posts: 94
Default

Hello,

The error occurs in the authentication function. Check if the user and pass are correct and if the user has api access. Do you get the error with the other script also?

If you still have the error after that, you can add the line "print $res;" at line 60 of the script. Run it again and you will see the authentication returned json/error message.
Reply With Quote
  #6  
Old 06-07-2012, 13:03
abiboba abiboba is offline
Junior Member
 
Join Date: Jun 2012
Posts: 4
Default

As descibed in http://www.zabbix.com/documentation/...access_changes
Quote:
Starting with Zabbix 2.0, all users have full access to the API.
I don´t know how i could give or look if the user have api access permission.

So, i inserted the "print $res;" in line 60 and the result is the same like before.
Quote:

malformed JSON string, neither array, object, number, string or atom, at character offset 1 (before "(end of string)") at ./hp_phydisk_all_temperature.pl line 62.
Hmm, maybe i need some packages for perl or php5 for parsing json ?

Greetings
abiboba
Reply With Quote
  #7  
Old 06-07-2012, 13:11
abiboba abiboba is offline
Junior Member
 
Join Date: Jun 2012
Posts: 4
Default Problem is solved

Ok, i found the solution for my problem.
I changed the loopback address to the fqdn of my zabbix server and it works now
Code:
$url = "http://127.0.0.1/api_jsonrpc.php";
Sorry for that, it´s friday ;-D

Greetings

abiboba
Reply With Quote
  #8  
Old 08-07-2012, 16:26
jix jix is offline
Member
 
Join Date: Feb 2011
Posts: 53
Default !

what about linux server ?
it seems your agent only runs on windows servers...
Reply With Quote
  #9  
Old 08-07-2012, 22:06
mmarkwitzz mmarkwitzz is offline
Member
 
Join Date: Jan 2011
Posts: 94
Default

I only have access to a windows environment, sorry.
I believe the wbem providers are available for linux and the scripts could be rewritten in something like perl, with near zero modifications to the template itself (just to remove the eventlog items)
If anybody is willing to give it a shot, they are more than welcome to use my templates/scripts as a starting base.
Reply With Quote
  #10  
Old 10-07-2012, 15:52
fboulanger fboulanger is offline
Junior Member
 
Join Date: Jul 2012
Posts: 3
Default

Hi,
I'm trying to use your template to monitor some of my HP proliant ML350 and i got some problems in agentd logs:
Quote:
4160:20120710:154113.928 item [eventlog.query[system,(source=HP\sEthernet;type=Error|Warning)]] error: Special characters '\'"`*?[]{}~$!&;()<>|#@' are not allowed in the parameters
4160:20120710:154113.928 Active check [eventlog.query[system,(source=HP\sEthernet;type=Error|Warning)]] is not supported. Disabled.

...And it goes on for every item to check.
I think my items are wrong but I don't undrestand why, can you show me what your items look like please ?

Thanks.

Last edited by fboulanger; 10-07-2012 at 15:57.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:23.