MyPage

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 12:30, 5 January 2010 (edit)
Gi-minni (Talk | contribs)
(Installation)
← Previous diff
Revision as of 12:33, 5 January 2010 (edit) (undo)
Gi-minni (Talk | contribs)
(Configuration)
Next diff →
Line 99: Line 99:
== Configuration == == Configuration ==
To set the nvram variable login into your device using telnet or ssh and at the command line execute: To set the nvram variable login into your device using telnet or ssh and at the command line execute:
- nvram set mypage_scripts="/opt/www/MyPage1.asp /opt/www/MyPage2.asp /opt/www/MyPage3.asp /opt/www/MyPage4.asp /opt/www/MyPage5.asp /opt/www/MyPage6.asp /opt/www/MyPage7.asp"+ nvram set mypage_scripts="/opt/www/mypage1.sh /opt/www/mypage2.sh /opt/www/mypage3.sh /opt/www/mypage4.sh /opt/www/mypage5.sh /opt/www/mypage6.sh /opt/www/mypage7.sh /opt/www/mypage8.sh /opt/www/mypage9.sh"
Don't forget to make the changes persistent with: Don't forget to make the changes persistent with:
nvram commit nvram commit
-'''The script order is important. It can be called with http://192.168.1.1/MyPage.asp?1, ..., http://192.168.1.1/MyPage.asp?7'''+'''The script order is important. It can be called with http://192.168.1.1/MyPage.asp?1, ..., http://192.168.1.1/MyPage.asp?9'''
With version 0.9 theme and national language support (NLS) is available. All the DD-WRT themes are supported. Currently only english and german translation is available. With version 0.9 theme and national language support (NLS) is available. All the DD-WRT themes are supported. Currently only english and german translation is available.

Revision as of 12:33, 5 January 2010

Contents

Introduction

The main advantage to expand the DD-WRT web interface with your own scripts is the ability to quickly see what happens with your router without opening an ssh or telnet shell and thinking around which command must be executed to see some useful results.

Many of us that use DD-WRT have small or no linux skill, so it is great to have the most useful linux command executed inside a web page, just click one of this tabs and feel good.

This is possible by using the NVRAM variable mypage_scripts. Usually this variable is empty and normally you don't care about it. In this case you must set this variable to be able to see the scripts inside the web interface.

Please read carefully the next sections to understand what are the prerequisites needed and how to install and configure this pages.

Prerequisite

Look at the syntax of some useful linux commands. (See Useful Scripts)

Look how to use telnet or ssh to gain access to the command shell. (See Telnet/SSH)

Look how to setup the variable using nvram. (See Hardware)

Look how to mount a partition on USB sotrage. (See USB Storage)

Requirements

The scheme of mypage_scripts is:

mypage_scripts="</storage/www/page[1].sh> </storage/www/page[2].sh> ... </storage/www/page[n-1].sh> </storage/www/page[n].sh>"

Exchange storage with your underlying filesystem /jffs, /mmc, /mnt, ...

Currently there are nine scripts named mypage1.sh, ..., mypage9.sh.

Feel free to use only some of them. If this is the case set the order of mypage_scripts accordingly. Right now the filename is not important. Important is the order inside the mypage_scripts variable.

mypage1.sh is named Host.
This script displays different information about your device like device name, firmware, kernel version, memory, CPU and loaded drivers.

mypage2.sh is named Wireless.
This script displays some wireless info like driver core, interface, status, version and capabilities.

mypage3.sh is named Storage.
This script displays all information about the partition/disk in use like internal/external disks and flash.

mypage4.sh is named Network.
This script displays network related stuff like open ports, interfaces, routing table, arp table and domain name server.

mypage5.sh is named Kernel.
This scripts shows all the kernel messages emitted during the booting time of your device.

mypage6.sh is named NVRAM.
This scripts shows all the variables stored inside the NVRAM space of your device.

mypage7.sh is named OPT.
This scripts shows all the installed and available software packages from OPTware on your device.

mypage8.sh is named Procs.
This scripts shows all the top processes sorted by CPU and MEM of your device.

mypage9.sh is named Ports.
This scripts shows all the open network ports of your device.

Download

