Icinga2 director notifications by telegram

Hi there!
could you please help me resolve my issue with setting up notifications with this plugin:

and enabled director? so I make all the configs in director!

I’ve put config files as told, then created user and this is resolved user:

object User “telegram_bot” {
enable_notifications = true
zone = “director-global”
vars.telegram_auth_token = “xyz”
vars.telegram_chat_id = “-xy”
}

then created data fields for notification.telegram and notify_users

then I’ve a host and resolved config is like this:
vars[“notification.telegram”] = true
vars.notify_users = “telegram_bot”

but the first line should look like this:
vars.notification.telegram = true

But it doesn’t… :confused: and daemon -C returns
warning/ApplyRule: Apply rule ‘telegram-notifications-notification-hosts’ (in /etc/icinga2/conf.d/telegram-notifications-configuration.conf: 48:1-48:70) for type ‘Notification’ does not match anywhere!

in the config file is this:
assign where host.vars.notification.telegram == true

but I am not able tu put vars[“notification.telegram”] = true into right format. I’ve tried to put notification_telegram with underscore to data field, then it looks OK, but when I change this:

assign where host.vars.notification.telegram == true

to this:

assign where host.vars.notification_telegram == true

it still says the same…

I am sorry for noobie question but I am really stucked and don’t know how to set it up the right way… Thanks for any hints that would help me!

Radim

Are you still trying to figure this out? I’m in the same place trying to get one of the telegram notification modules to work with icinga director and at a bit of a loss.

I think this should be easily configureable by using this apply rule

Simply create a data field notification_telegram of type boolean with the Director and add it to the host (preferable via a template). Then set it to true/yes and the assign rule should work.

Not sure why it is notification.telegram in the docs. But I assume the creator has a variable call notification on his hosts which is a dictionary containing the corresponding values.

Hello, I used another command that I found on the google. This one is working perfectly and every config was made through the director.

https://ws.learn.ac.lk/wiki/NSM2021/Agenda/AlertsIcinga2Telegram

2 Likes

Hello, I used another command that I found on the google. This one is working perfectly and every config was made through the director.
NSM2021/Agenda/AlertsIcinga2Telegram – Learn Workshops

Thank you!! That link was extremely thorough and helpful in finishing my Telegram setup. Works great.