Solved

wmi check via Nagios help please

Posted on 2013-06-25
6
421 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
ID: 39276313
Is checkWMI a shell, perl or compiled?
0
 

Author Comment

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

Expert Comment

by:Jan Springer
ID: 39276336
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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

Author Comment

by:Alice7
ID: 39276421
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
ID: 39276437
tail --lines=1 | cut -d '|' -f1 | awk '{print $1}'
0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 250 total points
ID: 39276551
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

919 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

18 Experts available now in Live!

Get 1:1 Help Now