NetXMS Support Forum

English Support => General Support => Topic started by: augusteDOUAMBA on August 22, 2024, 02:32:18 PM

Title: Help : Unable to get SMTP service to work
Post by: augusteDOUAMBA on August 22, 2024, 02:32:18 PM
Hi !! need help for smtp service monitoring!! I first tried to monitor the service as an object, I got the value 4 internal error in the dci section.
Afterwards I tried to monitor the service like a DCI but I got a value of 5.
unable to find the problem.

Can you give me examples of creating an SMTP monitoring service via object and  via dci? THANKS
Title: Re: Help : Unable to get SMTP service to work
Post by: Tatjana Dubrovica on August 23, 2024, 05:23:40 PM
We do not have SMTP service monitoring. Usually Node with SNMP is just created and credentials are correctly configured and then NetXMS is automatically detects if SNMP is no more responsing.
If we are talking about service - we do not have special service for SMTP. But you can use telnet. I tested this approach by creating next DCI on my management node with IP of SNMP device:
NetworkService.Status(telnet://10.5.5.11:22)

As for the service I've just created service object under the node with SNMP with telnet + 22 port options and it is working. 
Title: Re: Help : Unable to get SMTP service to work
Post by: augusteDOUAMBA on August 25, 2024, 10:10:27 AM
thanks for the feedback. 
actually this approach with the telnet scheme on the port works.
however there is a functionality in the network service monitoring that I was able to test before it stopped working: on a node, I created an SMTP network service and provided an email address. a test message was sent to check the status of the SMTP service. Recently this approach no longer works I have a result 4.
I also tried with your approach by creating a dci with the curl smtp scheme and I got result 5.

SMTP scheme is no longer supported?

Title: Re: Help : Unable to get SMTP service to work
Post by: Tatjana Dubrovica on August 26, 2024, 06:12:11 PM
Sorry it's my bad. I read SNMP instear of SMTP. SMTP is supported and should work.
DCI configuration should look like: NetworkService.Status(smtps://domain.org, [email protected], [email protected])

From is optional named parameter, default value is taken from subagent configuration and with no changes will be "[email protected]".
In order to debug problem you should increase debug level to 6 on agent that collects this value. You can increase debug only for "netsvc" debug tag. In my case I had error like this, having 5 as a result of DCI:
2024.08.26 17:39:01.212 *D* [netsvc            ] NetworkServiceStatus_SMTP(smtps://domain.org): call to curl_easy_perform failed (55: RCPT failed: 554)

In Service configuration as an object you should set destination e-mail as Request data. And you can debug errors in the same way as with previous one by increasing debug level on the agent. You will get errors like: 
2024.08.26 18:06:52.008 *D* [netsvc            ] CheckSMTP(smtp//127.0.0.1:465): call to curl_easy_perform failed (7: Failed to connect to 127.0.0.1 port 465 after 0 ms: Couldn't connect to server)
Title: Re: Help : Unable to get SMTP service to work
Post by: augusteDOUAMBA on September 10, 2024, 03:35:35 PM
thanks for the feedback!!  
I have the same error as you described (call to curl_easy_perform failed + Couldn't connect to server). 
do you know how I could solve it? 
I'am unable  to find   the problem . the SMTP server is accessible and I even receive email  from netxms SMTP notification channel .

thank

Title: Re: Help : Unable to get SMTP service to work
Post by: Filipp Sudanov on September 10, 2024, 07:17:36 PM
Note that there are two options:

NetworkService.Status(smtp://domain.org:port)
NetworkService.Status(smtps://domain.org:port)

Try specifying port in the metric, e.g. NetworkService.Status(smtps://domain.org:465), make sure you can connect to that port using telnet from your netxms server's command line, e.g.:

telnet domain.org 465
Title: Re: Help : Unable to get SMTP service to work
Post by: augusteDOUAMBA on September 11, 2024, 09:56:02 PM

HI,
the telnet request goes through without a problem and I had already tried adding the port but nothing happened, the returned value is 5.

Debugging for SMTP and SMTPs gives this: 
CheckSMTP(smtp//x.x.x.x:25): call to curl_easy_perform failed (28: Operation timed out after 10001 milliseconds with 0 bytes received)
NetworkServiceStatus_SMTP(smtps://x.x.x.x:465): call to curl_easy_perform failed (60: SSL: no alternative certificate subject name matches target host name '10.165.23.151').

telnet on 25 and 465 port of smtp server Works 
Title: Re: Help : Unable to get SMTP service to work
Post by: Victor Kirhenshtein on September 19, 2024, 02:44:23 PM
Hi,

from error message for checking smtps on port 465, looks that you have to provide server DNS name instead of IP address.

for port 25 - when you do telnet on that port, do you receive initial SMTP response?

Best regards,
Victor
Title: Re: Help : Unable to get SMTP service to work
Post by: uldis on September 20, 2024, 12:35:23 PM
Hi Auguste
Just further on my colleagues feedback above - those " call to curl_easy_perform failed (28: Operation timed" error messages seem to be pretty notorious for resolving and there are several steps suggested, very much trial and error approach. Is there a firewall of any kind between netxms server and your mail server or on either of node themselves? If yes, please try to disable it and perform a new test. If it still fails then you may wish to set up concurrent tcpdump on server and also on mail server, then perform another test and see with Wireshark if any packets are reaching and where the delay is.