External Commands Changing Nagios 3 Custom Object Variables


Trying to implement adaptive monitoring i needed to define custom variables in my services/objects that have dummy values at startup and are updated during the monitoring process. So i defined a service

define service{
use local_service
hostgroup Group1
host_name *
service_description Terminal
display_name Terminal
is_volatile 1
active_checks_enabled 0
passive_checks_enabled 1
check_freshness 1
freshness_threshold 93600
_OID dummy
check_command my_snmp_command

What i intended to do, was, to change the custom _OID variable accordingly using the CHANGE_CUSTOM_SVC_VAR external command, and, then, issue a SCEDULE_SVC_CHECK external command for the service to do an on-demand check, using the custom $_SERVICEOID$ macro with my_snmp_command to pass the correct OID every time.

In my nagios.log file I could see both the received extenral commands:


The forced service check is executed but the $_SERVICEOID$ macro retains the initial ‘dummy’ value as if the CHANGE_CUSTOM_SVC_VAR external had not been issued.

I have disabled the large_installation_tweaks but no change.

Has anyone faced the same problem? Could you suggest me any possible solutions?

Thank you in advance


Your host_name variable is set to * and in CHANGE_CUSTOM_SVC_VAR is set to SERVER1, maybe that is the issue, in case you’ve just copy/pasted the service definition.
Also check the write permissions on your configuration file of the defined service, maybe Nagios isn’t permitted to write in it.


Thank you for your help :frowning:

The configuration files were owned alerady by nagios:nagios user/group and had r/w perimissions for the nagios group and others.
(Anyhow i think that nagios only accesses those files at startup and maintains the runtime information at the objects.cache file under var directory)

Speaking of this object.cache file, it is an ASCII file so i could easily view it. It contains an entry for every object instance defined in nagios, and i found that it had an instance of the Terminal service for every defined host (for SERVER1 as well). However none of those instances had anything else than the ‘dummy’ value for the _OID field :frowning:

I also changed the configuration files to mention explicitly the hosts at the service definitions instead of uisng wildcard ‘*’ as you suggested but unofrtunately the results were the same :frowning:

Something more: If I got it right nagios is supposed to export environment variables for every custom object variable (i.e. NAGIOS_SERVICEOID)? I don’t think this is the case at my installation :frowning:

Any further help appreciated


I have found an error in your syntax:

You have put a colon between (SERVER1) and <service_description> (Terminal) variables in your external commands. Check those out and replace colons : with semicolons ;


Good point but unfortunately it is just a typing error. The machine where nagios runs is at a different network so instaed of copy/pasting i copy some log excrepts by hand. The actual log has a semicolon instaed of a colon at these places.

Has anyone used those external commands?

BTW my nagios version is 3.0.2, May 19 2008.