monjs
v1.4.0
Published
Painless performance monitoring for Windows.
Downloads
34
Readme
mon
Painless performance monitoring for Windows.
Features
- Monitor local and remote Windows machines (even from Mac OS or Linux).
- Completely customizable.
- Support for thresholds.
- Support for statistical functions.
- Support for lists.
- Support for formulas.
- Support for variables.
- Support for custom number formats.
- Automatic process ID to IIS application pool mapping.
- Support for exporting data to Elasticsearch.
Install
npm install -g monjs
Usage
Monitor the local machine:
mon [<configfile>]
Monitor a remote machine:
mon --server <address>:<port> [<configfile>]
Note: If no config file is specified, the default (and very simple) config is used.
Start a server that lets client connect to and monitor the local machine:
mon serve [--port <port>]
Warning 1: There is no authentication mechanism in this version. Any person who knows the address and port of the server can connect and view its status. Make sure to have proper firewall settings in place.
Warning 2: Data is sent in plain text over an unencrypted HTTP connection in this version. HTTPS support will be added soon.
Config File
To use mon you need to provide it with a config file that specifies which metrics you want to monitor. There are some sample config files in the config directory that you can use as a template.
The format of the config file is as follows:
Counters
The primary usage of mon is to view values of various Performance Counters that are available in Windows.
To monitor a counter, simply specify its name in the list of counters:
If you need to specify other properties for the counter like format or threshold, use the detailed format:
Thresholds
There are three levels of threshold (ok, warning, critical) that you can set for each counter to easily see if they are above or below the desired value.
Statistical Functions
To get a clearer understanding of how some metrics are doing, you can apply statistical functions like avg and sum to counters.
The following example displays the 60-sample moving average of the % Processor Time counter:
Lists
In addition to displaying values of counters, mon is able to retrieve values of all instances of a counter and compile them into a list. This is very useful for monitoring metrics like top CPU or memory usage.
Lists support thresholds and statistical functions too.
The following example displays a list of top 10 CPU intensive processes along with the 60-sample moving average of the list to provide a better view of the system performance:
Formulas
You can apply any formula to a counter to transform its value:
This is particularly useful for the \\Process(*)\\% Processor Time
counter to display its value in percentage:
Inside your formula, you can use the value
and env
variables to respectively access the counter's original value and a list of server's environment variables.
Variables
Sometimes you need to monitor a set of similar metrics for different applications (for example multiple ASP.NET web sites). Instead of creating a separate config file for each of these applications, you can create a single config file and use variables instead.
In your config file replace the name of the instance with your variable:
and supply a value for it at startup:
mon [<configfile>] --var apppool=mysite1
mon --server <address>:<port> [<configfile>] --var apppool=mysite1
Process IDs
By default, Performance Counters report multiple processes that have the same name by appending a number to their name (like w3wp#1, w3wp#2, etc).
To have them append the ID of the process instead (like w3wp_1234), follow the instructions in this article: KB281884.
This allows mon to map w3wp processes to their corresponding IIS application pools. Make sure to run mon as admin for this feature to work.
Version History
- 1.3
- Added timestamp to logs.
- Fixed a bug that caused Perfmon to start twice on systems that IIS was not installed.
- 1.2.1
- Fixed a bug that caused mon not to start on systems that IIS was not installed.
- 1.2
- Added support for saving data to Elasticsearch.
- Fixed a bug where Perfmon returned invalid data.
- 1.1
- Added support for formulas.
- 1.0
- Initial release
Author
Soheil Rashidi
- http://soheilrashidi.com
- http://twitter.com/soheilpro
- http://github.com/soheilpro
Copyright and License
Copyright 2014-2018 Soheil Rashidi
Licensed under the The MIT License (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.opensource.org/licenses/mit-license.php
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.