The file (e.g. mypage-files-v0.10-20091227-00185.tgz) is stored inside the forum pages.

Please download it from the My Page thread to /opt/www

Installation

Download the tgz file from the download section and find a useful place where to store it. In my case I store the file under /opt/www. This directory is a symlink to /jffs/opt/www. Choose whatever directory you like, don't forget to choose a persistent partition that survive a device reboot. Don't use /tmp, because it is a volatile RAM area.

You can choose another place, depending which filesystem you own. (SD,MMC,USB,CIFS)

Go to /opt/www and extract the file with:

tar -xvzf mypage-files-v0.10-20091227-00185.tgz .

Set the flags with:

chmod 644 *.log
chmod 755 *

Root must own the files with:

chown root.root *

In your target directory there must be the following files:

  0 drwx------     2 root     root              0 Jan  5 13:26 .
  0 drwxr-xr-x  16 root      root             0 Jan  5 13:26 ..
  1 -rw-r--r--      1 root     root        1338 Jan  4 09:58 mypage.css
  0 -rwxr-xr-x     1 root     root          119 Jan  5 09:26 mypage.live.asp
  4 -rw-r--r--      1 root     root         3788 Jan  5 11:44 mypage.log
 11 -rwxr-xr-x    1 root     root       11578 Jan  4 18:10 mypage1.sh
 11 -rwxr-xr-x    1 root     root       11559 Jan  4 18:54 mypage2.sh
 11 -rwxr-xr-x    1 root     root       11329 Jan  4 18:10 mypage3.sh
 10 -rwxr-xr-x    1 root     root       10717 Jan  4 18:10 mypage4.sh
 10 -rwxr-xr-x    1 root     root         9734 Jan  4 18:09 mypage5.sh
 10 -rwxr-xr-x    1 root     root       10110 Jan  4 18:09 mypage6.sh
 11 -rwxr-xr-x    1 root     root       10935 Jan  4 18:09 mypage7.sh
 10 -rwxr-xr-x    1 root     root       10019 Jan  5 11:55 mypage8.sh
  9 -rwxr-xr-x     1 root     root         9217 Jan  5 11:55 mypage9.sh
  4 -rw-r--r--      1 root     root         3626 Jan  5 11:45 mypage_common.js
  5 -rw-r--r--      1 root     root         4964 Jan  4 19:10 mypage_english.js
  5 -rw-r--r--      1 root     root         5023 Jan  4 19:09 mypage_german.js

Configuration

To set the nvram variable login into your device using telnet or ssh and at the command line execute:

nvram set mypage_scripts="/opt/www/mypage1.sh /opt/www/mypage2.sh /opt/www/mypage3.sh /opt/www/mypage4.sh /opt/www/mypage5.sh /opt/www/mypage6.sh /opt/www/mypage7.sh /opt/www/mypage8.sh /opt/www/mypage9.sh"

Don't forget to make the changes persistent with:

nvram commit

The script order is important. It can be called with http://192.168.1.1/MyPage.asp?1, ..., http://192.168.1.1/MyPage.asp?9

With version 0.9 theme and national language support (NLS) is available. All the DD-WRT themes are supported. Currently only english and german translation is available.

Everyone who are able and willing to translate, are kindly requested to contact me (gi-minni).

With NLS there is a need to have a symbolic link from the place where you stored the files to /tmp/www and a startup script that mount this place to /tmp/www after every reboot.

To test it the first time manually, please do:

# Link /opt/www to /tmp/www for mypage i18n support
if [ -d /tmp/www ]; then rm -rf /tmp/www; fi
ln -s /opt/www /tmp/www

In the /etc/config directory store a startup script named opt.startup

I use /jffs because my device (ASUS RT-N16) has enough space to store things inside the flash partition.

#!/bin/ash
# Mount /jffs/opt to /opt
if [ -d /jffs/opt ]; then mount -o bind /jffs/opt /opt; fi
# Link /opt/www to /tmp/www for mypage i18n support
if [ -d /tmp/www ]; then rm -rf /tmp/www; fi
ln -s /opt/www /tmp/www

Please pay attention that the above script is suited for jffs partitions. Change it for other partition type accordingly.

