Linux remotely - DLINK DNS-323

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
sharkys
Posts: 12
Joined: Sun Oct 05, 2008 11:17 am

Linux remotely - DLINK DNS-323

Post by sharkys »

First of all - thank you to authors for marvelous Cacti ! :wink:

I just bought recently NAS solution D-LINK DNS-323 http://www.dlink.com/products/?pid=509, however the question is valid also for Linux "REMOTE" monitoring (maybe this term is completely wrong :o )- maybe some script exists already, but I haven't find anything.

I discovered, that this NAS disk is providing some information trought web interface via /proc virtual file system, examples below.

Guys, please, is there any script already in place for such monitoring (http://en.wikipedia.org/wiki/Procfs#Linux) ? Any help is really appreciated.


http://192.168.0.195/proc/meminfo

Code: Select all

MemTotal: 61948 kB MemFree: 1252 kB Buffers: 10804 kB Cached: 38944 kB SwapCached: 0 kB Active: 20128 kB Inactive: 34808 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 61948 kB LowFree: 1252 kB SwapTotal: 1060208 kB SwapFree: 1060208 kB Dirty: 7768 kB Writeback: 0 kB Mapped: 8772 kB Slab: 4004 kB CommitLimit: 1091180 kB Committed_AS: 12580 kB PageTables: 244 kB VmallocTotal: 450560 kB VmallocUsed: 8776 kB VmallocChunk: 441588 kB 
http://192.168.0.195/proc/swaps

Code: Select all

Filename Type Size Used Priority /dev/sda1 partition 530104 0 -1 /dev/sdb1 partition 530104 0 -2 
http://192.168.0.195/proc/partitions

Code: Select all

major minor #blocks name 7 0 5484 loop0 31 0 64 mtdblock0 31 1 64 mtdblock1 31 2 1536 mtdblock2 31 3 6336 mtdblock3 31 4 192 mtdblock4 9 0 1951431424 md0 8 0 976762584 sda 8 1 530113 sda1 8 2 975715807 sda2 8 4 514080 sda4 8 16 976762584 sdb 8 17 530113 sdb1 8 18 975715807 sdb2 8 20 514080 sdb4 
http://192.168.0.195/proc/diskstats

Code: Select all

1 0 ram0 0 0 0 0 0 0 0 0 0 0 0 1 1 ram1 0 0 0 0 0 0 0 0 0 0 0 1 2 ram2 0 0 0 0 0 0 0 0 0 0 0 1 3 ram3 0 0 0 0 0 0 0 0 0 0 0 1 4 ram4 0 0 0 0 0 0 0 0 0 0 0 1 5 ram5 0 0 0 0 0 0 0 0 0 0 0 1 6 ram6 0 0 0 0 0 0 0 0 0 0 0 1 7 ram7 0 0 0 0 0 0 0 0 0 0 0 1 8 ram8 0 0 0 0 0 0 0 0 0 0 0 1 9 ram9 0 0 0 0 0 0 0 0 0 0 0 1 10 ram10 0 0 0 0 0 0 0 0 0 0 0 1 11 ram11 0 0 0 0 0 0 0 0 0 0 0 1 12 ram12 0 0 0 0 0 0 0 0 0 0 0 1 13 ram13 0 0 0 0 0 0 0 0 0 0 0 1 14 ram14 0 0 0 0 0 0 0 0 0 0 0 1 15 ram15 0 0 0 0 0 0 0 0 0 0 0 7 0 loop0 0 0 0 0 0 0 0 0 0 0 0 7 1 loop1 0 0 0 0 0 0 0 0 0 0 0 7 2 loop2 0 0 0 0 0 0 0 0 0 0 0 7 3 loop3 0 0 0 0 0 0 0 0 0 0 0 7 4 loop4 0 0 0 0 0 0 0 0 0 0 0 7 5 loop5 0 0 0 0 0 0 0 0 0 0 0 7 6 loop6 0 0 0 0 0 0 0 0 0 0 0 7 7 loop7 0 0 0 0 0 0 0 0 0 0 0 31 0 mtdblock0 144 28 488 100 58 35 188 39920 0 15260 40020 31 1 mtdblock1 104 14 332 50 68 47 230 1160 0 430 1210 31 2 mtdblock2 2 0 16 0 0 0 0 0 0 0 0 31 3 mtdblock3 2 0 16 0 0 0 0 0 0 0 0 31 4 mtdblock4 3 0 24 20 0 0 0 0 0 20 20 9 0 md0 543 0 4756 0 798306 0 21804912 0 0 0 0 8 0 sda 538 64 4290 12490 173449 344554 12311358 1284490 0 100260 1297240 8 1 sda1 1 8 6 6 8 2 sda2 531 3932 518052 12311224 8 4 sda4 34 74 42 128 8 16 sdb 99 241 1400 20740 138464 141803 9493742 1635010 0 82260 1655760 8 17 sdb1 1 8 6 6 8 18 sdb2 275 1024 280254 9493688 8 20 sdb4 35 136 24 48 9 1 md1 0 0 0 0 0 0 0 0 0 0 0 
http://192.168.0.195/proc/net/dev

Code: Select all

Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed egiga0:2124977244 8028679 0 0 0 0 0 0 325404188 4426512 0 0 0 0 0 0 lo: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
Thank you.
sharkys
Posts: 12
Joined: Sun Oct 05, 2008 11:17 am

Post by sharkys »

Any advice / help / recommendation ? :wink:
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Well, that's easy.

1) Create a generic "wget/curl" script that accepts any url as an input parameter to fetch the raw data
2) Create wrapper script to reformat (and/or filter) the data received to make them look like cacti requires (see 1st link of my sig for the format required for cacti)

Reinhard
sharkys
Posts: 12
Joined: Sun Oct 05, 2008 11:17 am

Post by sharkys »

@Gandalf, thank you. Unfortunatelly I`m not a developer ... :( I`m really not sure that I`m able to create wraper using some regex...

Update 9.10.2008 : OK, I found RegexBuddy.... :D Now it`s time to play with Cacti...

Code: Select all

#!/usr/bin/perl
$server = $ARGV[0];
$getdata = `/usr/local/bin/wget --quiet -O - \"http:\/\/$server\/proc\/net\/dev" | grep egiga0`;
$getdata =~ s/ +/\|/g;
$getdata =~ s/:+/\|/g;
@getdata = split(/\|/, $getdata);

print "device:" . $getdata[0] . " RX_bytes:" . $getdata[1] . " RX_packets:" . $getdata[2] . " RX_errors:" .
        $getdata[3] . " RX_drop:" . $getdata[4] . " RX_fifo:" . $getdata[5] . " RX_frame:" .
                $getdata[6] . " RX_compressed:" . $getdata[7] . " RX_multicast:" . $getdata[8] .
                " TX_bytes:" . $getdata[9] . " TX_packets:" . $getdata[10] . " TX_errors:" .
        $getdata[11] . " TX_drop:" . $getdata[12] . " TX_fifo:" . $getdata[13] . " TX_frame:" .
                $getdata[14] . " TX_compressed:" . $getdata[15] . " TX_multicast:" . $getdata[16];
Result :

Code: Select all

device:egiga0 RX_bytes:4087737794 RX_packets:59723657 RX_errors:0 RX_drop:0 RX_fifo:0 RX_frame:0 RX_compressed:0 RX_multicast:0 TX_bytes:1849456982 TX_packets:25728668 TX_errors:0 TX_drop:0 TX_fifo:0 TX_frame:0 TX_compressed:0 TX_multicast:0
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest