Page 1 of 1

Linux Command Output as a Nagios Maco

Posted: Fri Nov 02, 2018 11:08 am
by IT-OPS-SYS
Hello everyone,

I am trying to assist my colleague who is an Oracle DBA with monitoring the mounts which the database relies on. We have multiple database servers with different SIDs but the general location follows this syntax. (/oracle/SID/oraarch) We have wrote a check command which utilizes check_nrpe with the check_disk command as $ARG1$ and the location (/oracle/SID/oraarch) as $ARG2$. We are stuck on trying to parameterize this check so we don't have to create X copies of the different check for different Database SIDs.

Is it possible to take the output of a linux command such as:

cat /etc/oratab | grep -v '^#' | awk -F: '{print $1}'

and pass the result through Nagios as $ARG3$ to substitute the SID_Variable in the location (/oracle/SID_Variable/oraarch) for the SID that is found by querying the /etc/oratab file? Thanks again for you help.

Re: Linux Command Output as a Nagios Maco

Posted: Fri Nov 02, 2018 11:55 am
by npolovenko
Hello, @IT-OPS-SYS. Unfortunately, this will not work. You could create a custom shell script that would pull the mount names using this command:
cat /etc/oratab | grep -v '^#' | awk -F: '{print $1}'
And then run the check disk command with each argument.
You can also try running the check_disk plugin with the "-r" argument for the path instead of "-p". That should output all mounts.
/usr/local/nagios/libexec/check_disk -w 10 -c 5 -r /oracle

Re: Linux Command Output as a Nagios Maco

Posted: Fri Nov 02, 2018 4:19 pm
by Maxwellb99
Hey IT-OPS-SYS

I love this question. I posted a follow on question under the subject "Nagios design"

i thought about using the resources file but you'd still need to pass in the args to the service. Realistically Nagios needs to create some sort of a nagios_service_dictionary_object that takes in a list of drives & functionality (free, ..., total). Then returns an object (service(s)*) with the servicestatus of each of the drives/services.

Thanks,
Maxwell Ramirez

Re: Linux Command Output as a Nagios Maco

Posted: Mon Nov 05, 2018 1:39 pm
by npolovenko
Looks like Craig answered @Maxwellb99's question in the other thread:
https://support.nagios.com/forum/viewto ... 16&t=51001

@IT-OPS-SYS, Let us know if you have any other questions.

Thanks!