Feature #9633
openPPPoE/L2TP Server Status Page
0%
Description
MPD includes a built-in web server that can be used to poll status information. There is also a telnet console, but the web console output supports JSON for some of the output so it is much easier to parse and deal with.
For example, with this in the mpd config for the PPPoE server:
set user myuser mypass admin set web self 127.0.0.1 5006 set web enable auth set web open
The status can be polled using JSON:
$ curl curl -u myuser:mypass http://127.0.0.1:5006/json
{"links":[ { "link": "poes_l", "lcp": "Initial", "auth": "", "type": "pppoe", "state": "DOWN", "calling_num": "", "called_num": "" } ], "bundles":[ { "bundle": "poes_b", "iface": "", "state": "Down", "ipcp": "Initial", "ipv6cp": "Initial", "ccp": "Initial", "ecp": "Initial", "links":[ ] } , { "bundle": "poes_b-1", "iface": "ng0", "state": "Up", "ipcp": "Opened", "ipv6cp": "Initial", "ccp": "Stopped", "ecp": "Initial", "links":[ { "link": "poes_l-1", "lcp": "Opened", "auth": "jack", "type": "pppoe", "state": "UP", "peer_ip": "00:0d:b9:33:0f:71", "ipcp_ip": "10.6.220.122", "calling_num": "000db9330f71", "called_num": "" } ] } , { "bundle": "poes_b-2", "iface": "ng1", "state": "Up", "ipcp": "Opened", "ipv6cp": "Initial", "ccp": "Stopped", "ecp": "Initial", "links":[ { "link": "poes_l-2", "lcp": "Opened", "auth": "jimp", "type": "pppoe", "state": "UP", "peer_ip": "00:0c:29:f8:3b:fa", "ipcp_ip": "10.6.220.120", "calling_num": "000c29f83bfa", "called_num": "" } ] } ], "repeaters":[ ]}
And then you can disconnect a user by closing their session using one of the identifiers above, for example:
: curl -u myuser:mypass "http://127.0.0.1:5006/bincmd?bund%20poes_b-2&close" RESULT: 0 RESULT: 0
A user can be disconnected by using, for example http://198.51.100.6:5006/cmd?link%20poes_l-2&close
where the link ID, poes_l-2
identifies the specific link to close.
The code which generates the various mpd config files would need to have some way to programmatically determine port numbers to ensure each config uses a unique port, and also to query the appropriate daemons to build a status page/handle disconnect queries/etc.
This might also be useful for status info of outbound links, which we scrape logs to generate now.