typeof(value) | Returns the type object for a value.
get_time() | Returns the current UNIX timestamp.
parse_performance_data(pd) | Parses a performance data string and returns an array describing the values.
+dirname(path) | Returns the directory portion of the specified path.
+basename(path) | Returns the filename portion of the specified path.
exit(integer) | Terminates the application.
## <a id="object-accessor-functions"></a> Object Accessor Functions
const NscpPath = "C:\\Program Files (x86)\\NSClient++"
-By default the check commands assume that NSClient++ is installed in "C:\Program Files\NSClient++".
+By default Icinga 2 uses the Microsoft Installer API to determine where NSClient++ is installed. It should
+not be necessary to manually set this constant.
Note that it is not necessary to run NSClient++ as a Windows service for these commands to work.
******************************************************************************/
if (!globals.contains("NscpPath")) {
- NscpPath = msi_get_component_path("{5C45463A-4AE9-4325-96DB-6E239C034F93}")
+ NscpPath = dirname(msi_get_component_path("{5C45463A-4AE9-4325-96DB-6E239C034F93}"))
}
object CheckCommand "nscp-local" {
import "plugin-check-command"
- command = [ NscpPath, "client" ]
+ command = [ "$nscp_path$\\nscp.exe", "client" ]
arguments = {
"--log" = "$nscp_log_level$"
REGISTER_SAFE_SCRIPTFUNCTION(number, &ScriptUtils::CastNumber);
REGISTER_SAFE_SCRIPTFUNCTION(bool, &ScriptUtils::CastBool);
REGISTER_SAFE_SCRIPTFUNCTION(get_time, &Utility::GetTime);
+REGISTER_SAFE_SCRIPTFUNCTION(basename, &Utility::BaseName);
+REGISTER_SAFE_SCRIPTFUNCTION(dirname, &Utility::DirName);
#ifdef _WIN32
REGISTER_SAFE_SCRIPTFUNCTION(msi_get_component_path, &ScriptUtils::MsiGetComponentPathShim);
#endif /* _WIN32 */
MsiGetComponentPath(productCode, component.CStr(), path, &szPath);
return path;
}
-#endif /* _WIN32 */
\ No newline at end of file
+#endif /* _WIN32 */