Jump to content
  • 0

Getting information available in the web front end from shell


Avee
 Share

Question

Hi,

I have snmpd server (not mini version) running, so that my keenetic hero can pass network information to my home automation server.

I would like to access some information available on the web front end from a sh script, so I can serve it via SNMP.

More specifically, I am interested in the device list and in the internet connection status. For the device list, I am currently using the devices from the arp table via the ip command. However, the status of the devices is not the same as in the front end. I have not found a workaround for internet connectivity yet (as shown on the main web page).

Can anybody tell me how to access the infomation via shell scripts? The router seems to provide it via json, but I was not able to forge a request, and I think that is a bit of a convoluted way anyway. I would much rather use a command to the backend software, or find out what command happens in the background of the web requests.

Edit:

I found I can access my device list by telnet by "show ip hotspot". However, I need this in a shell script. How can I access the telnet commands from the linux shell?

Edited by Avee
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
On 12/15/2022 at 3:17 PM, Avee said:

y keenetic hero can pass network information to my home automation server.

I would like to access some information available on the web front end from a sh script, so I can serve it via SNMP.

More specifically, I am interested in the device list and in the internet connection status. For the device list, I am currently using the devices from the arp table via the ip command. However, the status of the devices is not th

Ok, solved it with a dirty workaround.

My needed information is also available via the rest interface. Unfortunately, my home server doesn't support the authentication method. There is however, a possibility for unauthenticated rest requests on localhost:79. So I used curl in a script.

So what I did was:

curl --silent http://127.0.0.1:79/rci/show/internet/status/internet 2>&1

and

curl --silent http://127.0.0.1:79/rci/show/ip/hotspot 2>&1

 

Edited by Avee
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...