Page 3 of 6

RE: Telegram Push notifications

Posted: Tue Nov 27, 2018 9:00 am
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.

RE: Telegram Push notifications

Posted: Wed Nov 28, 2018 8:50 am
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?

RE: Telegram Push notifications

Posted: Wed Nov 28, 2018 10:02 am
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...

RE: Telegram Push notifications

Posted: Wed Nov 28, 2018 10:52 am
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

RE: Telegram Push notifications

Posted: Wed Nov 28, 2018 11:45 am
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

RE: Telegram Push notifications

Posted: Wed Nov 28, 2018 11:50 am
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...

RE: Telegram Push notifications

Posted: Wed Nov 28, 2018 12:41 pm
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.

RE: Telegram Push notifications

Posted: Wed Nov 28, 2018 1:05 pm
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

RE: Telegram Push notifications

Posted: Wed Nov 28, 2018 1:39 pm
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

RE: Telegram Push notifications

Posted: Wed Nov 28, 2018 1:56 pm
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!