Custom metrics

Contents

About custom metrics

You can create your own custom metrics to monitor your servers and applications. Use custom metrics to monitor a wide variety of activities, including checking ports, processes, logs, uptime, and much more. You can also create custom metrics that use Linux or Windows scripts to collect data or use your own custom scripts. Additionally, you can tailor your metrics for individual servers or server groups as needed.

Custom metrics give you the ability to monitor system performance and set up alert protection according to the specific needs of your IT organization. Once you've created a metric, you can use Smart Tools's server and application monitoring features to view graphs, create threshold-based alerts, receive notifications through email or SMS, define Web Hooks for event-based API integration, and run alert-based scripts for self-healing. 

Create custom metrics

Custom metrics includes the following concepts:

  • Metric Group: Metric category that contains metric applications that are installed and run on the servers. For example, the System metric group contains the applications Physical MemoryCPU, Disk, Network, Processes, and so on.
  • App: Metric applications that include metric items. For example, the app Physical Memory contains the metric items free memory, total memoryavailable memory, and so on.
  • Item: Specifies metric data that is collected. For example, for the item free memory, data is collected at regular intervals measuring the current amount of free physical memory of a machine.

You can create custom metrics from the Metric Manager page.

Step 1: Create and add a metric group

  1. From the Deployments page, move the pointer over the deployment you want to monitor and click Details.
  2. Click Monitoring.
  3. Click the name of the server for which you want to create custom metrics.
  4. Under the Monitoring tab, click Configure. If monitoring is not enabled, the Enable Monitoring prompt appears. Click Enable.
  5. Click View Existing Information. The Metric Manager page appears, listing all the available metric groups. By default, the System metric group appears with the list of available applications.
  6. Click Add Metric Group. The Add New Group dialog appears. 
  7. Enter a name for the new metric group and click Add. The new metric group appears in the metric groups list.
  8. To edit a metric group, click Edit Metric Group. To delete a metric group, click Delete Metric Group.

Step 2: Create, apply, and add metric applications

  1. Click the metric group in the metric groups list.
  2. Click Add App. The Add New App dialog appears.
  3. Enter a name for the new application.
  4. Select an operating system from the Applies to box. By default, All Operating Systems option is selected. 
  5. Click Add. The new application appears in the app list.
  6. To edit application details, move the pointer over the application name, click Actions, and select Edit App. To delete an application, move the pointer over the application name, click Actions, and select Delete.

Step 3: Create, test, and add metric items

  1. Move the pointer over the metric application name, click Actions and select Add Item. The Add New Item dialog appears.
  2. Enter a name for the new item. 
  3. Select an item from the Item Type box. This is the specific type of metric data that will be collected.
  4. Enter the specific information requested for the item. Depending on the selected item, the information required will change. For example, if you select Run a command as an Item, you need to provide the required command in the Command box. 
  5. Click Test to validate the new metric item. 
  6. Click View Test Result to view the validation results. Based on the validation, a success or failure message is displayed. An appropriate error message appears in case of conditions such as, machine is offiline, network is down, or any other error conditions as applicable.
  7. Click Add. The new item is added to the Simple Items list of the metric application.
  8. To edit a simple item, click the edit icon near the item name. To delete a simple item, click the delete icon near the item name.

Create custom metrics with collector script

You can create a custom script that collects and outputs multiple metrics. The collector script will be run by the monitoring agent once every 60 seconds. In order for the monitoring agent to understand the script output, the script needs to follow the collector format, consisting of the following four main rules:

  • Key: Must be a unique string that starts with an alphanumeric character and consists alphanumeric characters with one exception, which is it may also contain fullstops. Valid characters are 'A' to 'Z', both upper and lower case, '0' to '9' and finally the fullstop '.' The key must not contain spaces or any other characters that are not specified above.
  • Value separator: colon " : ".
  • Value: Numerical float value.
  • Metric separator: Newline character ( both '\n' and '\r' are supported )

Example valid script output:

myprogram.status:1
myprogram.accesses:700
myprogram.errors:0.73333

The following type of collector scripts are supported:

  • Windows scripts that are set to be executable and have one of the following extensions: ps1, bat, cmd or vbs. 
  • Linux scripts that are set to be executable and also contain a valid shebang line at the top.

To create custom metrics with collector script:

  1. Move the pointer over the metric application name, click Actions and select Add Item. The Add New Item dialog appears.
  2. Click Collector Item. The Add Collector dialog appears.
  3. You can use a script available in your script library or use a script that resides in your machine.
  • If you choose to use a script from script library:
    1. Select Use Script From Library. This is the default option in the Add Collector dialog.
    2. Select a script in the Select a script as collector box.
    3. Click Test to validate that your script returns keys and data points in the correct format. 
    4. Click Next.
    5. Enter the corresponding key that your script will output for each metric. Click Add to define all the metrics to be collected and enter the respective keys and names.
    6. Click Next.
    7. Review the collector script details and click Finish. The new collector item is added to the Collector Items list of the metric application.
  • If you choose to use a script from your machine:
    1. Select Use Script on the Machine.
    2. Enter the full path to the script on your machine. Ensure that the script is set with required run permissions. To add script parameters, click Add parameters.

      Note: If you use a PowerShell script as a collector script on a Windows machine, you need to specify powershell.exe as the path of the script. Ensure that there are no spaces in the script name. 

      The following screenshot shows a sample configuration of a PowerShell collector script that runs on a Windows machine for custom monitor:

      ps-collector-script.png

    3. Click Test to confirm that the script resides on the correct path on your machine.
    4. Click Next to continue.
    5. Enter the corresponding key that your script will output for each metric. Click Add to define all the metrics to be collected and enter the respective keys and names.
    6. Click Next.
    7. Review the collector script details and click Finish. The new collector item is added to the Collector Items list of the metric application.

To edit a collector item, click the edit icon near the item name. To delete a collector item, click the delete icon near the item name.

0 Comments