icingaweb2-module-director icon indicating copy to clipboard operation
icingaweb2-module-director copied to clipboard

[dev.icinga.com #11849] Allow configuring environment variables "env" for (notification) commands

Open icinga-migration opened this issue 9 years ago • 31 comments

This issue has been migrated from Redmine: https://dev.icinga.com/issues/11849

Created by tobiasvdk on 2016-05-26 10:20:00 +00:00

Assignee: (none) Status: New Target Version: (none) Last Update: 2017-01-17 05:16:11 +00:00 (in Redmine)


For notification commands you often need to configure the "env" attribute of a NotificationsCommand

Example:

object NotificationCommand "mail-service-notification" {
  import "plugin-notification-command"

  command = [
    SysconfDir + "/icinga2/scripts/mail-notification.sh"
  ]

  env = {
    NOTIFICATIONTYPE = "$notification.type$"
    SERVICEDESC = "$service.name$"
    HOSTALIAS = "$host.display_name$"
    HOSTADDRESS = "$address$"
    SERVICESTATE = "$service.state$"
    LONGDATETIME = "$icinga.long_date_time$"
    SERVICEOUTPUT = "$service.output$"
    NOTIFICATIONAUTHORNAME = "$notification.author$"
    NOTIFICATIONCOMMENT = "$notification.comment$"
    HOSTDISPLAYNAME = "$host.display_name$"
    SERVICEDISPLAYNAME = "$service.display_name$"
    USEREMAIL = "$user.email$"
  }
}

Relations:

icinga-migration avatar May 26 '16 10:05 icinga-migration

Updated by hashfunktion on 2016-07-12 13:45:06 +00:00

** That would be great

icinga-migration avatar Jul 12 '16 13:07 icinga-migration

Updated by sebastianplattner on 2016-08-18 07:17:58 +00:00

** I upvote this

icinga-migration avatar Aug 18 '16 07:08 icinga-migration

Updated by tgelf on 2016-08-24 14:18:23 +00:00

  • Relates set to 11588

icinga-migration avatar Aug 24 '16 14:08 icinga-migration

Updated by radovitsa on 2016-09-07 09:39:38 +00:00

+1

icinga-migration avatar Sep 07 '16 09:09 icinga-migration

Updated by mfrosch on 2016-10-25 11:59:58 +00:00

  • Subject changed from Make configuring the "env" attribute possible for notification commands to Allow configuraring environment variables "env" for (notification) commands

icinga-migration avatar Oct 25 '16 11:10 icinga-migration

Updated by mfrosch on 2016-10-25 12:00:53 +00:00

  • Subject changed from Allow configuraring environment variables "env" for (notification) commands to Allow configuring environment variables "env" for (notification) commands

icinga-migration avatar Oct 25 '16 12:10 icinga-migration

Updated by tgelf on 2016-10-25 12:01:55 +00:00

  • Relates set to 12028

icinga-migration avatar Oct 25 '16 12:10 icinga-migration

Updated by tgelf on 2016-10-25 12:02:41 +00:00

  • Blocked set to 12093

icinga-migration avatar Oct 25 '16 12:10 icinga-migration

Updated by tgelf on 2016-10-25 12:06:26 +00:00

Guess once #12028 is implemented most people wouldn't even ask for this ;-) But sure, we need it. As it caused some extra-work in the GUI this depends on #12093, where the same tasks will be addressed.

icinga-migration avatar Oct 25 '16 12:10 icinga-migration

Updated by dannyh on 2017-01-17 05:16:11 +00:00

**+ would be greate to have it

icinga-migration avatar Jan 17 '17 05:01 icinga-migration

yes this would be nice to have

cristian-ciobanu avatar Feb 13 '17 06:02 cristian-ciobanu

Please add ENV Support :-)

hermann1514 avatar Mar 02 '17 12:03 hermann1514

I believe this is still needed if you have to write custom notification scripts (which is my case). Please add ENV support :+1:

rodrigohdez1 avatar Mar 22 '17 18:03 rodrigohdez1

+1. I had to write to my own py scripts with arguments.

ktella avatar Mar 22 '17 18:03 ktella

+1. This would be really helpful!

noudAndi avatar Mar 27 '17 07:03 noudAndi

+1

chas0rde avatar Sep 26 '17 08:09 chas0rde

+1

maraev avatar Oct 06 '17 13:10 maraev

+1

druchoo avatar Dec 09 '17 22:12 druchoo

++

Spikelite avatar Oct 31 '18 19:10 Spikelite

need it asap(

Alexvianet avatar Dec 07 '18 15:12 Alexvianet

+1

alex1702 avatar Jan 17 '19 08:01 alex1702

This is required for setting NAGIOS_PLUGIN_STATE_DIRECTORY

oakwhiz avatar Mar 11 '19 20:03 oakwhiz

+1

pkalytta avatar Jun 24 '19 13:06 pkalytta

+1

firatalkis avatar Aug 04 '19 20:08 firatalkis

+1

inmediasit avatar Aug 07 '19 07:08 inmediasit

I love how this has been open for 3 years and no response from the devs. I guess this is why I can't get pushbullet notifications to work with director.

brando56894 avatar Nov 11 '19 05:11 brando56894

i just remove icinga and happily use Prometheus =)

пн, 11 нояб. 2019 г. в 07:42, brando56894 [email protected]:

I love how this has been open for 3 years and no response from the devs. I guess this is why I can't get pushbullet notifications to work with director.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Icinga/icingaweb2-module-director/issues/256?email_source=notifications&email_token=AEFMORJ2YDSE2TRGNTKI4JLQTDWERA5CNFSM4C73L3JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDVXGAA#issuecomment-552301312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFMORPT7QY7MX2MER4KN3LQTDWERANCNFSM4C73L3JA .

Alexvianet avatar Nov 11 '19 08:11 Alexvianet

I also lacked that functionality. The check_memory command needed to be run with an environment variable. LC_ALL = "C".

slackluis avatar Apr 14 '20 08:04 slackluis

+1

majales avatar Jun 19 '20 10:06 majales

For check commands this has been implemented. It's described in the docs (https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#environment-variables) and works. I haven't looked or tried it for notification commands. It may also work. As notification is in parentheses in the issues title it seems noteworthy to mention this working in check commands.

c-holtermann avatar Mar 03 '21 01:03 c-holtermann