[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 »

How interesting. Are you using some kind of dongle for networking or something?

What does this output: sudo nems-info nic
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: How interesting. Are you using some kind of dongle for networking or something?

What does this output: sudo nems-info nic
No, NEMS is connected directly to a switch by cable...

Code: Select all

$ sudo nems-info nic
 
eth0 proto ra
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.
What is the full output of this command? ip route get "172.217.10.142"
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.
What is the full output of this command? ip route get "172.217.10.142"

Code: Select all

ip route get "172.217.10.142"
172.217.10.142 via 192.168.0.1 dev eth0 src 192.168.0.28 
    cache 
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 »

Try as I might, I am yet unable to replicate the problem you're experiencing.

What is the output of this command?

Code: Select all

cat /usr/local/bin/nems-info | grep proto

Thanks!
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 »

Code: Select all

$ cat /usr/local/bin/nems-info | grep proto
  interface=`ip route get "$host_ip" | grep -Po '(?<=(dev )).*(?= src| proto)'`
BR
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. So you have the latest software, and all should work correctly. It makes no sense that your nems-info nic is outputting "eth0 proto ra" since your nems-info script contains grep -Po '(?<=(dev )).*(?= src| proto)'`... the return from that would be eth0 in your case as per (dev )).*(?= src| proto). Even manually echoing your result I still get eth0.

echo "172.217.10.142 via 192.168.0.1 dev eth0 src 192.168.0.28" | grep -Po '(?<=(dev )).*(?= src| proto)'

You are experiencing the issue on NEMS 1.4.1 on a Pi?
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 »

Yes, this is 1.4.1 on a Pi.
However, I had a closer look at the output of the nems-info  script.

Code: Select all

host_ip=$(getent ahosts "$host" | awk '{print $1; exit}')
returns: 

Code: Select all

2a00:1450:400e:806::200e
so, this is an IPV6 address...

Code: Select all

interface=`ip route get "$host_ip"`
returns:

Code: Select all

2a00:1450:400e:806::200e from :: via fe80::de53:7cff:feec:d56b dev eth0 proto ra src 2a02:1812:1709:ac00:ba27:ebff:fe42:c170 metric 1024 hoplimit 64 pref high
The grep that this is piped to probably gets confused...

EDIT: I experimented somewhat with the grep command and this does the trick:

Code: Select all

| grep -Po '(?<=dev )[^ ]+'

Code: Select all

echo "2a00:1450:400e:806::200e from :: via fe80::de53:7cff:feec:d56b dev eth0 proto ra src 2a02:1812:1709:ac00:ba27:ebff:fe42:c170 metric 1024 hoplimit 64 pref high" | grep -Po '(?<=dev )[^ ]+'
eth0
Last edited by baggins on Mon Dec 17, 2018 6:38 am, edited 1 time in total.
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 »

Oh okay - the result you had posted was IPv4. I'll do some testing with the IPv6 result - thanks.

grep -Po '(?<=(dev )).*(?= src| proto)' -- this selects the text between "dev " and either " src" or " proto". By deleting the second part, you'd break the result on most board, resulting in a result like you are reporting.

This is why I'm confused by your result of 172.217.10.142 via 192.168.0.1 dev eth0 src 192.168.0.28.

As you can see, eth0 is between "dev " and " src" - so the result would be eth0.

I think you tested and gave me answers from the wrong system  :)

I'll fix it based on the new info. I see the problem based on your IPv6 result.

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 »

Please run sudo nems-update

Should be fixed now.

Thanks baggins!
Robbie Ferguson // The Bald Nerd

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