|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Net
Network monitoring APIs
To include in a script add the following to the top of the script file.
var net = require('net');
The following functionality is provided:
Nested Class Summary | |
---|---|
static interface |
Net.PingResult
The result of a ping request. |
static interface |
Net.TraceRouteResult
The result of a traceroute request. |
Method Summary | |
---|---|
TcpSocket |
newSocket()
Creates a new TCP socket. |
TcpSocket |
newSslSocket()
Creates a new SSL socket. |
UdpSocket |
newUdpSocket()
Creates a new UDP socket. |
Net.PingResult |
ping(java.lang.String hostName)
Tests whether a network ip or hostname is reachable. |
Net.PingResult |
ping(java.lang.String hostName,
long timeoutMS)
Tests whether a network ip or hostname is reachable. |
Net.PingResult |
ping(java.lang.String hostName,
long timeoutMS,
int numPingPackets)
Tests whether a network ip or hostname is reachable. |
Net.TraceRouteResult |
traceroute(java.lang.String hostName)
Performs a traceroute. |
Net.TraceRouteResult |
traceroute(java.lang.String hostName,
long timeoutMS)
Performs a traceroute. |
Net.TraceRouteResult |
traceroute(java.lang.String hostName,
long timeoutMS,
int packetsPerHop)
Performs a traceroute. |
boolean |
verifyCertificateOCSP(java.lang.String certFilePath,
java.lang.String issuerCertFilePath,
java.lang.String responderURI,
java.lang.String responderCertFilePath,
java.lang.String dateString)
Verify certificate validity. |
long |
verifyPop(java.lang.String hostname)
Verify a POP3 server is alive and working correctly. |
long |
verifyPop(java.lang.String hostname,
int port)
Verify a POP3 server is alive and working correctly. |
long |
verifyPop(java.lang.String hostname,
java.lang.String username,
java.lang.String password)
Verify a POP3 server is alive and working correctly. |
long |
verifyPop(java.lang.String hostname,
java.lang.String username,
java.lang.String password,
int port)
Verify a POP3 server is alive and working correctly. |
long |
verifySmtp(java.lang.String hostname)
Verify a SMTP server is alive, and functioning correctly. |
long |
verifySmtp(java.lang.String hostname,
java.lang.String emailAddress)
Verify a SMTP server is alive, and functioning correctly. |
long |
verifySmtp(java.lang.String hostname,
java.lang.String emailAddress,
int port)
Verify a SMTP server is alive and functioning correctly. |
long |
verifySntp(java.lang.String hostname,
int port,
int ntpVersion,
int timeoutMS)
Verify an SNTP server is alive and working correctly. |
Method Detail |
---|
TcpSocket newSocket()
TcpSocket
TcpSocket newSslSocket()
TcpSocket
UdpSocket newUdpSocket()
UdpSocket
Net.PingResult ping(java.lang.String hostName) throws java.lang.Exception
Firewalls and server configuration may block requests resulting in a unreachable status while some specific ports may be accessible.
By default 4 ping attempts are made to the host.
By default there is a timeout of 1 second per attempt.
hostName
- the hostname to ping
java.lang.Exception
- when the server is unreachable
java.lang.Exception
- when the server doesn't respond within the timeoutNet.PingResult ping(java.lang.String hostName, long timeoutMS) throws java.lang.Exception
Firewalls and server configuration may block requests resulting in a unreachable status while some specific ports may be accessible.
The timeout value, in milliseconds, indicates the maximum amount of time the try should take. If the operation times out before getting an answer, the host is deemed unreachable. A negative value will result in an IllegalArgumentException being thrown.
By default 4 ping attempts are made to the host.
hostName
- the hostname to pingtimeoutMS
- The time, in milliseconds, before the call aborts
java.lang.Exception
- when the server is unreachable
java.lang.Exception
- when the server doesn't respond within the timeoutNet.PingResult ping(java.lang.String hostName, long timeoutMS, int numPingPackets) throws java.lang.Exception
The timeout value, in milliseconds, indicates the maximum amount of time the try should take. If the operation times out before getting an answer, the host is deemed unreachable. A negative value will result in an IllegalArgumentException being thrown.
The number of ping packets to send can be specified. A negative value will result in an IllegalArgumentException being thrown.
hostName
- the hostname to pingtimeoutMS
- The time, in milliseconds, before the call abortsnumPingPackets
- The number of pings to send in total.
java.lang.Exception
- when the server is unreachable
java.lang.Exception
- when the server doesn't respond within the timeoutNet.TraceRouteResult traceroute(java.lang.String hostName)
Tracks the route of packets follow to a given hostname or ip address. traceroute() utilizes the IP protocol `time to live' field to probe the route to the host, one gateway after another. The probe datagram length on Windows agents is 32 bytes. On Linux this is 40 bytes.
Waits for 30 seconds by default, before timing out.
Default number of packets per hop is 2.
hostName
- the hostname or IP address to find the route to.
Net.TraceRouteResult traceroute(java.lang.String hostName, long timeoutMS)
Tracks the route of packets follow to a given hostname or ip address. traceroute() utilizes the IP protocol `time to live' field to probe the route to the host, one gateway after another. The probe datagram length on Windows agents is 32 bytes. On Linux this is 40 bytes.
Default number of packets per hop is 2.
hostName
- the hostname or IP address to find the route to.timeoutMS
- The time, in milliseconds, before the call aborts.
Net.TraceRouteResult traceroute(java.lang.String hostName, long timeoutMS, int packetsPerHop)
Tracks the route of packets follow to a given hostname or ip address. traceroute() utilizes the IP protocol `time to live' field to probe the route to the host, one gateway after another. The probe datagram length on Windows agents is 32 bytes. On Linux this is 40 bytes.
hostName
- the hostname or IP address to find the route to.timeoutMS
- The time, in milliseconds, before the call aborts.packetsPerHop
- the max number of hops to try.
long verifySmtp(java.lang.String hostname)
hostname
- hostname of SMTP server to query
long verifySmtp(java.lang.String hostname, java.lang.String emailAddress)
A "MAIL" and "RECP TO" command are sent with the email address given.
Connects on port 25 by default.
hostname
- hostname of SMTP server to queryemailAddress
- the email address to verify
long verifySmtp(java.lang.String hostname, java.lang.String emailAddress, int port)
A "MAIL" and "RECP TO" command are sent with the email address given.
hostname
- hostname of SMTP server to queryemailAddress
- the email address to verifyport
- port to connect to
long verifyPop(java.lang.String hostname)
hostname
- the POP3 server to query
long verifyPop(java.lang.String hostname, int port)
hostname
- the POP3 server to queryport
- specify a port
long verifyPop(java.lang.String hostname, java.lang.String username, java.lang.String password)
hostname
- the POP3 server to queryusername
- account username to usepassword
- account password to use
long verifyPop(java.lang.String hostname, java.lang.String username, java.lang.String password, int port)
hostname
- the POP3 server to queryusername
- account username to usepassword
- account password to useport
- specify a port
long verifySntp(java.lang.String hostname, int port, int ntpVersion, int timeoutMS)
An exception is thrown if the request times out or if the hostname does not resolve.
Another API,Sntp
, can be used for more control over the request
and access to the response structure use.
hostname
- the NTP server hostname to queryport
- the server port to send the query tontpVersion
- the ntp version, can be set to either 3 or 4timeoutMS
- timeout in milliseconds
boolean verifyCertificateOCSP(java.lang.String certFilePath, java.lang.String issuerCertFilePath, java.lang.String responderURI, java.lang.String responderCertFilePath, java.lang.String dateString) throws java.lang.Exception
Verify certificate validity.
An exception is thrown if the certificate is not valid.
certFilePath
- path to the file containing the certificate to be verifiedissuerCertFilePath
- path to the file containing the certificate of the issuer of the certificate to be verifiedresponderURI
- URI of the OCSP server to be queriedresponderCertFilePath
- path to the file containing the OCSP server certificatedateString
- date the certificate is to be validated for, in the form "MM/dd/yyyy"
java.lang.Exception
- describes reason certificate check failed
|
© 2023 Vercara, LLC. All Rights Reserved. | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |