Skip to content

Commit

Permalink
Requested changes have been made
Browse files Browse the repository at this point in the history
Requested changes have been made:
- Markdown Formatting
- Replacing MSX with Monitoring Studio X
  • Loading branch information
alexdgilbert committed Dec 3, 2021
1 parent 7a6ca5e commit 14f54b3
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ This template shows how to monitor all Performance Counter Instances concurrentl
<strong>Command Line Monitor - Command Gathering All Desired Performance Counter Instances</strong>

Command run on host:
```bash
wmic path Win32_PerfFormattedData_PerfOS_Processor get Name,PercentUserTime /value /format:CSV
```

In this monitor, we are simply launching the command that will gather all the instances using the wmic command for windows. We added /value and /format:CSV for formatting reasons. Each value will be listed on a separate line and it will be formatted as a CSV, separated by commas. This will come in handy in the next step. Note that this will require valid System Credentials.

The first column will be your hostname, the second will be the instance name and the third one will be the actual value we want monitored: % User Time.

Sample output:

```bash
Node,Name,PercentUserTime
ExampleHostname,0,0
ExampleHostname,1,12
ExampleHostname,2,6
ExampleHostname,3,6
ExampleHostname,_Total,11
```

<strong>Dynamic Instances - Performance Counter Instances</strong>

In this monitor, we use dynamic instances to create one MSX instance per Performance Counter instance. This way, we will be able to separate all of the instances, so that each can be monitored independently. By specifying the CSV format earlier, we can now set our Column Separators as ",". Since our processor name will be different for each instance, it makes it the ideal column to use for the Dynamic Instance Internal ID and Dynamic Instance Display Name. We also used the option "Keep Lines Matching" and set it to [0-9], meaning only lines with numeric values will be kept, essentially ignoring empty lines as well as the header.
In this monitor, we use dynamic instances to create one Monitoring Studio X instance per Performance Counter instance. This way, we will be able to separate all of the instances, so that each can be monitored independently. By specifying the CSV format earlier, we can now set our Column Separators as ",". Since our processor name will be different for each instance, it makes it the ideal column to use for the Dynamic Instance Internal ID and Dynamic Instance Display Name. We also used the option "Keep Lines Matching" and set it to [0-9], meaning only lines with numeric values will be kept, essentially ignoring empty lines as well as the header.

<strong>Numeric Extraction - Percent User Time</strong>

Expand Down
5 changes: 4 additions & 1 deletion examples/Automatic Log Truncation/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ df -h /EMC/backend/log_shared
In this monitor, we are simply launching the command that will gather the size of the partition where the log is stored. This command will likely be different based on the platform against which it is used or even based on system configuration.

Sample output:
```bash
Filesystem Size Used Avail Use% Mounted on
/EMC/backend/log_shared 251G 2.2G 236G 1% /EMC

```
<strong>Numeric Extraction - Log Size Numeric Extraction</strong>

This monitor is where we will extract the partition value and set whichever alerts we may want. Since we know the value is followed by a "%", we opted to use "Before this String: %" to locate the relevant value. In the alert options, we set an information alert threshold at partition usage of 50% and an alert action, which calls a separate command line monitor which we will review below.
Expand All @@ -22,6 +23,8 @@ We then also added an alarm alert at a threshold of 60% usage, so that we receiv
<strong>Command Line Monitor - Log Truncate</strong>

Command run on host:
```bash
psql -U c4 c4LoggingDatabase -c 'truncate "CST_LogRecord" cascade'
```

In this monitor, we are simply launching the command that will truncate our problematic log file. This command will almost certainly be different based on the platform against which it is used or even based on system configuration. Important note here is that we set this command to only run manually (or in our case, when called as an alert action). This is to avoid the host to attempt to truncate the logs every two minutes (default collection interval).
7 changes: 5 additions & 2 deletions examples/JSON Output Extraction/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ This template shows how to monitor the output of a JSON file, then capturing spe
<strong>Command Line Monitor - Sample JSON</strong>

Command run on host:
```bash
cat %{FILE:sample.json}

```
This monitor is the method with which we retrieve the JSON file. In our case, we simply embedded a JSON file to the template (at the template level). In your setup, you will be using a different monitor to do so. This template was made to demonstrate what is done after we've collected the JSON file, so we will not be going over all the different methods of obtaining said JSON file.

