Linux Command Output as a Nagios Maco

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
IT-OPS-SYS
Posts: 184
Joined: Sun Jan 07, 2018 12:56 pm

Linux Command Output as a Nagios Maco

Post 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.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Linux Command Output as a Nagios Maco

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Maxwellb99
Posts: 97
Joined: Tue Jan 26, 2016 5:29 pm

Re: Linux Command Output as a Nagios Maco

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Linux Command Output as a Nagios Maco

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