On 10/05/16 21:00, Ben Greear wrote: > Here is an initial pass at a script to gather pertinent info about > a LEDE (or similar) system. Suggestions for improvement are welcome. > > If someone could add a way to put the git commit ID(s) into > the file system somewhere, I think that would be an excellent > addition. > > And once the script is in place, a way to call it through the web UI would > be most welcome.
Some of these commands could be replaced by ubus calls. The benefit of this is could be that we get it structured as JSON so it's easier to parse and easy to upload to a webservice (e.g. for submitting test results or bug reports). > [root@ben-dt3 linux-wt.x64]# cat ~/verinfo.sh > #!/bin/sh > > echo "System Information" > uname -a > echo > echo "lspci:" > lspci No ubus equivalent yet. lsusb would also be interesting. > echo > echo "CPU Info" > cat /proc/cpuinfo > echo > echo "Banner:" > cat /etc/banner > echo root@Rpi2:~# ubus call system board { "kernel": "3.18.29", "hostname": "Rpi2", "system": "ARMv7 Processor rev 5 (v7l)", "model": "Raspberry Pi 2", "release": { "distribution": "OpenWrt", "version": "Chaos Calmer", "revision": "2016-04-21-140-ge1357c0", "codename": "chaos_calmer", "target": "brcm2708\/bcm2709", "description": "OpenWrt Chaos Calmer 2016-04-21-140-ge1357c0" } } root@Rpi2:~# ubus call system info { "uptime": 60, "localtime": 1462952915, "load": [ 31264, 10560, 3648 ], "memory": { "total": 976216064, "free": 937431040, "shared": 73728, "buffered": 884736 }, "swap": { "total": 0, "free": 0 } } > echo "Network Devices:" > ip addr show > echo root@Rpi2:~# ubus call network.device status { "eth0": { "external": false, "present": true, "type": "Network device", "up": true, "carrier": true, "link-advertising": [ "10H", "10F", "100H", "100F" ], "link-supported": [ "10H", "10F", "100H", "100F" ], "speed": "100F", "mtu": 1500, "mtu6": 1500, "macaddr": "b8:27:eb:bb:b3:40", "txqueuelen": 1000, "ipv6": true, "promisc": false, "rpfilter": 0, "acceptlocal": false, "igmpversion": 0, "mldversion": 0, "neigh4reachabletime": 30000, "neigh6reachabletime": 30000, "dadtransmits": 1, "statistics": { "collisions": 0, "rx_frame_errors": 0, "tx_compressed": 0, "multicast": 0, "rx_length_errors": 0, "tx_dropped": 0, "rx_bytes": 433918, "rx_missed_errors": 0, "tx_errors": 0, "rx_compressed": 0, "rx_over_errors": 0, "tx_fifo_errors": 0, "rx_crc_errors": 0, "rx_packets": 979, "tx_heartbeat_errors": 0, "rx_dropped": 0, "tx_aborted_errors": 0, "tx_packets": 1688, "rx_errors": 0, "tx_bytes": 388341, "tx_window_errors": 0, "rx_fifo_errors": 0, "tx_carrier_errors": 0 } }, "lo": { "external": false, "present": true, "type": "Network device", "up": true, "carrier": true, "mtu": 65536, "mtu6": 65536, "macaddr": "00:00:00:00:00:00", "txqueuelen": 0, "ipv6": true, "promisc": false, "rpfilter": 0, "acceptlocal": false, "igmpversion": 0, "mldversion": 0, "neigh4reachabletime": 30000, "neigh6reachabletime": 30000, "dadtransmits": 1, "statistics": { "collisions": 0, "rx_frame_errors": 0, "tx_compressed": 0, "multicast": 0, "rx_length_errors": 0, "tx_dropped": 0, "rx_bytes": 15694, "rx_missed_errors": 0, "tx_errors": 0, "rx_compressed": 0, "rx_over_errors": 0, "tx_fifo_errors": 0, "rx_crc_errors": 0, "rx_packets": 132, "tx_heartbeat_errors": 0, "rx_dropped": 0, "tx_aborted_errors": 0, "tx_packets": 132, "rx_errors": 0, "tx_bytes": 15694, "tx_window_errors": 0, "rx_fifo_errors": 0, "tx_carrier_errors": 0 } }, "moni0": { "external": false, "present": true, "type": "Network device", "up": true, "carrier": true, "mtu": 1500, "mtu6": -1, "macaddr": "7c:dd:90:7d:c7:2b", "txqueuelen": 1000, "promisc": false, "rpfilter": 0, "acceptlocal": false, "igmpversion": 0, "mldversion": 0, "neigh4reachabletime": 30000, "neigh6reachabletime": 30000, "dadtransmits": 1, "statistics": { "collisions": 0, "rx_frame_errors": 0, "tx_compressed": 0, "multicast": 0, "rx_length_errors": 0, "tx_dropped": 0, "rx_bytes": 1004498, "rx_missed_errors": 0, "tx_errors": 0, "rx_compressed": 0, "rx_over_errors": 0, "tx_fifo_errors": 0, "rx_crc_errors": 0, "rx_packets": 5185, "tx_heartbeat_errors": 0, "rx_dropped": 0, "tx_aborted_errors": 0, "tx_packets": 0, "rx_errors": 0, "tx_bytes": 0, "tx_window_errors": 0, "rx_fifo_errors": 0, "tx_carrier_errors": 0 } }, "wlan0": { "external": true, "present": true, "type": "Network device", "up": true, "carrier": true, "mtu": 1500, "mtu6": 1500, "macaddr": "7c:dd:90:7b:6d:71", "txqueuelen": 1000, "ipv6": true, "promisc": false, "rpfilter": 0, "acceptlocal": false, "igmpversion": 0, "mldversion": 0, "neigh4reachabletime": 30000, "neigh6reachabletime": 30000, "dadtransmits": 1, "statistics": { "collisions": 0, "rx_frame_errors": 0, "tx_compressed": 0, "multicast": 0, "rx_length_errors": 0, "tx_dropped": 0, "rx_bytes": 8994, "rx_missed_errors": 0, "tx_errors": 0, "rx_compressed": 0, "rx_over_errors": 0, "tx_fifo_errors": 0, "rx_crc_errors": 0, "rx_packets": 130, "tx_heartbeat_errors": 0, "rx_dropped": 0, "tx_aborted_errors": 0, "tx_packets": 143, "rx_errors": 0, "tx_bytes": 12054, "tx_window_errors": 0, "rx_fifo_errors": 0, "tx_carrier_errors": 0 } } } > echo "Routing information:" > ip route show > echo Not quite the same, but similar. For each interface: root@Rpi2:~# ubus call network.interface.wan status { "up": true, "pending": false, "available": true, "autostart": true, "dynamic": false, "uptime": 758, "l3_device": "eth0", "proto": "dhcp", "device": "eth0", "updated": [ "addresses", "routes", "data" ], "metric": 2, "delegation": true, "ipv4-address": [ { "address": "192.168.5.182", "mask": 24 } ], "ipv6-address": [ ], "ipv6-prefix": [ ], "ipv6-prefix-assignment": [ ], "route": [ { "target": "192.168.5.1", "mask": 32, "nexthop": "0.0.0.0", "source": "192.168.5.182\/32" }, { "target": "0.0.0.0", "mask": 0, "nexthop": "192.168.5.1", "source": "192.168.5.182\/32" } ], "dns-server": [ "192.168.5.1" ], "dns-search": [ "lan" ], "inactive": { "ipv4-address": [ ], "ipv6-address": [ ], "route": [ ], "dns-server": [ ], "dns-search": [ ] }, "data": { "leasetime": 43200 } } > echo "Qdisc information:" > tc qdisc show > echo No equivalent. > echo "WiFi Information" > if [ -f /sys/class/net/wlan0/address ] > then > iw dev wlan0 info > fi > if [ -f /sys/class/net/wlan1/address ] > then > iw dev wlan1 info > fi root@Rpi2:~# ubus call iwinfo devices { "devices": [ "wlan0", "moni0" ] } root@Rpi2:~# ubus call iwinfo info "{'device':'wlan0'}" { "phy": "phy0", "ssid": "infsoft-ln", "bssid": "EE:94:F6:67:DB:E9", "country": "00", "mode": "Client", "channel": 11, "frequency": 2462, "txpower": 20, "quality": 70, "quality_max": 70, "signal": -35, "bitrate": 57800, "encryption": { "enabled": true, "wpa": [ 2 ], "authentication": [ "psk" ], "ciphers": [ "ccmp" ] }, "hwmodes": [ "b", "g", "n" ], "hardware": { "name": "Generic MAC80211" } } > echo > echo "dmesg output" > dmesg bruno _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev