Skip to content

Commit

Permalink
Creation of two new use cases
Browse files Browse the repository at this point in the history
Creation of two new use cases:
All Performance Counter Instances Using Command Line
Automatic Log Truncation
  • Loading branch information
alexdgilbert committed Nov 5, 2021
1 parent 2d85385 commit 67f11f4
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<strong>All Performance Counter Instances Using Command Line</strong>
====================================================
This template shows how to monitor all Performance Counter Instances concurrently while using only a single command line monitor. In this example, we use this template to gather "% User Time" counter from all logical cores on the host. This could be ideal when using a template with a large or unknown number of cores, as this will create an instance for each core present as well as the _total instance.

<strong>Command Line Monitor - Command Gathering All Desired Performance Counter Instances</strong>

Command ran on host:
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:

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.

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

This monitor is where we will extract the PercentUserTime value and set whichever alerts we may want. Similarly as the above monitor, we need to set the Column Separator to "," and then specify the value as being in column number 3. In this example, we set the warning threshold at 95% or above and the alarm threshold at 100%.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
PATROL_CONFIG
"/SENTRY/X/useCaseAllPerformanceCounterInstances/actionList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/collectionErrorCountAutoAcknowledgeTime" = { REPLACE = "900" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/credentialsList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/databaseType" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/disabled" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/embeddedFileList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/label" = { REPLACE = "Use Case - All Performance Counter Instances Using Command Line" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/macroList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/messageList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/parameterList" = { REPLACE = "CollectionErrorCount;1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/parent" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/productVersion" = { REPLACE = "10300" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/runAlertForEachCollectionError" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/shareCookies" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/systemType" = { REPLACE = "windows" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/thresholdList" = { REPLACE = "CollectionErrorCount;0 0 0 0 0 0;1 1 2147483646 0 0 2;0 0 0 0 0 0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances/type" = { REPLACE = "Template" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/actionList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/credentials" = { REPLACE = "System Credentials" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/exitCodeStatus" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/exitCodes" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/label" = { REPLACE = "Command Gathering All Desired Perfmon Instances" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/messageList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/neverEnding" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/osCommand" = { REPLACE = "wmic path Win32_PerfFormattedData_PerfOS_Processor get Name,PercentUserTime /value /format:CSV" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/parameterList" = { REPLACE = "ExecutionTime;1,ExitCode;0,Result;1,Status;0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/parent" = { REPLACE = "useCaseAllPerformanceCounterInstances" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/pollingIntervalList" = { REPLACE = "commandLineColl;continuous;120;" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/productVersion" = { REPLACE = "10300" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/reportAsCollectionError" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/runLocally" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/thresholdList" = { REPLACE = "ExecutionTime;0 0 0 0 0 0;1 30 2147483646 0 0 1;0 0 0 0 0 0,Status;0 0 0 0 0 0;1 1 1 0 0 1;1 2 2 0 0 2" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/timeout" = { REPLACE = "30" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances/type" = { REPLACE = "CommandLine" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/actionList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/deleteMissingWhen" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/excludeRegExp" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/fieldSeparators" = { REPLACE = "[__SW_SENTRY__],[__SW_SENTRY__]" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/identicalIDAction" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/instancesLabel" = { REPLACE = "Processor %{2}" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/instancesObjectID" = { REPLACE = "%{2}" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/keepRegExp" = { REPLACE = "[0-9]" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/label" = { REPLACE = "Performance Counter Instances" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/messageList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/parameterList" = { REPLACE = "Present;1,Result;1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/parent" = { REPLACE = "useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/productVersion" = { REPLACE = "10300" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/quoteCharacter" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/reportAsCollectionError" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/thresholdList" = { REPLACE = "Present;0 0 0 0 0 0;1 0 0 0 0 2;0 0 0 0 0 0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/type" = { REPLACE = "DynamicObjects" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances/uniqueSeparator" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/actionList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/canBeNegative" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/columnMode" = { REPLACE = "3" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/convertUnits" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/discardNegativeDelta" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/fieldNumber" = { REPLACE = "3" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/fieldSeparators" = { REPLACE = "[__SW_SENTRY__],[__SW_SENTRY__]" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/label" = { REPLACE = "Percent User Time" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/lineMode" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/messageList" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/monitoredValue" = { REPLACE = "number" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/numericFormat" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/parameterList" = { REPLACE = "Delta;0,DeltaPercentage;0,DeltaPerHour;0,DeltaPerMinute;0,DeltaPerSecond;0,Present;0,Value;1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/parameterType" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/parent" = { REPLACE = "useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/productVersion" = { REPLACE = "10300" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/quoteCharacter" = { REPLACE = "" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/reportAsCollectionError" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/scale" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/scaleOption" = { REPLACE = "1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/scientificNotation" = { REPLACE = "0" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/thresholdList" = { REPLACE = "Value;0 0 0 0 0 0;1 100 100 0 0 2;1 95 2147483646 0 0 1" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/type" = { REPLACE = "NumericExtraction" },
"/SENTRY/X/useCaseAllPerformanceCounterInstances:commandGatheringAllDesiredPerformanceCounterInstances:performanceCounterInstances:percentUserTime/uniqueSeparator" = { REPLACE = "0" }
27 changes: 27 additions & 0 deletions examples/Automatic Log Truncation/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<strong>Automatic Log Truncation</strong>
====================================================
This template shows how to monitor a partition size and truncate the associated log to free up space. This specific example was done for EMC VNXe hosts where monitoring of the system caused the audit logs to swell to problematic sizes.

<strong>Command Line Monitor - Command Log Size Verification</strong>

Command ran on host:
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:
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.

We then also added an alarm alert at a threshold of 60% usage, so that we receive an alert if for some reason, the log truncation does not clear space, meaning we will need the system admin to review the situation.

<strong>Command Line Monitor - Log Truncate</strong>

Command ran on host:
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).
Loading

0 comments on commit 67f11f4

Please sign in to comment.