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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Graph error

Post 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.
Former Nagios employee
nareshtis
Posts: 24
Joined: Sun Sep 27, 2015 5:29 am

Re: Nagios Graph error

Post by nareshtis »

my current plug-in/script unable to collect the pref data, i am not able to get the graphs...
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios Graph error

Post 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
Box293 wrote:I did a talk on performance data at the Nagios World Conference, you can watch it here:

https://www.youtube.com/watch?v=kqA2KcpUFg4
http://www.slideshare.net/nagiosinc/tro ... and-graphs

This might help you understand the concepts.
I don't mean to blow my own trumpet but a lot of the information about performance data is covered in my presentation.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
nareshtis
Posts: 24
Joined: Sun Sep 27, 2015 5:29 am

Re: Nagios Graph error

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios Graph error

Post by Box293 »

Please show us the updated plugin so we can verify the changes.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
nareshtis
Posts: 24
Joined: Sun Sep 27, 2015 5:29 am

Re: Nagios Graph error

Post 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
;;
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Graph error

Post 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.
Former Nagios employee
nareshtis
Posts: 24
Joined: Sun Sep 27, 2015 5:29 am

Re: Nagios Graph error

Post by nareshtis »

Output after making above 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 »

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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios Graph error

Post 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
;;
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked