Slack Alert?? - Alerting in general

Joined
May 4, 2016
Messages
9
So i want to setup slack alerts so i can get all of my main alerts on the same platform.

I've read the documentation which is real basic and mentioned nothing specific to Slack config.
I've pasted the webhook URL (including https) in the webhook box and left the rest blank.

Right from the start the test alert fails everytime, even filling out the other boxes (channel, username, etc) it fails every time. I haven't had any alerts happen on the system (which is a good thing lol) so i'm not sure if Slack would actually work or not. Does anyone know how i can test the slack alert config and have it work lol?

I've setup the webhook incoming URL to the channel i want and user account name i want so i'm not sure what else is needed on slack's end and i don't see that i'm missing anything on the documentation end. I've read the few articles on here about it and gotten no where so i figured i'd ask here and see if anyone has some additional info.
 
D

dlavigne

Guest
Which FreeNAS version? Anything in /var/log/messages during the test alert?
 

cipehr

Cadet
Joined
Aug 27, 2018
Messages
4
I have the same issue, and nothing shows up in /var/log/messages
Code:
May 10 00:00:00 freenas syslog-ng[2057]: Configuration reload request received, reloading configuration;
May 10 00:00:00 freenas syslog-ng[2057]: Configuration reload finished;
 
Joined
May 4, 2016
Messages
9
Which FreeNAS version? Anything in /var/log/messages during the test alert?
Sorry for the delay answering back, i've got my nas off for now i'm doing a cable remodel tonight now that i have a new spool of 6A. I'll see if i can find any slack related logs when i bring the server back up.
 

prairiemoose

Cadet
Joined
May 10, 2019
Messages
7
I'll second this: I ran into the same Slack behavior reported by paintballer4lfe while troubleshooting a related issue with the Email version of the alerts service.

- Fresh install of FreeNAS-11.2-U4
- New alert service of type Slack
- Pasted just the webhook URL in the Slack alert service configuration
- Test alert fails to send (see screenshot)
- Verified with cURL that the Slack webhook URL works with no additional authentication in my Slack app

slack_alert_failed_to_send.png

Related issue link: https://www.ixsystems.com/community...ctly-email-alert-service-fails-to-send.76316/
 

prairiemoose

Cadet
Joined
May 10, 2019
Messages
7
Second Slack test: The middleware produces some debug output in /var/log/middlewared.log when I run the "SEND TEST ALERT" button in the Slack alert service config:

Code:
[2019/05/10 17:24:10] (ERROR) AlertServiceService.test():633 - Error in alert service 'Slack'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/alert.py", line 631, in test
    await alert_service.send([test_alert], [], [test_alert])
  File "/usr/local/lib/python3.6/site-packages/middlewared/alert/base.py", line 140, in send
    return await self.middleware.run_in_thread(self.send_sync, alerts, gone_alerts, new_alerts)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1005, in run_in_thread
    return await self.loop.run_in_executor(executor, functools.partial(method, *args, **kwargs))
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/../alert/service/slack.py", line 29, in send_sync
    "text": self._format_alerts(alerts, gone_alerts, new_alerts),
  File "/usr/local/lib/python3.6/site-packages/middlewared/alert/base.py", line 148, in _format_alerts
    return format_alerts(product_name, hostname, alerts, gone_alerts, new_alerts)
TypeError: format_alerts() missing 1 required positional argument: 'new_alerts'
 
Joined
May 4, 2016
Messages
9
Second Slack test: The middleware produces some debug output in /var/log/middlewared.log when I run the "SEND TEST ALERT" button in the Slack alert service config:

Code:
[2019/05/10 17:24:10] (ERROR) AlertServiceService.test():633 - Error in alert service 'Slack'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/alert.py", line 631, in test
    await alert_service.send([test_alert], [], [test_alert])
  File "/usr/local/lib/python3.6/site-packages/middlewared/alert/base.py", line 140, in send
    return await self.middleware.run_in_thread(self.send_sync, alerts, gone_alerts, new_alerts)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1005, in run_in_thread
    return await self.loop.run_in_executor(executor, functools.partial(method, *args, **kwargs))
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/../alert/service/slack.py", line 29, in send_sync
    "text": self._format_alerts(alerts, gone_alerts, new_alerts),
  File "/usr/local/lib/python3.6/site-packages/middlewared/alert/base.py", line 148, in _format_alerts
    return format_alerts(product_name, hostname, alerts, gone_alerts, new_alerts)
TypeError: format_alerts() missing 1 required positional argument: 'new_alerts'
I'd imagine my log's will be something of the same as this. I figured i'd try to use slack since my LibreNMS uses Slack and Discord and FreeNAS only has Slack available but yeah just immediate failures with valid webhook string.
 
D

dlavigne

Guest
Second Slack test: The middleware produces some debug output in /var/log/middlewared.log when I run the "SEND TEST ALERT" button in the Slack alert service config:

Code:
[2019/05/10 17:24:10] (ERROR) AlertServiceService.test():633 - Error in alert service 'Slack'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/alert.py", line 631, in test
    await alert_service.send([test_alert], [], [test_alert])
  File "/usr/local/lib/python3.6/site-packages/middlewared/alert/base.py", line 140, in send
    return await self.middleware.run_in_thread(self.send_sync, alerts, gone_alerts, new_alerts)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1005, in run_in_thread
    return await self.loop.run_in_executor(executor, functools.partial(method, *args, **kwargs))
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/../alert/service/slack.py", line 29, in send_sync
    "text": self._format_alerts(alerts, gone_alerts, new_alerts),
  File "/usr/local/lib/python3.6/site-packages/middlewared/alert/base.py", line 148, in _format_alerts
    return format_alerts(product_name, hostname, alerts, gone_alerts, new_alerts)
TypeError: format_alerts() missing 1 required positional argument: 'new_alerts'

Thanks for posting the traceback. We've identified an issue in the alerts system and will be releasing U4.1 to address it (most likely later today if QE can finish testing the hot fix today).
 

prairiemoose

Cadet
Joined
May 10, 2019
Messages
7
Thanks for posting the traceback. We've identified an issue in the alerts system and will be releasing U4.1 to address it (most likely later today if QE can finish testing the hot fix today).

Excellent, and thank you for the update! I will test this on my backup NAS as soon as U4.1 is out.
 

prairiemoose

Cadet
Joined
May 10, 2019
Messages
7
@dlavigne With the new update FreeNAS-11.2-U4.1 applied to my spare NAS, notifications are working as expected to both E-Mail and Slack alert services.

Thank you again!
 

zamana

Contributor
Joined
Jun 4, 2017
Messages
163
Hi!

I'm using 11.2-U5 and Slack still doesn't work.

That's the LOG when I try to send an alert test:

Code:
[2019/07/28 17:42:00] (ERROR) AlertServiceService.test():649 - Error in alert service 'Slack'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/alert.py", line 647, in test
    await alert_service.send([test_alert], [], [test_alert])
  File "/usr/local/lib/python3.6/site-packages/middlewared/alert/base.py", line 143, in send
    return await self.middleware.run_in_thread(self.send_sync, alerts, gone_alerts, new_alerts)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1006, in run_in_thread
    return await self.loop.run_in_executor(executor, functools.partial(method, *args, **kwargs))
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/../alert/service/slack.py", line 28, in send_sync
    "icon_url": self.attributes["icon_url"],
KeyError: 'icon_url'


Anything I could be possibly doing wrong?
 

cipehr

Cadet
Joined
Aug 27, 2018
Messages
4
Seems like all the fields in the alert page are required. Adding all fields my slack alerts are now working! Thanks for the pointers to the log file to diagnose
 

zamana

Contributor
Joined
Jun 4, 2017
Messages
163
Thanks.

It turns out that the missing piece was the ICON URL...

But the tip is not very clear about it:

"Enter a URL to an image to use for notification icons. This overrides the incoming webhook setting."

This leads me to think that the icon URL is optional, because if empty, the system will use that from the "webhook setting"...

Thanks anyway.
 

slickace

Cadet
Joined
Aug 3, 2019
Messages
1
Thanks.

It turns out that the missing piece was the ICON URL...

But the tip is not very clear about it:

"Enter a URL to an image to use for notification icons. This overrides the incoming webhook setting."

This leads me to think that the icon URL is optional, because if empty, the system will use that from the "webhook setting"...

Thanks anyway.


How do you get a slack ICON URL for an image. I am running into the same issue
 

zamana

Contributor
Joined
Jun 4, 2017
Messages
163
How do you get a slack ICON URL for an image. I am running into the same issue

You can put anything you want. I chose the Freenas logo.

Choose your image and copy and paste the URL in the proper field.

Just search for an image in Google e check if it fits nicely in slack...
 
Top