Skip to main content
Solved

email Notification not working, upgraded 2.8.32 to 21.10

  • March 4, 2022
  • 16 replies
  • 2079 views

muhammed.suhile
Forum|alt.badge.img+3

upgraded from 2.8.32 to 21.10 and notification not working.

Host timeline showing as alerted user, but mail is not receiving for alerts.

Relayhost is already set and test echo email is working fine.

 

No traces of notification mail in /var/log/maillog apart from test email.

 

Any ideas how to trace the issue ? 

Best answer by sduret

Hello @muhammed.suhile 


It’s a known issue but these macros are deprecated:
https://github.com/centreon/centreon-engine/issues/484

Can you define the admin mail address directly in the command or use a different macro?

16 replies

itoussies
Centreonian
Forum|alt.badge.img+11
  • Centreonian
  • March 4, 2022

Hello @muhammed.suhile,

What are the commands used for your notifications by email ? Try to execute them manually to see if they work.


muhammed.suhile
Forum|alt.badge.img+3

I used below command to test and that worked but alert from centreon is not receiving.

echo "This is a test" | mail -s "My subject" yourmailaddr@youroffice.com


itoussies
Centreonian
Forum|alt.badge.img+11
  • Centreonian
  • March 4, 2022

I meant the one used by centengine. You can find the one used on the contact page of the involved users and its command line on the Configuration  >  Commands  >  Notifications menu.


muhammed.suhile
Forum|alt.badge.img+3

Sorry, I got confused. I am using default email host-notify-by-email command.

/usr/bin/printf "%b" "***** Centreon notification *****\n\nType:    $NOTIFICATIONTYPE$\nHost:    $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:   $HOSTSTATE$\nSince:   $HOSTDURATION$\nInfo:    $HOSTOUTPUT$" | @MAILER@ -s "$HOSTNAME$ - $HOSTSTATE$ - $DATE$ $TIME$" -r "Centreon <centreon-engine>" -S replyto="Centreon admin <$ADMINEMAIL$>" $CONTACTEMAIL$

I am getting error “-bash: @MAILER@: command not found” when I run the commands directly.

I have verified that mailx is installed and its latest version. 


itoussies
Centreonian
Forum|alt.badge.img+11
  • Centreonian
  • March 4, 2022

Perfectly normal, your OS doesn’t know what “$NOTIFICATIONTYPE$”, “@MAILER@”, and so on means but centengine does.

What is your “Directory + Mailer Binary” command on the page Administration  >  Parameters  >  Monitoring ?


muhammed.suhile
Forum|alt.badge.img+3

Directory + Mailer Binary  =  /bin/mail


itoussies
Centreonian
Forum|alt.badge.img+11
  • Centreonian
  • March 7, 2022

Is the affected Host on the Central or on a poller ? In Centreon < 21.10, it is the pollers who send the notifications. If so, you should also test if you can receive notifications from them.


muhammed.suhile
Forum|alt.badge.img+3

Its on Central


Forum|alt.badge.img+1
  • Steward *
  • March 8, 2022

Hi, I have the same problem as the author :no_mouth: 

What is the manipulation to do so that the centreon-engine user can send the alerts?


sduret
Centreonian
Forum|alt.badge.img+13
  • Centreonian
  • March 8, 2022

Hello
I invite you to enable the notification debug.

To do it, please go on “Configuration  >  Pollers  >  Engine configuration” , click on the central configuration and go to the Debug tab.
Here you can enable the “Notification information” and “Commands” boxes.

You will need to generate and export the configuration.

Now you can do some alert tests (host becomes in DOWN HARD state) and check the file /var/log/centreon-engine/centengine.debug.


Forum|alt.badge.img+1
  • Steward *
  • March 8, 2022

Thx, i have these two lines

[1646749579] [12750] HOST NOTIFICATION: User;machine;DOWN;host-notify-by-email;CRITICAL - 192.168.1.239: Host unreachable @ 192.168.1.237. rta nan, lost 100%
[1646749579] [12750] HOST NOTIFICATION: User1;machine;DOWN;host-notify-by-email;CRITICAL - 192.168.1.239: Host unreachable @ 192.168.1.237. rta nan, lost 100%

I have two users with two different addresses (office365 & Gmail). But still no email, the file gives me no other information


muhammed.suhile
Forum|alt.badge.img+3

@sduret @itoussies 

I digged into /var/log/centreon-engine/centengine.debug and found the right command using by Centreon for alert which is below.

/bin/sh -c '/usr/bin/printf "%b" "***** Centreon notification *****\n\nType:    PROBLEM\nHost:    LITTLETON_MA_FG_Firewall\nAddress: XX.XX.XX.X\nService: VPN\nState:   CRITICAL\nSince:   0d 5h 4m 37s\nInfo:    CRITICAL: XXX_LITTLETON_MA.XXX.com (Master: XXXXXXXXX): Active SSL-VPN Connections/Tunnels: 0/0: IPSEC Tunnels: Configured/Active: 14/3 DOWN[XXXXXX,XXXXXXX,XXXXXXX,XXXXXXXX]" | /bin/mail -s "LITTLETON_MA_FG_Firewall/VPN - CRITICAL - 08-03-2022 12:15:40" -r "Centreon <centreon-engine>" -S replyto="Centreon admin <>" v-muhammed.suhile@XXXXXXX.com'

I ran the command directly and I am getting below.

No such file or directory
"/root/dead.letter" 8/466
. . . message not sent.

Any thoughts ?


muhammed.suhile
Forum|alt.badge.img+3

I can see all notifications in the /var/lib/centreon-engine/dead.letter file


muhammed.suhile
Forum|alt.badge.img+3

@sduret I have Identified the issue, The issue is the command has missing value for $ADMINEMAIL$. I have verified that admin email is added to “Configuration  >  Pollers  >  Engine configuration > Admin > Administrator Email Address”.

But the Centreon is not pulling the value. Anyway to fix this ?


sduret
Centreonian
Forum|alt.badge.img+13
  • Centreonian
  • Answer
  • March 9, 2022

Hello @muhammed.suhile 


It’s a known issue but these macros are deprecated:
https://github.com/centreon/centreon-engine/issues/484

Can you define the admin mail address directly in the command or use a different macro?


sduret
Centreonian
Forum|alt.badge.img+13
  • Centreonian
  • March 9, 2022

Hello @Davidd 
You’re right, you will need to enable these options:

After the configuration export, you should see the notification command in the centengine.debug file:

[1646811778] [5800] **** END MACRO PROCESSING *************
[1646811778] [5800] Processed notification command: /bin/sh -c '/usr/bin/printf "%b" "***** centreon Notification *****\n\nType:PROBLEM\nHost: win-aws-hm\nState: DOWN\nAddress: 10.10.10.10\nInfo: CRITICAL - 10.10.10.10: rta nan, lost 100%\nDate/Time: 09-03-2022" | /bin/mail -s "Host DOWN alert for win-aws-hm!" admin@locahost'
[1646811778] [5800] HOST NOTIFICATION: Admin_English;win-aws-hm;DOWN;host-notify-by-email;CRITICAL - 10.10.10.10: rta nan, lost 100%
[1646811778] [5800] Running command '/bin/sh -c '/usr/bin/printf "%b" "***** centreon Notification *****\n\nType:PROBLEM\nHost: win-aws-hm\nState: DOWN\nAddress: 10.10.10.10\nInfo: CRITICAL - 10.10.10.10: rta nan, lost 100%\nDate/Time: 09-03-2022" | /bin/mail -s "Host DOWN alert for win-aws-hm!" admin@locahost''...

You will be able to test the command with the centreon-engine user