Page 1 of 1

Nagios Check with Array

Posted: Tue Jan 21, 2020 2:40 pm
by jenglish
Hello,

I can't seem to find documentation supporting it, but does Nagios allow for arrays for checks? For instance, I have an LDAP account check. We'd like to know if users are locked. But if you are checking 30 users that is a lot of code for something that is repeated.

In the example below:
User taboyer's account is being monitored. I'd like to be able to use a variable or array here and have the user list be plugged in so I'm not repeating the entire service definition 30+ times.

Code: Select all

define service{
        host_name                       boy-adams
        use                             nm-default-service
        service_description             Account lockout check - Tim
        notes                           Tim's AD account taboyer is locked out.
        check_command                   check_ldap_account!P!taboyer
        notes_url                       onenote:///\\boy-elbert\one$\IS-RUNBOOK\General%20IS\Knowledge%20Base.one#Nagios%20Alert%20-%20Linux%20-%20LDAP%20Account%20Check&section-id={E9C18768-B037-4F6F-AC7E-ADD79E20AB49}&page-id={C19FF347-6402-4BC9-8322-F5C4267C1D2A}&end
        }
Thanks,
Jordan

Re: Nagios Check with Array

Posted: Tue Jan 21, 2020 3:09 pm
by scottwilkerson
Unfortunately there is no mechanism to do this.

You can use templates (as you are in your example), but that is all.

Re: Nagios Check with Array

Posted: Tue Jan 21, 2020 4:31 pm
by jenglish
Thanks for the confirmation, Scott.

Re: Nagios Check with Array

Posted: Tue Jan 21, 2020 4:43 pm
by scottwilkerson
jenglish wrote:Thanks for the confirmation, Scott.
No problem