The current version can contains some specific custom part for collect which exist in the request header. For instance, the following POST request contains custom part ('mon-platform' and 'mon-version') that can be processed
http://127.0.0.1:8080/?get=22&user=simon&key=0898766jwehiweqyhdied823&command=calculate mon-platform: linux32 mon-version: 3.010 Content-Type: text/x-log Filename: /home/monitis/log/queue.log
Generally, this monitor architecture can be depicted as the following
Whole set of measured parameters divided on two parts
fixed that can be defined beforehand
flexible that mostly isn't fixed and can be changing time by time
You need to add the following two lines in your code
var monitor = require('monitor');// insert monitor module-plugin .... monitor.Monitor(server);//add server to monitor
Beginning this time the monitor will be collecting the measuring data and sending them by HTTP request that should correspond to the following pattern.
http://127.0.0.1:10010/node_monitor?action=getdata&access_code=monitis where 10010 - the listen port of monitor plugin 'node_monitor' - the pathname keyword 'action-getdata' - command for getting collected data 'access_code' - the specially generated access code that is changing for every session
Please notice that monitor plugin for security reason currently listen localhost only
It will periodically ask node server plugin for measured data. If Node server doesn't start yed or down script will send corresponding information to the monitis. As Node server will be available the measure will be grabbing and sending to the monitis.
To use existing scripts you will need to do some changes that will correspond your account and data
in monitis_constant.sh - replace ApiKey and SecretKey by your keys values (can be obtained from your Monitis account) in monitor_constant.sh - replace MONITOR_NAME, MONITOR_TAG and MONITOR_TYPE by your desired names - replace RESULT_PARAMS and ADDITIONAL_PARAMS strings by data formats definition of your monitor - replace MON_SERVER string by your server IP address (it is necessary for title only) - you may do also definition of DURATION between sending results (currently it is declared as 5 mins) - optionally you can also change the node server monitor access url - NODE_MONITOR and other constats (strongly no recommended)
That's all. Now you can run nmon_start.sh and monitoring process will be started.
To do so you should use nmon_getdata.sh script by following pattern
nmon_getdata.sh -d <number of days to get data for> -p <directory path to storing data-files> -f <file name prefix> -m <monitor id> where -d parameter specifies how many days data do you want to get (default value is 1 day) NOTE: each day's data will be stored in the separate files -p parameter specifies the directory which will keep the data-files to (by default it is current directory) -f parameter specifies the prefix for file name which will contain data (by default it is monitor name defined in monitor_constats.sh) -m monitor registration ID
Notice that all parameters are optional.
The monitor registration ID should be specified in extreme situation only, e.g. if you have several monitors with same name or some monitor was deleted by accidentally but its data is very important.
After finishing you will see few files named like "NServer_Monitor_10.137.25.15_2012-03-11.log"
There are some dependencies for monitor plugin
The shell script use curl package to provide HTTP access to the Monitis server and monitor plugin.
To check the correctness of monitor workability, some Node test-servers are included in the package.
So, you can start Node server by command
It is listening on two ports - HTTPS (8443) and HTTP (8080) which both are under monitor.
Double-clicking on any line can be switching fixed (tabular view) to the flexible one.
You can also see the grafical view for any numerical values.
It can be noticed that the testing Node server is alive and have quite good state.