aditya1977 has asked for the wisdom of the Perl Monks concerning the following question:
# Get a list of volumes that are being monitored and attempt # to get data about them # $sth = $dbh->prepare("SELECT volumeletter,peernodes from VolData order + by volumeid"); $sth->execute(); # Iterate over configured volumes and update status, rrd data and grap +hs while ( my ($vol,$peernodes) = $sth->fetchrow_array() ) { print "\n\n\nVOLUME $vol Peer nodes ($peernodes)\n\n\n"; # Populate a hash with current volume data %voldata = &getVolumeData($vol,$peernodes); # Now, let's update the database with the volumes current stat +e switch ($voldata{'MirrorState'}) { case "0" {$vol_current_state = "Not Mirrored"} case "1" {$vol_current_state = "Mirroring"} case "2" {$vol_current_state = "Resync"} case "3" {$vol_current_state = "Broken"} case "4" {$vol_current_state = "Paused"} case "5" {$vol_current_state = "Resync Pending"} else {$vol_current_state = "Unknown"} } print "COLLECTOR: Setting volume $vol to state $vol_current_st +ate\n"; #$sth = $dbh->prepare("UPDATE VolData SET volstatus = '$vol_cu +rrent_state' WHERE volumeletter = '$vol'"); #$sth->execute(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why does DBI prepare break my loop?
by hippo (Archbishop) on Jul 07, 2014 at 10:12 UTC | |
|
Re: Why does DBI prepare break my loop?
by Corion (Patriarch) on Jul 07, 2014 at 10:19 UTC | |
|
Re: Why does DBI prepare break my loop?
by Anonymous Monk on Jul 07, 2014 at 10:13 UTC | |
|
Re: Why does DBI prepare break my loop?
by locked_user sundialsvc4 (Abbot) on Jul 07, 2014 at 13:48 UTC | |
by roboticus (Chancellor) on Jul 08, 2014 at 01:56 UTC | |
by Anonymous Monk on Jul 07, 2014 at 22:39 UTC | |
|
Re: Why does DBI prepare break my loop?
by perlfan (Parson) on Jul 07, 2014 at 11:41 UTC | |
by McA (Priest) on Jul 07, 2014 at 12:31 UTC | |
by perlfan (Parson) on Jul 07, 2014 at 15:44 UTC | |
by McA (Priest) on Jul 07, 2014 at 16:21 UTC |