PDF

Scripting Sensors

Netcrunch delivers hundreds of monitoring facilities such as monitoring packs and sensors, but we want you to be not limited to them. Script sensors are essentials in filling any gaps in delivering monitoring data to NetCrunch.

Unlike other systems, we do not force you to deliver data in one native data format, because there are thousands of scripts written for open source systems already. We want these scripts to be adaptable to NetCrunch, and this is the role of Data Parsers that are responsible for translating data returned by an external script to NetCrunch native format.

remote-ssh-script

Remote SSH Script Sensor

The Remote SSH Script Sensor in NetCrunch allows for the execution of scripts on remote machines via SSH, providing a powerful tool for remote system management and data collection.

Overview

This sensor is designed to remotely execute a script that is located on a target system. It utilizes an SSH connection to securely run the script, making it an ideal choice for managing and monitoring servers, network devices, and other systems in a secure and efficient manner.

Sensor Settings

Configuring the Remote SSH Script Sensor involves several key settings:

  • SSH Connection and Credentials
    Specify the details of the SSH connection, including the server address, port, and the necessary credentials (username and password or SSH key) for authentication.
  • Script Path
    Define the exact path to the script on the remote system. Ensure the script is accessible and executable by the user provided in the SSH credentials.
  • Execution Timeout
    Set a timeout period for the script execution. This prevents the script from running indefinitely and helps in managing resources effectively.
  • Optional Script Parameters
    Enhance the flexibility of the script execution by adding parameters. These can be static values or dynamically mapped from node properties. To configure these parameters, refer to the script configuration window under 'Script Sensor' for comprehensive guidance.

Default Alerts

NetCrunch provides several pre-configured alerts for common issues that might arise during the sensor's operation:

  • Connection Error
    Triggered when the SSH connection to the remote machine fails.
  • Authentication Error
    Occurs if there are issues with SSH credentials or permissions.
  • Script Execution Error
    Alerts when the script fails to execute within the specified timeout or due to other errors during execution.

Available Alerts

Beyond the default alerts, NetCrunch offers additional alerting options to provide more granular monitoring:

  • Monitoring Sensor Counter Alert
    Get notified when specific sensor counters exceed predefined thresholds.
  • Status Change Event Alert
    Trigger an alert when there's a change in object status, as determined by the Data Parser's output.

Counters

The Remote SSH Script Sensor provides valuable data points, including:

  • Sensor/Script Execution Time
    Measures the time taken for the script execution, aiding in performance analysis.
  • Data Parser Counters
    Counters returned by the Data Parser, which can include a wide range of data points depending on the script's output and the parser's configuration. This feature transforms the raw output of the script into actionable metrics within NetCrunch.

By integrating the Remote SSH Script Sensor into your NetCrunch monitoring setup, you gain a versatile tool that extends the capabilities of your network monitoring, ensuring a more comprehensive and proactive management approach.

script

Script Sensor

The Script Sensor in NetCrunch is a dynamic tool designed to execute scripts or programs on the local NetCrunch Server machine and accurately process their results.

This sensor is adaptable and can be configured on any node within your network. However, it's important to understand that the script will always execute on the NetCrunch Server machine. This feature allows it to effectively poll data from remote machines, with the option to include various parameters like address and credentials in the script.

Supported Script Types

NetCrunch supports a wide range of script types, enhancing its versatility:

  • JavaScript (NodeJS)
  • Windows batch files (cmd, bat)
  • VBScript
  • PowerShell
  • Python
  • Commandline Applications (exe)

NetCrunch can automatically detect script type by file extension, or you can specify the type in sensor configuration. If the program can't detect script type, it will execute it using Windows shell.

Script Output Processing

The output from the script (stdout stream) is fed into a data parser. This can be a custom parser designed to adapt to your script's output, subsequently returning counters and statuses to NetCrunch. The script must be accessible to NetCrunch and located on the NetCrunch Server's local disk. Remember, the NetCrunch Server operates under the Local System Account, which requires the correct disk access permissions.

Additional Features

  • Output File Saving
    The script's output can be saved to a file for NetCrunch to read and parse. This is enabled by checking the 'Read result from file' option and specifying the output file path.

  • Script Parameters
    Parameters can be included in the configuration window to map NetCrunch node properties to script parameters. This includes dynamically mapped parameters like node IP address ($address), node name ($name), and credentials ($credentials/...). For PowerShell, you have the option to pass credentials through a PSCredential object.

Counters:

NetCrunch provides counters for: - Sensor/Script Execution Time - Counters returned by selected Data Parser

Default alerts:

  • Script Execution Error
Available Alerts:

Default and Available Alerts

NetCrunch automatically sets up default alerts for script execution errors. Additionally, you can set up alerts for:

  • Monitoring Sensor Counter: Triggered when specific sensor counters exceed predefined thresholds.
  • Object Status Change: Occurs when there's a change in object status, as determined by the Data Parser.

Passing Arguments to the Script

Arguments to the script can be passed using parameters in the configuration window. These parameters allow you to map NetCrunch node properties to script parameters, facilitating dynamic data collection and interaction with various network components.

$address
node IP address
$name
node name
$credentials/...

profile path (you can use only one profile per sensor): $credentials/windows/<name>/<property>,
where profileName is optional, for example

  • $credentials/windows/default/user - user from Windows Default credentials profile
  • $credentials/windows/user - user name from Windows credentials profile used by Windows monitor

You can pass credentials to Windows PowerShell via PSCredential object by checking the option 'Pass credential through PSCredential object' and providing parameter.

Prerequisites and Limitations

  • Prerequisites
    Depending on the script type, specific prerequisites need to be fulfilled (e.g., installing NodeJS for JavaScript, Python for Python scripts, and setting PowerShell execution policies for PowerShell scripts).

  • Limitations
    Due to the resource-intensive nature of external scripting sensors, the number of concurrent scripting processes running on the NetCrunch Server is limited to 5. This is to ensure optimal performance and stability of the system.

remoteremote scriptscript