Solved

wmi check via Nagios help please

Posted on 2013-06-25
6
436 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 29

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 29

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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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 29

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

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

Both MMF (multi-mode fiber) and SMF (single-mode fiber) are types of optical fiber that can aid in communication applications. These thin strands of silica or glass will allow communication to occur between devices. The transmission of light between…
Learn how ViaSat reduced average response times for IT incidents from 10 minutes to 30 seconds.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
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.

752 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