Sample Output:
```json
{
"accounts": [
{
Expand All @@ -30,14 +32,15 @@ Sample Output:
},
]
}
```

<strong>Text Pre-Processing - JSON Pre-Processing</strong>

This monitor will be used to convert the JSON in a different format, in this case CSV. This will enable us to convert each line into Dynamic Instances further down the line. We set our Entry Key to /accounts/ and our properties to /userID;/firstName;/lastName;/accountLocked;/passwordExpiresIn;/daysSinceLastLogin, to match the key of the JSON file as well as specifying which properties we want included in our CSV. Finally, we set our result separator as ";", which will be the separator used in our CSV output.

<strong>Dynamic Instances - User Account Instances</strong>

In this monitor, we use dynamic instances to create one MSX instance per CSV line. This way, we will be able to separate all of the instances, so that each can be monitored independently. By specifying the separators earlier, we can now set our Column Separators as ";". Since several set of names could theoretically contain duplicates, we opted to use multiple columns to name each instance.
In this monitor, we use dynamic instances to create one Monitoring Studio X instance per CSV line. This way, we will be able to separate all of the instances, so that each can be monitored independently. By specifying the separators earlier, we can now set our Column Separators as ";". Since several set of names could theoretically contain duplicates, we opted to use multiple columns to name each instance.

<strong>Value Map - Account Locked</strong>

Expand Down
9 changes: 5 additions & 4 deletions examples/Multiple Column Separators/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ This template shows how to set multiple column separators. This is a very basic
<strong>Command Line Monitor - Sample File</strong>

Command run on host:
```bash
cat %{FILE:sampleoutput.txt}

```
This monitor is the method with which we retrieve our output to be parsed. In our case, we simply embedded a test file to the template (at the template level). In your setup, you will be using a different monitor to do so. This template was made to demonstrate what is done after we've collected the output, so we will not be going over all the different methods of obtaining said output.

```bash
Sample Output:
Name1:Test1
Name2>Test2
Name3=Test3

```
<strong>Dynamic Instances - Dynamic Examples</strong>

In this monitor, we use dynamic instances to create one MSX instance per line from out output. This way, we will be able to separate all of the instances, so that each can be monitored independently. We used 3 separate column separators (":","=" and ">" ). This can be useful when data is obtained and concatenated from several sources, or simply if we have several different separators in any given line. Any sub-monitors beyond this one will also require to have the same separators set to function properly.
In this monitor, we use dynamic instances to create one Monitoring Studio X instance per line from out output. This way, we will be able to separate all of the instances, so that each can be monitored independently. We used 3 separate column separators (":","=" and ">" ). This can be useful when data is obtained and concatenated from several sources, or simply if we have several different separators in any given line. Any sub-monitors beyond this one will also require to have the same separators set to function properly.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ This template shows how to use the numeric extraction function to read a scienti
<strong>Command Line Monitor - Scientific Notation Output</strong>

Command run on host:
```bash
echo Value:9.99e+30

```
This monitor is the method with which we retrieve our output to be parsed. In our case, we simply used echo to receive an output to parse in the next monitor. In your setup, you will be using a different monitor to do so. This template was made to demonstrate what is done after we've collected the output, so we will not be going over all the different methods of obtaining said output.

Sample Output:
```bash
Value:9.99e+30

```
<strong>Numeric Extraction - Numeric Extraction</strong>

This monitor is where we will extract the scientific notation and set whichever alerts we may want. The important thing to note is that we enabled the option "Accept Scientific Notation". To be able to use alerting against this value, we divided it by 1e+28, leaving us with a value without scientific notations.
6 changes: 4 additions & 2 deletions examples/Numeric Extraction Using Timestamps/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ This template shows how to use the numeric extraction function to read a scienti
<strong>Command Line Monitor - Timestamp Output</strong>

Command run on host:
```bash
echo Value:9.99e+30

```
This monitor is the method with which we retrieve our output to be parsed. In our case, we simply used echo to receive an output to parse in the next monitor. In your setup, you will be using a different monitor to do so. This template was made to demonstrate what is done after we've collected the output, so we will not be going over all the different methods of obtaining said output.

Sample Output:
```bash
Timestamp: 01/01/2021 00:09:00

```
<strong>Numeric Extraction - Timestamp Extraction</strong>