Screenshots

Here I stored all the screenshots. Feel free to post your comments & suggestions.

MyPage1.asp - (Host device information page)
MyPage1.asp - (Host device information page)
MyPage2.asp - (Wireless information page)
MyPage2.asp - (Wireless information page)
MyPage3.asp - (Storage information page)
MyPage3.asp - (Storage information page)
MyPage4.asp - (Network information page)
MyPage4.asp - (Network information page)
MyPage5.asp - (Kernel messages page)
MyPage5.asp - (Kernel messages page)
MyPage6.asp - (NVRAM variables page)
MyPage6.asp - (NVRAM variables page)
MyPage7.asp - (OPT packages page)
MyPage7.asp - (OPT packages page)

Changelog

v0.10-20091227-00185
[CHG] Every help header has a link to it's fieldset - gi-minni
[CHG] Help can include hyperlink - gi-minni
[CHG] Host and device are limited to 17 chars each - gi-minni
[CHG] Due to space constraints mypage is rearranged 1 level up - gi-minni
[ADD] Forum search added to the essential links - gi-minni
[CHG] Flash- and diskblock position rearranged in storage page - gi-minni
[ADD] Backup NVRAM download button added in storage page - gi-minni
[ADD] Backup CFE download button added in storage page - gi-minni
v0.9-20091224-00167
[ADD] Added One german and one english javascript file - gi-minni
[ADD] Added common javascript file - gi-minni
[ADD] Added German and English translations - gi-minni
[ADD] Every page is NLS aware - gi-minni
[CHG] Choosed Monospace font for a sharper view - gi-minni
[CHG] Rearrangements stuff in main page - gi-minni 
[CHG] Download file link adjusted to callback url - gi-minni
[ADD] Theme depends from nvram variable router_style - gi-minni
[ADD] Language depends from nvram variable language - gi-minni
[ADD] Add device to the info header and also into the main page - gi-minni
v0.8-20091223-00047
|ADD] Added date to the info header - gi-minni
[ADD] Added ARP Table to network page - gi-minni
[ADD] Added router database link - gi-minni
[ADD] Hostname added to the info header - gi-minni
[ADD] Started to add language support to the refresh button - gi-minni
[ADD] Autorefresh WAN IP enabled in the header - gi-minni
[ADD] Autorefresh uptime enabled in the header - gi-minni
[ADD] dd-wrt about page added in the header - gi-minni
[CHG] corrected various typos & bugs - gi-minni
v0.7-20091222-00037
[ADD] Added relevant dd-wrt and svn links - gi-minni
[CHG] Help information can display multiple links - gi-minni
[ADD] Version information is showed on each page - gi-minni
[ADD] Added inline stylesheet version - gi-minni
[ADD] New OPT page shows the installed and available opt packages - gi-minni
v0.6-20091221-00033
[ADD] Help information provided with notes and links - gi-minni
[ADD] inline stylesheet added with note and also style - gi-minni
v0.5-20091221-00021
[CHG] Pages are rendered in standard compliance mode (no quirks mode) - gi-minni
[CHG] Page suffix changed to asp - gi-minni
[ADD] Driver capabilities is wrapped as token for correct alignment - gi-minni
[CHG] Wireless info depends on interface read from nvram variable - gi-minni
[ADD] Help information is showed on each page - gi-minni
[ADD] Flash information on storage page - gi-minni
[CHG] Every wrapped lines is marked with the raquo symbol - gi-minni
v0.4-20091220-00015
[DEL] Uptime information removed from every page - gi-minni
[ADD] Header info reflect actual design - gi-minni
[ADD] HTML pagetitle reflect actual design - gi-minni
[ADD] Routing table added to network page - gi-minni
[ADD] Domain name server added to network page - gi-minni
[ADD] Kernel page added and wrapped at pos 75 for correct alignment - gi-minni
[ADD] NVRAM page added and wrapped at pos 75 for correct alignment - gi-minni
v0.3-20091220-00010
[ADD] netstat is cutted at pos 75 for correct alignment - gi-minni
[ADD] process list is wrapped at pos 75 for correct alignment - gi-minni
[NEW] initial version - gi-minni