Beginner: Pass host specific parameter to disk_check_smb?

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.
Locked
itsmee
Posts: 2
Joined: Fri Jul 31, 2015 4:05 pm

Beginner: Pass host specific parameter to disk_check_smb?

Post by itsmee »

Hi,

just started to look inside Nagios, so this might be an easy one.. Would be very happy if you can point me the right direction..

I'd like to achieve:
- define HOSTGROUP samba including x hosts
- define generic service check
- provide per host variables (share name, user name, pwd)

I've managed #1 + #2 - but so far I cannot use a host variable in service.cfg or /etc/nagios-plugins/config/disk-smb.cfg directly..
I've tried different format, e.g. <user>, $user$ - no avail so far..

Thanks!

Code: Select all

define hostgroup {
        hostgroup_name  samba-servers
                alias           SAMBA servers
                members         banana,power,office
        }

Code: Select all

define service {
        hostgroup_name                  samba-servers
        service_description             SAMBA
        check_command                   check_disk_smb!share!user!password
        max_check_attempts              3
        normal_check_interval           2
        retry_check_interval            1
        process_perf_data               1
        use                             generic-service
        notification_interval           0 
}

Code: Select all

define host{
        use             generic-host
        host_name       banana
        alias           banana
        address         192.168.177.70 
        _smb_share      share
        _smb_user       user
        _smb_pwd        password
        }
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Beginner: Pass host specific parameter to disk_check_smb

Post by Box293 »

Host custom variables need to be in the format $_HOSTMY_VARIABLE_NAME$.

For example:

Code: Select all

$_HOSTSMB_SHARE$
$_HOSTSMB_USER$
$_HOSTSMB_PWD$
Here's some reading material:
https://assets.nagios.com/downloads/nag ... tvars.html
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
itsmee
Posts: 2
Joined: Fri Jul 31, 2015 4:05 pm

Re: Beginner: Pass host specific parameter to disk_check_smb

Post by itsmee »

Perfect - works like a charm, thanks for the reference, very useful.

ItsMee
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Beginner: Pass host specific parameter to disk_check_smb

Post by tmcdonald »

I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee
Locked