Author Topic: Munin script for tracking your wallet balance  (Read 3185 times)

0 Members and 1 Guest are viewing this topic.

Offline Banch

  • Newbie
  • *
  • Posts: 9
    • View Profile
Thanks emre! :) Hope it works well for you
Part of the Memorycoin 2.0 support team. Contacts in Finnish/English
MMC:MLAdfMX6LestwzuaQMyMFiGNrqM9qCS2Qf
LTC: LYdwtVfmaeCX8TyZ8etUBJfhithSxBATtc

emre

  • Guest
thanks, I will try this as soon as possible.

tip is on the way.

Offline 5chdn

  • Sr. Member
  • ****
  • Posts: 487
  • i wonder how many chars i can put in this field 50
    • View Profile
    • Votesapp
  • GitHub: 5chdn
I added my voting addresses to the script to monitor donations.


Code: [Select]
#!/usr/bin/perl

if ($ARGV[0] =~ /config/i ) {
    print "graph_title Memorycoins\n";
    print "graph_vlabel MMC\n";
    print "graph_category coins\n";
    print "graph_info This graph shows memorycoin income.\n";
    print "total.label MMC mined\n";
    print "total.type GAUGE\n";
    print "total.info Memorycoins\n";
    print "cto.label CTO donations\n";
    print "cto.type GAUGE\n";
    print "cto.info Memorycoins\n";
    print "cha.label CHA donations\n";
    print "cha.type GAUGE\n";
    print "cha.info Memorycoins\n";
} else {
        $k=`wget -T 30 -qO /dev/stdout http://www.chainbrowser.com/memorycoin/address/M8KwEyRxVTHFtZbtA7s1qVHuoGACRfJZYC/`;
        @rows = split(/\n/, $k);
        foreach (@rows) {
                $row = $_;
                if ($row =~ /Total Input Amounts: <\/span>(.*) MMC<\/div>/i ) {
                        $coins = $1;
                }
        }
        print "total.value ".$coins."\n";
        $k=`wget -T 30 -qO /dev/stdout http://www.chainbrowser.com/memorycoin/address/MVTEctoAKRbPGwXbxaVU46KphsynmrVVC4/`;
        @rows = split(/\n/, $k);
        foreach (@rows) {
                $row = $_;
                if ($row =~ /Total Input Amounts: <\/span>(.*) MMC<\/div>/i ) {
                        $coins = $1;
                }
        }
        print "cto.value ".$coins."\n";
       $k=`wget -T 30 -qO /dev/stdout http://www.chainbrowser.com/memorycoin/address/MVTEcha4La8HeNaewF4oaSFUwaRep8xEyR/`;
       @rows = split(/\n/, $k);
       foreach (@rows) {
               $row = $_;
               if ($row =~ /Total Input Amounts: <\/span>(.*) MMC<\/div>/i ) {
                       $coins = $1;
               }
       }
        print "cha.value ".$coins."\n";
}

Offline Banch

  • Newbie
  • *
  • Posts: 9
    • View Profile
Thanks mates and thank you for adding that to the wiki site s4l1h!
Part of the Memorycoin 2.0 support team. Contacts in Finnish/English
MMC:MLAdfMX6LestwzuaQMyMFiGNrqM9qCS2Qf
LTC: LYdwtVfmaeCX8TyZ8etUBJfhithSxBATtc


Offline 5chdn

  • Sr. Member
  • ****
  • Posts: 487
  • i wonder how many chars i can put in this field 50
    • View Profile
    • Votesapp
  • GitHub: 5chdn
Good work banch!

I got that running now. If we can answer that question, we could add average graphs: http://serverfault.com/q/564515/116529

Offline Banch

  • Newbie
  • *
  • Posts: 9
    • View Profile
This script basicly just shows your current wallet status by a day/week/month/year

Heres a screenshot how mine script looks like after running it nearly two hours:
http://puu.sh/660IJ.png

This script has be tested with munin 1.4.3, 2.0.1 and 2.0.2 and working on every version.

If you don't have munin already installed you can check Digital Oceans guide  how to install munin-guide from https://www.digitalocean.com/community/articles/how-to-install-munin-on-an-ubuntu-vps


First you need to get root permissions so:
Code: [Select]
su
Then go to the correct folder
Code: [Select]
cd /usr/share/munin/plugins/
Then lets make a plugin
Code: [Select]
nano mmccoin
Here are the code for the script what you add:
Code: [Select]
#!/usr/bin/perl

if ($ARGV[0] =~ /config/i ) {
    print "graph_title mmc coins\n";
    print "graph_vlabel pieces\n";
    print "graph_category coins\n";
    print "graph_info This graph shows mmc coins\n";
    print "mmccoin.label mmc\n";
    print "mmccoin.type GAUGE\n";
    print "mmccoin.info mmc coins\n";
} else {
$k=`wget  -T 10 -qO /dev/stdout http://www.chainbrowser.com/memorycoin/address/MWydkmErZaNh2zy7PCZgmFeyTumReiKo8E/`;
@rows = split(/\n/, $k);
foreach (@rows) {
$row = $_;
if ($row =~ /Total Input Amounts: <\/span>(.*) MMC<\/div>/i ) {
$coins = $1;
}
}
print "mmccoin.value ".$coins."\n";
}

You NEED to change wallet address pointing to your wallet

After you've saved the file lets change its permissions:
Code: [Select]
chmod 755 mmccoin
Now lets change the folder again:
Code: [Select]
cd  /etc/munin/plugins/
And lets make link to point where the plugin is:
Code: [Select]
ln -s /usr/share/munin/plugins/mmccoin mmccoin
And now we should restart the munin-node:
Code: [Select]
/etc/init.d/munin-node restart
After about 5mins you should have a website showing your wallet status by day/week/month/year.
http://yourip.ip/munin should be the address

Thanks and happy new year everyone!
« Last Edit: January 01, 2014, 10:55:48 pm by Banch »
Part of the Memorycoin 2.0 support team. Contacts in Finnish/English
MMC:MLAdfMX6LestwzuaQMyMFiGNrqM9qCS2Qf
LTC: LYdwtVfmaeCX8TyZ8etUBJfhithSxBATtc