Difference between revisions of "Subagent:PortCheck"

From NetXMS Wiki
Jump to navigation Jump to search
(Improved formatting, fixed errors.)
Line 7: Line 7:
When loaded, PORTCHECK subagent adds the following parameters to agent:
When loaded, PORTCHECK subagent adds the following parameters to agent:


ServiceCheck.* parameters:
{| class="wikitable" style="width: 70%"
{| class="wikitable" style="width: 70%"
|-
|-
Line 24: Line 25:
|-
|-
| ServiceCheck.Telnet(''target''[,''port''[,''timeout]]) || Check that Telnet service is running on ''target''.  Optional argument ''port'' specifies the port to connect with, otherwise 23 will be used.  Optional argument ''timeout'' specifies timeout in milliseconds.
| ServiceCheck.Telnet(''target''[,''port''[,''timeout]]) || Check that Telnet service is running on ''target''.  Optional argument ''port'' specifies the port to connect with, otherwise 23 will be used.  Optional argument ''timeout'' specifies timeout in milliseconds.
|}
ServiceResponseTime.* parameters:
{| class="wikitable" style="width: 70%"
|-
! Parameter !! Description
|-
|-
| ServiceResponseTime.Custom(''target'',''port''[,''timeout'']) || Same as ServiceCheck.Custom(*), but returned value is the response time of the service. See Response Codes table below.
| ServiceResponseTime.Custom(''target'',''port''[,''timeout'']) || Same as ServiceCheck.Custom(*), but returned value is the response time of the service. See Response Codes table below.
Line 56: Line 63:
|}
|}


All of the ServiceResponseTime.* parameters return the actual response time, up to uptime.<br>
All of the ServiceResponseTime.* parameters return the actual response time, up to timeout.<br>
If return value = timeout value, this means the service was unreachable.
If return value = timeout value, this means the service was unreachable.



Revision as of 12:29, 16 January 2016

This subagent can be used to check TCP ports and specifically implements checks for common services.


Provided Parameters

When loaded, PORTCHECK subagent adds the following parameters to agent:

ServiceCheck.* parameters:

Parameter Description
ServiceCheck.Custom(target,port[,timeout]) Check that TCP port is open on target. Optional argument timeout specifies timeout in milliseconds. This is a very simple test that does nothing more than check the port is open.
ServiceCheck.HTTP(target,[port],URI,hostHeader[,regex[,timeout]]) Check that HTTP service is running on target. Optional argument port specifies the port to connect with, otherwise 80 will be used. The URI is NOT a URL it is the host header request URI. As an example to test URL http://www.netxms.org/index.html enter www.netxms.org:/index.html. hostHeader is currently not used, but may be the Host option at some point in the request made. Optional argument regex is the regular expression to check returned from the request, otherwise "^HTTP/1.[01] 200 .*" will be used. Optional argument timeout specifies timeout in milliseconds.
ServiceCheck.HTTPS(target,[port],URI,hostHeader[,regex[,timeout]]) Check that HTTPS service is running on target. Arguments are the same as for ServiceCheck.HTTP(*)
ServiceCheck.POP3(target,username,password[,timeout) Check that POP3 service is running on target and that we are able to login using the supplied username and password. Optional argument timeout specifies timeout in milliseconds.
ServiceCheck.SMTP(target,toAddress[,timeout]) Check that SMTP service is running on target and that it will accept an e-mail to toAddress. The e-mail will be from noreply@DomainName using the DomainName option in the config file or its default value (see below). Optional argument timeout specifies timeout in milliseconds.
ServiceCheck.SSH(target[,port[,timeout]]) Check that SSH service is running on target. Optional argument port specifies the port to connect with, otherwise 22 will be used. Optional argument timeout specifies timeout in milliseconds.
ServiceCheck.Telnet(target[,port[,timeout]]) Check that Telnet service is running on target. Optional argument port specifies the port to connect with, otherwise 23 will be used. Optional argument timeout specifies timeout in milliseconds.

ServiceResponseTime.* parameters:

Parameter Description
ServiceResponseTime.Custom(target,port[,timeout]) Same as ServiceCheck.Custom(*), but returned value is the response time of the service. See Response Codes table below.
ServiceResponseTime.HTTP(target,[port],URI,hostHeader[,regex[,timeout]]) Same as ServiceCheck.HTTP(*), but returned value is the response time of the service. See Response Codes table below.
ServiceResponseTime.HTTPS(target,[port],URI,hostHeader[,regex[,timeout]]) Same as ServiceCheck.HTTPS(*), but returned value is the response time of the service. See Response Codes table below.
ServiceResponseTime.POP3(target,username,password[,timeout) Same as ServiceCheck.POP3(*), but returned value is the response time of the service. See Response Codes table below.
ServiceResponseTime.SMTP(target,toAddress[,timeout]) Same as ServiceCheck.SMTP(*), but returned value is the response time of the service. See Response Codes table below.
ServiceResponseTime.SSH(target[,port[,timeout]]) Same as ServiceCheck.SSH(*), but returned value is the response time of the service. See Response Codes table below.
ServiceResponseTime.Telnet(target[,port[,timeout]]) Same as ServiceCheck.Telnet(*), but returned value is the response time of the service. See Response Codes table below.

Response Codes

All of the ServiceCheck.* parameters return the following values:

Value Description
0 Success, target was connected to an returned expected response.
1 Invalid arguments were passed.
2 Cannot connect to target.
3 Invalid / Unexpected response from target.

All of the ServiceResponseTime.* parameters return the actual response time, up to timeout.
If return value = timeout value, this means the service was unreachable.

Configuration file

All configuration parameters related to PORTCHECK subagent should be placed into *PORTCHECK section of agent's configuration file. The following configuration parameters are supported:

Parameter Format Description Default value
DomainName string Set default domain name for processing. Currently this is only used by SMTP check to set the from e-mail address. netxms.org
Timeout milliseconds Set response timeout to milliseconds. 3000

Configuration Example

# This sample nxagentd.conf instructs agent to:
#   1. Load PORTCHECK subagent
#   2. Set domain name for from e-mail to netxms.demo
#   3. Default timeout for commands set to 5 seconds (5000 milliseconds)

MasterServers = netxms.demo
SubAgent = /usr/lib/libnsm_portcheck.so

*portCheck
DomainName = netxms.demo
Timeout = 5000