This monitor is where we will extract the timestamp and calculate the time difference with the current time. To do so, we changed the Value Type to Timestamp and set the Value Parameter as "Time Elapsed From Now". Addtionally, we inputted our timestamp format "%d/%m/%Y %H:%M:%S". As this will output a result in seconds, we opted to convert it into days by dividing it by 86400 (24x60x60).
11 changes: 8 additions & 3 deletions examples/Powershell Script/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ For powershell scripts to run successfully, the execution policy needs to be set
<strong>Command Line Monitor - Powershell Command Embedded File</strong>

Command run on host:
```bash
@powershell.exe -inputformat none %{FILE:samplepowershell.ps1} test example result

```
In this monitor, we use the "@powershell.exe -inputformat none" to specify that we are launching the following script through Powershell. In this scenario, we embedded a Powershell script in our template, viewable at the template root level. We also added arguments (test example result) which will be added to the output of the script ($args[0] $args[1] $args[2]). This functions exactly like it typically would for powershell scripts.

Sample output:
```bash
This is the output of my powershell script. My arguments specified
in the command line are test, example and result.

```
<strong>Command Line Monitor - Powershell Command Host File</strong>

Command run on host:
```bash
@powershell.exe -inputformat none %{FILE:samplepowershell.ps1} test example result

```
In this monitor, we use the "@powershell.exe -inputformat none" to specify that we are launching the following script through Powershell. In this scenario, we are using a Powershell script located on the host system. We also added arguments (test example result) which will be added to the output of the script ($args[0] $args[1] $args[2]). This functions exactly like it typically would for powershell scripts.

Sample output:
```bash
This is the output of my powershell script. My arguments specified
in the command line are test, example and result.
```
6 changes: 4 additions & 2 deletions examples/Service Restart on Failure/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ This template shows how to setup monitoring and an alert action in order to rest
In this monitor, we are simply selecting a service to monitor. We can set different status based on what should be the expected status of the service. We have then set an Alarm that will automatically launch our other monitor, attempting to restart the service.

Sample output:
```bash
Service Name: SNMPTRAP
Description: SNMP Trap;
State: Running (OK)
Account: NT AUTHORITY\LocalService
Exit Code: 0

```
<strong>Command Line Monitor - Service Restart Command</strong>

Command run on host:
```bash
net start SNMPTRAP

```
In this monitor, we are simply launching the command that will start our problematic service. Important note here is that we set this command to only run manually (or in our case, when called as an alert action). This is to avoid the host to attempt to truncate the logs every two minutes (default collection interval).
8 changes: 5 additions & 3 deletions examples/XML Output Extraction/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ This template shows how to monitor the output of a XML file, then capturing spec
<strong>Command Line Monitor - Sample XML</strong>

Command run on host:
```bash
cat %{FILE:sample.xml}

```
This monitor is the method with which we retrieve the XML file. In our case, we simply embedded a XML file to the template (at the template level). In your setup, you will be using a different monitor to do so. This template was made to demonstrate what is done after we've collected the XML file, so we will not be going over all the different methods of obtaining said XML file.

Sample Output:
```XML
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<accounts>
Expand All @@ -29,14 +31,14 @@ Sample Output:
<daysSinceLastLogin>1</daysSinceLastLogin>
</accounts>
</root>

```
<strong>Text Pre-Processing - XML Pre-Processing</strong>

This monitor will be used to convert the XML in a different format, in this case CSV. This will enable us to convert each line into Dynamic Instances further down the line. We set our XML Record Tag to accounts and our properties to userID;firstName;lastName;accountLocked;passwordExpiresIn;daysSinceLastLogin, to match the Record Tag of the XML file as well as specifying which properties we want included in our CSV. Finally, we set our result separator as ";", which will be the separator used in our CSV output.

<strong>Dynamic Instances - User Account Instances</strong>

In this monitor, we use dynamic instances to create one MSX instance per CSV line. This way, we will be able to separate all of the instances, so that each can be monitored independently. By specifying the separators earlier, we can now set our Column Separators as ";". Since several set of names could theoretically contain duplicates, we opted to use multiple columns to name each instance.
In this monitor, we use dynamic instances to create one Monitoring Studio X instance per CSV line. This way, we will be able to separate all of the instances, so that each can be monitored independently. By specifying the separators earlier, we can now set our Column Separators as ";". Since several set of names could theoretically contain duplicates, we opted to use multiple columns to name each instance.

<strong>Value Map - Account Locked</strong>

Expand Down

0 comments on commit 14f54b3

Please sign in to comment.