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
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?
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.
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
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
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
I have found an error in your syntax:
[blockquote]CHANGE_CUSTOM_SVC_VAR;SERVER1:Terminal;_OID;.1.3.6.1.4.1.5555.100.1.27.29.34.0
SCHEDULE_FORCED_SVC_CHECK;SERVER1:Terminal;1110741500[/blockquote]
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.