Page 3 of 4
Re: Nagios Graph error
Posted: Fri Oct 16, 2015 2:22 pm
by tmcdonald
Isn't that what your current plugin is meant to do? I'm a little lost on what you need. We can't outright write the script for you, but we can help if you have specific questions.
Re: Nagios Graph error
Posted: Sat Oct 17, 2015 12:33 am
by nareshtis
my current plug-in/script unable to collect the pref data, i am not able to get the graphs...
Re: Nagios Graph error
Posted: Sun Oct 18, 2015 10:11 pm
by Box293
nareshtis wrote:[root@db1 libexec]# ./check_oracle --login db 1
OK - dummy login connected
[root@db1 libexec]#
tmcdonald wrote:Sometimes in certain plugins an OK state won't return performance data, but it really should if you want your graphs not to have gaps in them. Your plugin seems to be running as intended looking at the code you gave, you just need to have the same performance data output when the check is OK that you have when it is not.
What
@tmcdonald has pointed out is your problem, your script is not outputting performance data (everything after the pipe symbol) when it's in an OK state. Nagios is not going to display performance data when the plugin is not returning any.
You need to change line 189 to be something like line 193:
Code: Select all
echo "OK - dummy login connected|Number of Widgets=$metricwidgets;$warning;$critical;;"
In addition to this, the performance data is not formatted correctly. Spaces in the label are allowed, but the label must be enclosed in single quotes.
Code: Select all
echo "OK - dummy login connected|'Number of Widgets'=$metricwidgets;$warning;$critical;;"
Honestly, take a step back and compare the output with what the performance data specifications are.
This is a definitive spec:
https://nagios-plugins.org/doc/guidelines.html#AEN200
I don't mean to blow my own trumpet but a lot of the information about performance data is covered in my presentation.
Re: Nagios Graph error
Posted: Mon Oct 19, 2015 12:52 am
by nareshtis
Thanks for your response...
I made above changes, but still no joy
[root@db1 libexec]# ./check_oracle --login db1
OK - dummy login connected
Re: Nagios Graph error
Posted: Mon Oct 19, 2015 12:55 am
by Box293
Please show us the updated plugin so we can verify the changes.
Re: Nagios Graph error
Posted: Mon Oct 19, 2015 2:15 am
by nareshtis
--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 "OK - dummy login connected|'Number of Widgets'=$metricwidgets;$warning;$critical;;"
exit $STATE_CRITICAL
fi
;;
Re: Nagios Graph error
Posted: Mon Oct 19, 2015 10:04 am
by tmcdonald
It looks like you have not made any of the changes that
@Box293 suggested. You will need to change this:
echo "OK - dummy login connected"
to something like this:
echo "OK - dummy login connected|'Number of Widgets'=$metricwidgets;$warning;$critical;;"
obviously changing out the variables and label to something that makes sense in your environment.
Re: Nagios Graph error
Posted: Mon Oct 19, 2015 12:08 pm
by nareshtis
Output after making above changes ...
[root@db1 libexec]# ./check_oracle --login db1
OK - dummy login connected|'Number of Widgets'=;;;;
Re: Nagios Graph error
Posted: Mon Oct 19, 2015 4:56 pm
by jdalrymple
This still won't graph anything. At a minimum you will need a scalar to go with the "thing" (in your case "Number of Widgets") that you're monitoring.
Re: Nagios Graph error
Posted: Mon Oct 19, 2015 5:06 pm
by Box293
Try moving the line
loginchk3=` echo "$loginchk" | grep "ORA-" | head -1` further up the script so it is defined:
Code: Select all
--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 "CRITICAL - $loginchk3|'Number of Widgets'=$metricwidgets;$warning;$critical;;"
exit $STATE_CRITICAL
fi
;;