Hi friends.
I need to know if it is possible to check remote hostname via Nrpe
I can get hostname with command
check_nrpe -H $HOSTADDRESS$ -c check_wmi -a "query=Select Name from win32_ComputerSystem"
And I would like to get CriticalStatus if Value i get with command above is different from $HOSTNAME$
I will try to explain
check_nrpe -H $HOSTADDRESS$ -c check_wmi -a "query=Select Name from win32_ComputerSystem" "crit=Name not like $HOSTNAME$"
Both $HOSTADDRESS$ and $HOSTNAME$ are values from Nagios variables.
Regards.
Check_wmi Hostname Computer
Re: Check_wmi Hostname Computer
I don't see why the command below wouldn't work:
I tried it and it worked for me just fine. Keep in mind that you can't test it from the command line as the $HOSTNAME$ macro wouldn't resolve.
Here's an example of a service definition:
Code: Select all
check_nrpe -H $HOSTADDRESS$ -c check_wmi -a "query=Select Name from win32_ComputerSystem" "crit=Name not like $HOSTNAME$"
Here's an example of a service definition:
Code: Select all
define service {
host_name My-PC
service_description Check Host Name
use generic-host
check_command check_nrpe!check_wmi!-a "query=Select Name from win32_ComputerSystem" "crit=Name not like '$HOSTNAME$'"
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
notifications_enabled 1
contacts nagiosadmin
register 1
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 60
- Joined: Fri Feb 26, 2016 7:15 am
Re: Check_wmi Hostname Computer
Hi now is good..
Thanks a lot
Thanks a lot
Re: Check_wmi Hostname Computer
Glad to hear it! I'll be closing this up now, but feel free to open another thread if you need anything in the future!
Former Nagios employee