Solved

wmi check via Nagios help please

Posted on 2013-06-25
6
433 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 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

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.

Question has a verified solution.

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

Why pager replacement is still an issue OnPage has what some might call a “hate/hate” relationship with pagers. Not much room for love. As we see it, pagers are an antiquated bit of technology. Pagers are dinosaurs which, like most dinosaurs, sho…
IT certifications are a concrete representation of continual learning on the part of the candidate.  Continual learning is necessary for the long term success of an IT professional, but are IT certifications the right path for you?
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

735 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