Result is different between shell and monitoring process execution


#1

If you’re trying to integrate a new plugin into your monitoring system it is advisable to execute it on the command line to check the syntax and the result before you create a new definition (please don’t execute the call as root because the plugin might create temporary files the process isn’t allowed to override later on).
[edit] More important are the permissions to execute programs/scripts and to access files which should be checked. Adding SUID/SGID attributes (take a look at the plugin check_icmp) and using chgrp might help in the first case. [/edit]

Once the syntax/parameters deliver the expected result you’ll create the required definitions and restart the monitoring process … and sometimes you’ll get errors although you’re pretty sure your definitions are correct.
[edit] Executing icinga2 object list --name *objectname* might help to check whether the definition meets your expectations. [/edit]

The reason might be the different environment between a running user session and the monitoring process. During logon the user normally processes one or more logon scripts (.profile, /etc/profile.d/..., .exrc, …) containing additions to environment variables (e.g. PATH, LD_LIBRARY, …) which the monitoring process hasn’t got.
Please check the start script of your monitoring process for files containing such definitions, add/alter the enviroment variables and restart your monitoring process.


What's the difference between starting a check script from bash/cronjob or Icinga daemon?
Check_oracle_health sigfault exit code 128 despite returning values
Check_mysql with my.cnf