Solved

wmi check via Nagios help please

Posted on 2013-06-25
6
443 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
Three Considerations for Containers

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read our article on Experts Exchange.

 

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

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)

Question has a verified solution.

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

Recovering from what the press called "the largest-ever cyber-attack", IT departments worldwide are discussing ways to defend against this in the future. In this process, many people are looking for immediate actions while, instead, they need to tho…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Suggested Courses

623 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