Hello,
first of all, thanks in advance for your time reading this questions.
Question 1
I have some services that count some files in some server folders. As far as the count result can be different every day and even 0, the check is always OK and I show the count result as the output of the check. This is working fine.
I need to compare the output of 2 of this services and raise a Critical or a OK if outputs are different or not. I readed that with check_multi I can execute some child checks and get a global result but as I said, as far as the checks will always be OK, How can I use check_multi (or other different way) to get the final result comparing the output of the child services instead the service status?
Question 2
Very related with the previous question, is there a way to show in a Dashboard and in a Report the output of the service check instead of the service status?
I mean.. create a report in Nagios for this service in which I get someting like :
Server_Name1 --> 50 files
Server_Name2 --> 60 files
Server_Name3 --> 45 files
I saw that in a Dashboard I can use the text_label=[output] to show the output near to the service Icon but I don´t know if this is the best way to do it.
Of course the purpouse of all of this is to use nagios to automate the process for counting files and presenting the result in a Dashboard or scheduled Report, which I know that is not the main purpouse for this monitoring tool but nagios will never stop surprising me.
Many thanks for your help and comments.
Best Regards
Comparing and showing in Reports service outputs
Re: Comparing and showing in Reports service outputs
1. I would create a wrapper script to compare the two variables observed by the different checks. Then, have your actual check just be the comparison of the two numbers.
2. This was posted in the Core board, but when you mention Dashboard and Report I think of XI. Which one are you using?
2. This was posted in the Core board, but when you mention Dashboard and Report I think of XI. Which one are you using?
Former Nagios Employee
Re: Comparing and showing in Reports service outputs
Hello, thanks in advance for your help.rkennedy wrote:1. I would create a wrapper script to compare the two variables observed by the different checks. Then, have your actual check just be the comparison of the two numbers.
2. This was posted in the Core board, but when you mention Dashboard and Report I think of XI. Which one are you using?
1. Can you show me an example or code portion of a script that captures the output/status_information column of a nagios service check? If I know how to reference this value I will manage to make a script for comparing the values.
2. Its "still" Nagios 3 , sorry if this is not the right forum. Can it be posible to show the service output in a report?
Regards
Re: Comparing and showing in Reports service outputs
Sure, here's a rough example of something I hacked together just the other day. I am pulling the amount of memory usage by using the awk part of the commands when setting $memory and $memory2.
Basically, both checks are running when defining $memory and $memory2, then $memmb / $memmb2 are doing math based on those variables. I've then added in logic similar to what you're after. Modify as needed.
2. I don't think this is going to be possible out of the box. You could raise an issue on our GitHub for the request here - https://github.com/NagiosEnterprises/nagioscore
Code: Select all
#!/bin/bash
#set vars
memory=$(/usr/local/nagios/libexec/check_nrpe -H 192.168.5.47 -c check_process -a process=firefox.exe "crit=working_set > 32M" "detail-syntax=%(working_set) %(exe)" | awk '{print $2}')
memory2=$(/usr/local/nagios/libexec/check_nrpe -H 192.168.5.47 -c check_process -a process=explorer.exe "crit=working_set > 32M" "detail-syntax=%(working_set) %(exe)" | awk '{print $2}')
memmb=$(($memory/1024/1024))
memmb2=$(($memory2/1024/1024))
#logic for checking values
if [ "$memmb" -ne "$memmb2" ]
then
state="CRITICAL"
ecode=2
elif [ "$memmb" -eq "$memmb2" ]
then
state="OK"
ecode=0
else
state="UNKNOWN"
ecode=3
fi
echo "$state: firefox=$memmb explorer=$memmb2 | firefox=$memmb;;; explorer=$memmb2"
exit $ecode
2. I don't think this is going to be possible out of the box. You could raise an issue on our GitHub for the request here - https://github.com/NagiosEnterprises/nagioscore
Former Nagios Employee
Re: Comparing and showing in Reports service outputs
Many thanks for your help an examples, I think I Will manage to get It working.
The thread can be closed.
Regards
The thread can be closed.
Regards
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Comparing and showing in Reports service outputs
We can leave it open until you have confirmed you have things working.