Network Service Monitoring
There are two options to add service monitoring: the first one is to add it through node menu option Create –> Create Network Service… as an object with the status that will be propagated on a node, and the second one is to add it’s monitoring as DCI.
Network Service Object
Object representing network service running on a node (like http or ssh), which is accessible online (via TCP IP). Network Service objects are always created manually. Currently, the system works with the following protocols - SSH, POP3, SMTP, FTP, HTTP, HTTPS, Telnet and Custom protocol type. For Custom protocol, user should define TCP port number and the system will be checking if it’s possible to establish connection to that port. For the predefined standard services the system will also check whether an appropriate response is returned. In case of SMTP, the system will send a test mail, in case of POP3 – try to log in with a certain user, in case of HTTP – check whether the contents of a desired web page correspond to a certain given template. As soon as the Network Service object is created, it will be automatically included into the status poll. Each time when the status poll for the particular node is carried out, all Network Service objects are polled for a reply. If an object’s reply corresponds to a certain condition, its status is set as NORMAL. If an object is not responding, it’s status will be changed to CRITICAL. It is possible to create a DCI that will collect status of Network Service object.
In default configuration request is done with the help of NetSVC subagent on the server node. If it should be done through different node is should be changed in it’s properties after service creation by selecting Poller node. There is also possibility to set number of polls that is required to be sure that state have changed.
Network service monitoring using DCI
Second option is to use DCI to monitor service. Service monitoring metrics are provided by NetSVC subagent.
More about URL options caon be found there: https://curl.se/docs/url-syntax.html
This subagent will add the following metrics to list of metrics available on agent:
Metric Name |
Description |
---|---|
HTTP.Checksum.MD5(URL, [named parameters]) HTTP.Checksum.SHA1(URL, [named parameters]) HTTP.Checksum.SHA256(URL, [named parameters]) |
Calculate hash for the provided URL. Port number can be specified in the URL. http and https schemes are supported in the URL. Calculates hash only if web server returns 200 status code. Starting from second parameter this metric accepts named parameters in name = value form. When parameter(s) are used, they should be used without [ ]. The following parameters are supported (all parameters are optional):
|
NetworkService.Status(URL, [named parameters]) |
Check status of network service and return numeric value denoting the result. Port number can be specified in the URL. URL supports the following schemes: http, https, ssh, telnet, tcp, smtp and smtps. For ssh protocol connection is established. For telnet it’s checked that host sends some characters after connection is established. For tcp only ability to establish connection to specified port is checked. For smtp and smtps test email is being sent. Starting from second parameter this metric accepts named parameters in name = value form. When parameter(s) are used, they should be used without [ ]. Optional parameter supported for all schemes:
Parameters supported for http and https schemes (all parameters are optional):
Parameters supported for smtp and smtps schemes:
Parameters supported for all schemas except ssh, telnet, tcp:
Metric returns one of the following values:
|
NetworkService.ResponseTime(URL, [named parameters]) |
Measures response time, returns value in milliseconds. For http and https schemas time to fully load the web page is measured. Metric support same parameters as NetworkService.Status. |
NetworkService.TLSStatus(host, port, [named parameters]) |
Check remote TLS service and return return numeric value denoting the result. Starting from third parameter this metric accepts named parameters in name = value form. When parameter(s) are used, they should be used without [ ]. The following optional parameter is supported:
Metric returns one of the following values:
|
NetworkService.TLSResponseTime(host, port, [named parameters]) |
Measures time to perform TLS handshake, returns value in milliseconds. Metric support same parameters as NetworkService.TLSStatus. |
TLS.Certificate.ExpirationDate(host, port) |
Returns expiration date (YYYY-MM-DD) of X.509 certificate of remote TLS service |
TLS.Certificate.ExpirationTime(host, port) |
Returns expiration time (Unix time) of X.509 certificate of remote TLS service |
TLS.Certificate.ExpiresIn(host, port) |
Returns number of days until expiration of X.509 certificate of remote TLS service |
TLS.Certificate.Issuer(host, port) |
Returns issuer of X.509 certificate of remote TLS service |
TLS.Certificate.Subject(host, port) |
Returns subject of X.509 certificate of remote TLS service |
TLS.Certificate.TemplateID(host, port) |
Returns template ID of X.509 certificate of remote TLS service |
Examples
NetworkService.Status(http://www.netxms.org)
NetworkService.Status(http://www.netxms.org, response-code=200)
NetworkService.Status(http://www.netxms.org, follow-location=true, response-code=200)
NetworkService.Status(https://netxms.org, pattern="^HTTP\/(1\.[01]|2) 200 .*")
NetworkService.Status(http://www.netxms.org, include-headers=false,
pattern=".*Moved Permanently.*")
NetworkService.Status(https://a.web.site.with.self.signed.certificate)
NetworkService.Status(https://a.web.site.with.self.signed.certificate,
verify-peer=false)
NetworkService.Status(tcp://netxms.org:80)
NetworkService.Status(tcp://netxms.org:88, timeout=2000)
NetworkService.ResponseTime(https://www.google.com)
NetworkService.TLSStatus(netxms.org, 443)
NetworkService.TLSResponseTime(www.google.com, 443)
NetSVC configuration
This subagent performs network services checks by employing libcurl. More information about syntax can be found here: http://curl.haxx.se/docs/manpage.html.
Note
If agent is build from sources, then libcurl-dev should be installed to build netsvc subagent.
To operate, NetSVC subagent should be loaded. All configuration parameters related to NetSVC subagent should be placed into [netsvc] section of agent’s configuration file. The following configuration parameters are supported:
Parameter |
Description |
Default value |
---|---|---|
CA |
Path to a file holding one or more certificates to verify the peer with (CURLOPT_CAINFO) |
|
DomainName |
Used in SMTP check. Default from email address is composed as noreply@DomainName. |
netxms.org |
NegativeResponseTimeOnError |
For metrics that measure response time, return negative time value instead of data collection error. |
false |
VerifyPeer |
Verify peer certificate |
true |
Timeout |
Timeout in milliseconds. |
Agent’s configuration file example:
SubAgent = netsvc
[netsvc]
Timeout = 3000