An all-in-one server tool which accepts and delivers messages from client applications, monitors processes, web sites and free disk space.
- Download the latest binary for your operating system from the GitHub's releases page.
- Create the configuration
settings.json
file. (See documentation below for details). - Run
serverwatcher --settings path-to-settings-json --service install
to configure the tool as a service. - Start the service.
Configures the server to run as a service using the specified configuration file.
E.g.: serverwatcher --settings ./my-config.json --service install
Removes the service from the system.
Manually starts the server service.
Manually stops the server service.
Runs the server monitoring tool as a standalone application.
Click here to expand a sample configuration file
{
"name": "Watchdog Demo",
"server": {
"port": 3004,
"apiKey": "set-some-key"
},
"log": {
"folder": "./logs",
"maxAge": "7d",
"useLocalTime": true
},
"channels": {
"default": {
"file": {
"enable": true
},
"slack": {
"enable": true,
"channel": "xxx/yyy/zzz"
},
"email": {
"enable": true,
"sender": "support@my-site.com",
"subject": " Hey listen. Something happened!!",
"receivers": [ "tech-guy@my-site.com" ],
"smtpServer": {
"username": "tech-guy@my-site.com",
"password": "{super-secret-password}",
"host": "smtp.my-site.com",
"port":25,
"useSSL": false
}
}
},
"channel1": {
"file": {
"enable": true
},
"slack": {
"enable": true,
"channel": "xxx/yyy/zzz2"
}
}
},
"webs": [
{
"url": "https://some-web.com/",
"headers": {
"Accept": "application/json"
},
"checkPeriod": "1min",
"channel": "default",
"content": [
{
"search": "<a\\s+class\\=\"link\"\\s+href\\='/block/(\\d+)'>(\\d+)</a>",
"checkChanges": [ 1 ]
}
]
},
{
"url": "https://www.google.com-invalid",
"checkPeriod": "1min",
"channel": "default"
}
],
"processes": [
{
"executableName": "**\\mongod.exe",
"includeChilds": true,
"channel": "default"
}
],
"tcpPorts": [
{
"name": "MongoDB",
"address": "127.0.0.1",
"ports": "27017",
"channel": "default"
}
],
"freeDiskSpace": [
{
"device": "/mnt/volume1",
"checkPeriod": "10secs",
"minimumSpace": "50G",
"channel": "default"
}
]
}
A custom short name for this server instance. Mainly used to differentiate several servers writing to the same location.
Defines server parameters.
The socket port number for listening for incoming connections.
A string that specifies the access token. Clients that connects to this server MUST provide the same API key. Keep this value secret.
Defines file logging parameters.
Location where text log files are stored.
Sets the maximum age to keep old log files. A new log file is created each day. Units can be: s
, sec
or secs
for seconds; m
, min
or mins
for minutes; h
,hour
or hours
for hours; d
, day
or days
for days and w
, week
or weeks
for weeks.
Boolean value indicating if timestamps should be in GMT or local computer time.
Defines one or more channels. Channels are used by client applications and the server itself to group receivers. You can share the same channel to be used by different backends.
Replace {channel-name}
with a valid object name. The default
channel is mandatory.
Designates the file configuration for this channel.
If true, a log entry is added to the file log. These log files are stored under a subdirectory with the same name of the channel inside the directory specified in the log.folder
option.
Specifies the Slack webhook configuration for this channel.
If true, messages are sent to the specified Slack channel.
Designates the target Slack WebHook channel for messaage delivery. The channel format is T00000000/B00000000/XXXXXXXXXXX
. See
this page for details.
Sets the severity type of the notification: error
, warn
, info
or debug
.
Specifies the email delivery for this channel.
If true, messages are sent by email to the specified address(es).
Indicates the sender email address.
Indicates the email's subject to use.
Indicates an array of email receiver's address.
Specifies the SMTP server connection settings.
Defines the SMTP server access user name.
Defines the SMTP server access password.
Defines the SMTP server host name.
Defines the SMTP server port.
Specifies if the connection to the SMTP server must use a secure channel.
Defines an optional array of one or more web sites to be monitored. If a site is down or the content remains the same, a warning notification is sent to the configured channels.
Specifies the web url to monitor.
Defines optionals headers to send in the request.
Establishes how often the check should be done. Time units are the same than log.maxAge
.
If a content is specified, besides checking if the web is online, its contents is checked. Define an array of one or more items to verify.
This is useful for live pages where contents usually depends on a backend server. If you render a page and the contents is the same, probably the backend is not working properly.
A regex string to search within the web page contents. Group check points inside parenthesis.
An array of checkpoint indexes to verify (first index is 1). A regex string can contain more than one grouping sequence. Specify only the relevants to check if the content changed or not.
Sets the maximum time to wait for the web to give a response. If not specified, a timeout of 10 seconds will be used.
Establishes the channel to use when a notification must be sent because the check failed.
Sets the severity type of the notification: error
, warn
, info
or debug
.
Defines an optional array of one or more TCP ports to monitor.
Specifies the name of a group of TCP ports.
Specifies the host or IP address to monitor.
Specifies a list of ports to verify on the address above. Use a comma separated list of port numbers. Also you can use #-#
to define a range of ports.
Sets the maximum time to wait for the port to connect. If not specified, a timeout of 10 seconds will be used.
Establishes the channel to use when a notification must be sent because the any of the tcp ports is not listening.
Sets the severity type of the notification: error
, warn
, info
or debug
.
Defines an optional array of one or more processes to monitor.
Specifies the process executable name. Glob wildcards (**
, *
and ?
) accepted.
Specifies optional command line arguments to include in the check. Wildcards (*
and ?
) accepted.
Specifies if forks of the same process must be monitored too.
Establishes the channel to use when a notification must be sent because the process abnormally exits.
Sets the severity type of the notification: error
, warn
, info
or debug
.
Defines an optional array of one or more disk devices to be monitored. If free disk space is smaller than the specified threshold, a warning notification is sent to the configured channels.
Specifies the directory to monitor. E.g.: C:\
, /
, /mnt/volume1/
.
Establishes how often the check should be done. Time units are the same than log.maxAge
.
The minimum required space for this disk device. Units can be b
or bytes
for bytes; k
, kb
or kilobytes
for kilobytes; m
, mb
or megabytes
for megabytes and g
, gb
or gigabytes
for gigabytes. Floating point numbers are accepted, i.e., 1.5G
.
Establishes the channel to use when a notification must be sent because the check failed.
Sets the severity type of the notification: error
, warn
, info
or debug
.
See LICENSE file.