summaryrefslogtreecommitdiff
path: root/sysutils/backuppc-devel/files/patch-bin-BackupPC_rrdUpdate
blob: 3289e88e4f3a048c67e70db4e1ac469ac2170a14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- ./bin/BackupPC_rrdUpdate.orig	2013-12-09 17:06:45.000000000 +0400
+++ ./bin/BackupPC_rrdUpdate	2013-12-10 12:24:41.000000000 +0400
@@ -109,7 +109,7 @@
     }
     $sizeTot = $sizeTot / 1024;
 
-    print $bpc->cmdSystemOrEval(
+    if ( $err = $bpc->cmdSystemOrEval(
             [
                 $Conf{RrdToolPath},
                 "update", $RRDFile,
@@ -119,13 +119,17 @@
                 . $Info{"poolKb"}  . ":"
                 . $Info{"pool4Kb"} . ":"
                 . $Info{"cpool4Kb"}
-            ]);
-     printf("%sRRD updated:"
+            ]) ) {
+        print "$err";
+    }
+    else {
+        printf("%sRRD updated:"
           . " date %s; cpoolKb %f; total %f;"
           . " poolKb %f; pool4Kb %f; cpool4Kb %f\n",
                 $bpc->timeStamp,
                 $NowRnd1, $Info{"cpoolKb"}, $sizeTot,
                 $Info{"poolKb"}, $Info{"pool4Kb"}, $Info{"cpool4Kb"});
+    }
 }
 
 #
@@ -140,7 +144,7 @@
     #
     # Get each pool max value from RRD
     #
-    $bpc->cmdSystemOrEval(
+    $bpc->cmdSystemOrEvalLong(
             [
                 $Conf{RrdToolPath},
                 "graphv", "-",
@@ -158,7 +162,7 @@
                 if ( $_[0] =~ /^print\[([0-3])\] = "([.0-9]+)"$/ ) {
                     $poolMax[$1] = $2 unless ( $2 == 0 );
                 }
-            });
+            }, 1, undef);
 
     my $poolSizeGraph = [
         "$Conf{RrdToolPath}",
@@ -228,6 +232,6 @@
         print("Can't open/create $LogDir/poolUsage$weeks.png\n");
         return;
     }
-    $bpc->cmdSystemOrEval($poolSizeGraph, sub { print $fdOut $_[0] });
+    $bpc->cmdSystemOrEvalLong($poolSizeGraph, sub { print $fdOut $_[0] }, 1, undef);
     close($fdOut);
 }