Nagios Graph error

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
nareshtis
Posts: 24
Joined: Sun Sep 27, 2015 5:29 am

Re: Nagios Graph error

Post by nareshtis »

No change after above changes :(
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios Graph error

Post by jdalrymple »

Please post the output of the updated plugin so that we can see what the problem may be.
nareshtis
Posts: 24
Joined: Sun Sep 27, 2015 5:29 am

Re: Nagios Graph error

Post by nareshtis »

After modification

--login)
loginchk=`sqlplus dummy/user@$2 < /dev/null`
loginchk2=` echo $loginchk | grep -c ORA-01017`
loginchk3=` echo "$loginchk" | grep "ORA-" | head -1`
if [ ${loginchk2} -eq 1 ] ; then
echo "OK - dummy login connected|'Number of Widgets'=$metricwidgets;$warning;$critical;;"
exit $STATE_OK
else
echo "OK - dummy login connected|'Number of Widgets'=$metricwidgets;$warning;$critical;;"
exit $STATE_CRITICAL
fi
;;



[root@db1 libexec]# ./check_oracle --login db1
OK - dummy login connected|'Number of Widgets'=;;;;
[root@db1 libexec]#
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Graph error

Post by tmcdonald »

Can you upload the whole plugin? I want to run this on my system and tweak it a bit. Something isn't right and it's hard to tell what from just snippets.
Former Nagios employee
nareshtis
Posts: 24
Joined: Sun Sep 27, 2015 5:29 am

Re: Nagios Graph error

Post by nareshtis »

Please find the attachment
Attachments
check_oracle.txt
(8.86 KiB) Downloaded 415 times
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios Graph error

Post by jdalrymple »

I'm being horribly repetitive and for that I'm sorry. The problem is your code "looks" OK, but it's obviously not working. The problem is we cannot test/debug it because we don't have the Oracle environment set up to do such a thing.

Going back to the fundamentals:
nareshtis wrote:[root@db1 libexec]# ./check_oracle --login db1
OK - dummy login connected|'Number of Widgets'=;;;;
You have to get a number after that equal sign. That is up to you to get your code working in such a way that the scalar ends up there. The fact that it's not showing up simply means your custom plugin isn't working, it has nothing to do with Nagios.

Also, get rid of your 's and make it 1 word: number_of_widgets
nareshtis
Posts: 24
Joined: Sun Sep 27, 2015 5:29 am

Re: Nagios Graph error

Post by nareshtis »

I dont see any difference after the changes :(

[root@db1 libexec]# ./check_oracle --login db1
OK - dummy login connected|'Number_of_Widgets'=;;;;
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios Graph error

Post by jdalrymple »

I need to impress upon you that this is not something we can fix. I can offer pointers and such, but at the end of the day it's on you to make sure that perfdata is populated. If there is no numeric value output in the perfdata then Nagios has nothing to graph. I'll do my best... here is your (relevant) code:

Code: Select all

--login)
    loginchk=`sqlplus dummy/user@$2 < /dev/null`
    loginchk2=` echo  $loginchk | grep -c ORA-01017`
    if [ ${loginchk2} -eq 1 ] ; then 
	echo "OK - dummy login connected"
	exit $STATE_OK
    else
	loginchk3=` echo "$loginchk" | grep "ORA-" | head -1`
	echo "CRITICAL - $loginchk3|Number of Widgets=$metricwidgets;$warning;$critical;;"
	exit $STATE_CRITICAL
    fi
    ;;
Here is the output you shared:
nareshtis wrote:[root@db1 libexec]# ./check_oracle --login db1
OK - dummy login connected|'Number_of_Widgets'=;;;;
I can't make any sense of how you're getting the output you're getting. If the check returns OK then you should never make it into the logic where you've put in performance data. In addition - you used the variables exactly as I wrote them. I was creating an ambiguous sample to try to help you understand the basic layout of performance data, there was no intent for you to use those variables explicitly as they don't exist anywhere else in your code.

Lastly - what performance do you want to graph? This portion of the plugin appears to only check whether a login is possible or not. Graphing requires some metric to be placed on a chart. I'm totally confused about how you plan to graph "the quantity of" "dummy login connected" over time???
Locked