Solved

wmi check via Nagios help please

Posted on 2013-06-25
6
414 Views
Last Modified: 2013-06-26
The command I am using is

./check_nrpe -H xx.x.x.xx -p xxxx -c CheckWMI -a "Query=select Frequency_PerfTime from Win32_PerfRawData_CustomPerformanceTiersCalculator_CustomPerformanceTiersCalculator" "columnSyntax=%Frequency_PerfTime%"

And the output is 2660000000|'wmi query'=1


How do I make it so the output is only 2660000000.  There is other commands I also want to run and do not want |'wmi query'=1 to be a part of the output.


Any suggestions?
0
Comment
Question by:Alice7
  • 3
  • 2
6 Comments
 
LVL 28

Expert Comment

by:Jan Springer
Comment Utility
Is checkWMI a shell, perl or compiled?
0
 

Author Comment

by:Alice7
Comment Utility
compiled, i believe, it's part of the check_nt command
0
 
LVL 28

Expert Comment

by:Jan Springer
Comment Utility
If it's compiled, you might be able to find the source and modify it or put that check command in a wrapper that's a non-compiled script to manipulate the response.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:Alice7
Comment Utility
Modifying the source is not possible as that will most likely break a lot of checks.

Doing the following I sorta get what I want but it is still not enough

 ./check_nrpe -H xx.x.x.xx -p xxxx -c CheckWMI -a "Query=select Frequency_PerfTime from Win32_PerfRawData_CustomPerformanceTiersCalculator_CustomPerformanceTiersCalculator" "columnSyntax=%Frequency_PerfTime%" | tail --lines=1 | awk '{print $1}'

and the output is 2660000000|'wmi
0
 
LVL 28

Accepted Solution

by:
Jan Springer earned 250 total points
Comment Utility
tail --lines=1 | cut -d '|' -f1 | awk '{print $1}'
0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 250 total points
Comment Utility
Hi,

You can create another command a shell script. edit a file such as check_wmi_sp unuder the directory your plugins are located.

the contents should read:

#!/bin/bash

 ./check_nrpe -H $1 -p $2 -c CheckWMI -a "Query=select Frequency_PerfTime from Win32_PerfRawData_CustomPerformanceTiersCalculator_CustomPerformanceTiersCalculator" "columnSyntax=%Frequency_PerfTime%" | cut -f1 -d"|" 

Open in new window


don't forget to make it executable:

chmod 755 ./check_wmi_sp

edit your commnads.cfg file  (ususally unde /etc/nagios/objects) and add the command:

define command{
        command_name    check_nrpe_wmisp
        command_line    $USER1$/check_wmi_sp $HOSTADDRESS$ $ARG1$ 
        }

Open in new window


Restart nagios and now you'll be calling check_wmisp to execute the truncated command.

Cheers,
K.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

This is a based on my experience in IT role and also my role before that, a builder. These 1st contact rules have helped me and more importantly help past, present and hopefully future client/people I get to work/assist. Via Telephone: 1.      Answ…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now