|
Many Unix-based systems utilize custom shell scripts in order to monitor a specific condition on the server. The majority of these scripts have been configured by a Unix system administrator to run through a Cron job or a manual process. Using ipMonitor's External Process Monitor and a utility called "plink", it is possible to have ipMonitor establish a Secure Shell (SSH) session with the remote server and run a script. An ipMonitor Alert can then be triggered if the script does not complete or exit properly. |
This setup is useful when:

The above diagram shows that:
Step 1 - Download the "plink" utility:
Plink (PuTTY Link) is a command-line utility that provides a Unix SSH connection:
Note: This process is necessary to ensure that the communication is tested using the same user account that will be used by ipMonitor and to allow the rsa2 key to be stored in cache and be available for use by the account used by ipMonitor.
Step 2 - Test SSH connectivity to the remote system:
Note:
Username: the username of an account with SSH access on the remote system.
ip address: the IP address of the remote system.
password: the password for the account used.
For example: plink.exe john@10.1.2.3 -ssh -pw mypasswrd
The remote system will present you with an rsa2 key fingerprint. Enter "y" when prompted to store the key in cache.

If the connection is successful, you will receive a response resembling the following:
←]0;john@Unixhost: /home/johnjohn@Unixhost:~$
Step 3 - Test the script:
|
TIP To ensure the script ran as intended, we suggest adding a custom line inside the script instructing it to dynamically write content to a file. |
Note:
Script: the path and name of the script.
For example: plink.exe john@10.1.2.3 -ssh -pw mypasswrd ./script/drive_space.sh
If this test is also successful, proceed to the Configuring the External Process Monitor section of this tutorial.
| Monitor Name | External Process :: Server Name :: Script name |
| Monitor Type | External Process Monitor |
| Executable Name | plink.exe |
| Directory | c:\windows\system32 |
| Command Line Parameters | username@ip address -ssh -pw password ./script/drive_space.sh |
| Startup Directory | c:\ |
| Credential for Monitoring | Credential name |
| Returns | Returns the exit code generated by custom script |
| Monitoring Condition | Expected Return Value: 0 Monitor failure indicates that the drive space is more then the set threshold or that the script failed to complete. |
Note: The imported Monitor is initially disabled. This allows you to make changes to the default settings before the Monitor is enabled to go live in a production environment. Once the Monitor is imported, the following settings will need to be verified (and if necessary, modified) for the Monitor:
To learn more about modifying the above parameters, please refer to the 'Configuring the External Process Monitor' section of this tutorial.
|
TIP For detailed instructions regarding importing XML files into your ipMonitor installation, please refer to the tutorial entitled "How to Import and Export Configuration Settings". |
For the purposes of this tutorial, we'll be referring to the preconfigured Monitor included in the XML resource download. Alternatively, you can create a new Monitor by clicking the Monitors menu option and then clicking Add a Monitor. Choose the External Process Monitor from the Windows Based category.


|
TIP
|
Example:
username@ip address -ssh -pw password ./scripts/ drive_space.sh
Note:
Username: the username of an account with SSH access on the remote system.
ip address: the IP address of the remote system.
password: the password for the account used.
Script: the path and name of the script.
In this example, the drive_space.sh script resides in the user directory, under /script/.
plink.exe john@10.1.2.3 -ssh -pw mypasswrd ./script/ drive_space.sh

|
TIP By default, the Timing intervals for each parameter are set to 300 seconds. If needed, adjust these defaults to meet your specific monitoring environment's requirements until the optimum settings are reached. |
For more information regarding the External Process Monitor, refer to the Monitors section of ipMonitor's Context-Sensitive Help system, than select Monitor Types, followed by External Process. The Context-Sensitive Help can be accessed by clicking the Help link located in the top-right corner of ipMonitor's Administration web interface.
For information on other features and concepts related to those discussed in this article, refer to the following ipMonitor resources:
< Back
![]()
Last Updated: April 3, 2006 | What did you think of this topic?