Rexmonitor
Rexmonitor is simple server monitoring service. It's strengths are:
- Quickly see basic information of a large number of machines
- Flexible notification system (write code on your data which decides whether an email is to be sent)
- It's free (for now)
How to install
- Create an account. You will receive a client id and each machine will have it's machine id.
- Download agent (StatsRecorder.exe) for your operating system. Agent is written in C# and requires .net 4.5 or higher for windows and mono 3.0 or higher for linux.
- Open StatsRecorder.exe.config and specify your
client id and machine id there.
- Schedule agent to run
once per minute (other intervals not going to work). It's important to make it run with
highest privileges (root in linux). In windows use task scheduler, in linux - crontab:
sudo crontab -e
*/1 * * * * mono /path/to/StatsRecorder.exe
- That's it - the agent will collect and send data once per minute.
Windows stats recorder
Linux stats recorder
What the data means
Agents use these performance counters:
- Cpu: Processor, Total - for summary, Processor Time - for each process
- Ram: Available MBytes - for summary, Working Set - Private - for each process
- IO (windows): IO Data Bytes/sec - "Shows the rate at which the process is reading and writing bytes in I/O operations. This counter counts all I/O activity generated by the process to include file, network and device I/O's."
- IO (linux): /proc/{pid}/io information
- Network: Bytes Sent/sec + Bytes Received/sec, summed for all interfaces
- Disk space: available space on all disks
- Nr. of processes - number of running processes
- Nr. of threads - number of threads per all processes
Notification system
Rexmonitor supports writing your own code (currently in C# only) to determine whether an email should be sent. Here is how it works:
- go to http://rextester.com and choose C#
- define "data" section for your data: starting with comment //DATA_START and ending with comment //DATA_END (in separate lines)
- within this data section define lists of long in the format
var resource_size = new List<long>();
for every resource you'll use.
Resources are: cpu, ram, disk, net, space, proc, threads
Size (max 1000) is integer meaning how many most recent datapoints (measured once per minute) will be used.
- Write whatever code using these lists. If the program outputs string starting with 1 then an email will be sent. String part after 1 is considered as additional info. Program gets evaluated every minute.
- Save this code at rextester. It'll have link in the format http://rextester.com/ID
- Use the ID and save it next to the machine (at machine management page) in the format ID;email_to_send_to, for example ABCD53570;myemail@gmail.com
- That's it. Every minute system will pull the rextester's code, substitute lists with actual data, execute program (at rextester) and send email if necessary.
Example code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
//DATA_START
var cpu_120 = new List<long>() {0}; //last 2 hours data
var ram_120 = new List<long>() {0}; //last 2 hours data
var space_1 = new List<long>() {0}; //last minute data
var RAM_MB = 0; //RAM size will be inserted (in megabytes)
var DISK_SPACE_MB = 0; //total available disk space will be inserted (in megabytes)
//DATA_END
//last 10 minutes cpu average > 90%
if(cpu_120.Skip(110).Average() > 90)
{
Console.Write("1 last 10 minutes cpu average > 90%: {0}", cpu_120.Skip(110).Average());
return;
}
//last 10 minutes ram average less than 1000Mb free
if(ram_120.Skip(110).Average() > (RAM_MB - 1000))
{
Console.Write("1 last 10 minutes ram average less than 1000Mb free: {0}", ram_120.Skip(110).Average());
return;
}
//change of cpu pattern
if(cpu_120.Take(80).Average() > cpu_120.Skip(80).Average() + 15 ||
cpu_120.Take(80).Average() < cpu_120.Skip(80).Average() - 15)
{
Console.Write("1 change of cpu pattern");
return;
}
//free disk space less than 10 Gb
if(space_1.Any(f => f > (DISK_SPACE_MB - 10000)))
{
Console.Write("1 free disk space less than 10 Gb");
return;
}
Console.Write("0");
}
}
}
Note that any code allowed at rextester C# language could be written. This includes, for example, pinging some web service and checking it's output and response time.
Support
Support google group