Hello There, Guest!  
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Error in commands notify-service-by-telegram and notify-host-by-telegram

#1
I wondered why I did not receive any notifications (neither email nor telegram).

As far as email is concerned, there is already a report on an error regarding the "from" field.

As I did also not receive any telegrams, I first tested the telegram_nems.lua script and that worked.
Looking at the command line in NConf however showed that both notify-service-by-telegram and notify-host-by-telegram refer to the old command:

            /usr/local/bin/telegram_nagios.lua

Obviously the command line arguments are not complete either.
 Reply
#2
Hi Robbie,

Could you have a look at this?
This should be an easy fix.

Thanks.

BR
 Reply
#3
Hmm, thanks baggins. I could actually really use your assistance with this one because I couldn't figure out how Telegram works. I'm looking for someone who uses it to test and even assist with writing the documentation for this feature.

Please see this message I'd posted to you a long time ago which went unanswered: https://forum.category5.tv/thread-96-pos...tml#pid757

Let me know what needs changing, specifically (eg., what NConf should have the commands set to) and I'll get working on it.

Thanks!
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
 Reply
#4
Hi Robbie,

You have in fact already done most of the work, but probably forgotten about it!

To start with: in /usr/local/bin you have now a script called telegram_nems.lua which is a modified version of my original script called telegram_nagios.lua.
The new script takes two additional arguments: the bot (arg[1] and the chat_id arg[2]. 
The bot and the chat_id are now stored in the resource.cfg as $USER11$ and $USER12$.

In Nconf however you have still the old command line: (This is for notify-host-by telegram, notify-service-by telegram is similar)

/usr/local/bin/telegram_nagios.lua "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTOUTPUT$" "$LONGDATETIME$"

so this should be changed to:

/usr/local/bin/telegram_nems.lua $USER11$ $USER12$ "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTOUTPUT$" "$LONGDATETIME$"

That should do it.

Sorry about not responding to the previous message, I must have overlooked it.


BR
 Reply
#5
Easy peasy, thanks baggins. :) Yeah, I snuck this feature in at the last minute of 1.3 feature freeze... so I'll get it fixed and ready for the next release (perhaps 1.3.1).

There's such an overlap right now between 1.3 and 1.4 so I'll decide how best to do this.

Thanks again!
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
 Reply
#6
Posting this here in case it helps someone since I couldn't find a straight forward explanation.  There may be a simpler way of doing this, but this is how I made it work.  None of this is my original work, so I've included links to where I found the answers.  

First create a bot: 

Within the Telegram app, send a message to @BotFather
/start
/newbot <botname>

Make note of the Token you receive in return.  This is what you'll use for the "Your Bot" field in NEMS System Settings Tool (must add 'bot' before the token). 
https://core.telegram.org/bots#3-how-do-i-create-a-bot

Allow your bot to join groups: 
send a message to @BotFather
/setjoingroups
<botname>

The Chat ID seems to be a bit tricky to obtain.  
Compose a new message in Telegram, choosing the new group option.   
Add <botname> to the group.

Message your bot. 
/my_id <botname>
https://api.telegram.org/bot<Token>/getUpdates

Look for 'chat":{"id":'.   The id will be something like -12345678910. This is what you'll use for the Chat ID.   

https://stackoverflow.com/questions/3242...up-chat-id


Hit save and hopefully you'll be in business.
 Reply
#7
That's wonderful, thank you lonehorse.

I'll add a link to your post in the docs for now, and inevitably write it in to the docs.

Cheers!
Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
 Reply
 
 
Forum Jump:

Users browsing this thread: 1 Guest(s)