[1.3] Telegram Push notifications

Have you done something on your NEMS server to make it more usable for yourself? Want to share your code? I'd love for you to share and may include your ideas in future releases of NEMS.
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

OK. Grab hold of your backup.nems file, and please perform the upgrade on a different SD card (so you can fall back if needed). NEMS 1.3 has been out of service for a while now, so I don't want you to have any issues.
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
baggins
Member
Posts: 50
Joined: Tue Oct 03, 2017 4:46 am

RE: Telegram Push notifications

Post by baggins »

Robbie Ferguson wrote: OK. Grab hold of your backup.nems file, and please perform the upgrade on a different SD card (so you can fall back if needed). NEMS 1.3 has been out of service for a while now, so I don't want you to have any issues.
OK, I had a spare rpi lying around and installed NEMS 1.4.1 (after the usual tribulations with a non-US keyboard...).
I have my backup and wanted to load that using the Migrator tool as described on the 'How to upgrade' page. However, there is no 'Restore' option...
I recall having read somewhere in the documentation to write the backup to a flash drive and then restore it with 'nems-restore'. Is that the required procedure?
baggins
Member
Posts: 50
Joined: Tue Oct 03, 2017 4:46 am

RE: Telegram Push notifications

Post by baggins »

I went ahead and restored my backup with the nems-restore script.
All went well and it looks like my old configuration has correctly been restored, apart from the 'To' address where mails should be sent.

I tested manually if I could send mails and telegrams and that was OK.

Now it happens that this 'new' NEMS has no access to one of my machines because it has an  IP address that is not the correct one for access... So there are about 9 services that give a warning at the moment:


As far as I can see, everything is enabled, but no telegrams are being sent (mails are) even though Nagios tells me that the script is being executed...
I have added some code to the telegram_nems.lua script to write some data to a log file, but nothing gets written to that...
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

Can you please send me your support.nems file to review?

PS - the Telegram notification script has been rewritten for NEMS 1.5 coming next month - so it's not a long wait to get the upgraded version (which is greatly improved).

Cheers,
Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

Thanks for sending the file. However, this file appears to be from NEMS 1.3 (not supported).

Can you get by with email notifications for now and migrate to NEMS 1.5 next month?

Let me know.
Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
baggins
Member
Posts: 50
Joined: Tue Oct 03, 2017 4:46 am

RE: Telegram Push notifications

Post by baggins »

Robbie Ferguson wrote: Thanks for sending the file. However, this file appears to be from NEMS 1.3 (not supported).

Can you get by with email notifications for now and migrate to NEMS 1.5 next month?

Let me know.
Robbie
Ha, that's what happens when you have two NEMS running at the same time and doing something else as well. I executed the command in the wrong ssh session!
I will send you the correct one shortly.

Of course I can wait but I'm curious as to why it doesn't work...
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

Yes, me too. Granted NEMS 1.3 isn't supported any longer (hasn't been for a while) but I'd like to make sure you're up and going having migrated to 1.4.1.

Will review the new file asap - thanks.
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

Hi baggins.
Sure enough, having added telegram support to your old NEMS 1.3 server, this made your backup contain your modified check commands rather than the ones powered by NEMS SST.

Why it stopped working? I don't know. 1.3 is so old, it could be anything.

The issue is this: your backup, containing your customized version of the misccommands, automatically override the default commands. This is on purpose: if a user modifies their check commands, upon importing their backup they will receive their modified version, not the system's default version (for obvious reasons - don't want them having to redo all the work they've done).

So in your case, because your custom misccommands for telegram do not use the same settings as NEMS 1.4.1, it basically made your notifications incompatible.

I've emailed you a modified version of your backup.nems from NEMS 1.3, which you conveniently accidentally sent me. This modified version corrects your custom commands to use the telegram notifiers combined with NEMS SST. Importing this to your NEMS 1.4.1 server should work... untested. :)

Heads up too that in NEMS 1.5 you'll no longer need to add 'bot' to your api key. For now, it remains (in NEMS 1.4.1).

Let me know how it goes, and if it's outstanding, please consider throwing something into the tip jar if you can :P

Cheers,
Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
baggins
Member
Posts: 50
Joined: Tue Oct 03, 2017 4:46 am

RE: Telegram Push notifications

Post by baggins »

Hi Robbie,

I'm not quite sure I understand your explanation but I will study this further...

I did a restore with your backup but alas: no telegrams.
The debug statements I added to /usr/local/bin/telegram_nems.lua are still there but I see no entries in the log it should write to...

Thanks
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

Please re-flash to revert your NEMS 1.4.1 to stock, then import the backup.nems file I sent you.

Summary:
- NEMS has default config, which is tested and works.
- User imports their own config, this *overwrites* the default config, assuming the user made changes that they desire.
- The default config contains the correct NEMS SST variables for telegram. Your backup (from NEMS 1.3) does not.
- Importing your backup from NEMS 1.3 overwrites the working defaults with the not working custom commands.
- The backup.nems I sent you has your backup, but with the fixed commands for telegram.

Lemme know. If it still doesn't work, please send me a new support.nems file so I can see where it got to in the migration from 1.3.

Cheers!
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
Locked