@@ -15,10 +15,6 @@ class MaintenanceRrdStep extends LnmsCommand
1515{
1616 protected $ name = 'maintenance:rrd-step ' ;
1717
18- private int $ systemStep ;
19- private int $ icmpStep ;
20- private int $ systemHeartbeat ;
21-
2218 public function __construct ()
2319 {
2420 parent ::__construct ();
@@ -28,9 +24,9 @@ public function __construct()
2824
2925 public function handle (RrdProcess $ rrdProcess ): int
3026 {
31- $ this -> systemStep = (int ) LibrenmsConfig::get ('rrd.step ' , 300 );
32- $ this -> icmpStep = (int ) LibrenmsConfig::get ('ping_rrd_step ' , $ this -> systemStep );
33- $ this -> systemHeartbeat = (int ) LibrenmsConfig::get ('rrd.heartbeat ' , $ this -> systemStep * 2 );
27+ $ systemStep = (int ) LibrenmsConfig::get ('rrd.step ' , 300 );
28+ $ icmpStep = (int ) LibrenmsConfig::get ('ping_rrd_step ' , $ systemStep );
29+ $ systemHeartbeat = (int ) LibrenmsConfig::get ('rrd.heartbeat ' , $ systemStep * 2 );
3430
3531 $ hostname = (string ) $ this ->argument ('device ' );
3632 if ($ hostname !== 'all ' ) {
@@ -53,8 +49,8 @@ public function handle(RrdProcess $rrdProcess): int
5349 $ rrdFile = basename ($ file , '.rrd ' );
5450
5551 [$ step , $ heartbeat ] = $ rrdFile === 'icmp-perf '
56- ? [$ this -> icmpStep , $ this -> icmpStep * 2 ]
57- : [$ this -> systemStep , $ this -> systemHeartbeat ];
52+ ? [$ icmpStep , $ icmpStep * 2 ]
53+ : [$ systemStep , $ systemHeartbeat ];
5854
5955 try {
6056 $ this ->checkRrdFile ($ rrdProcess , $ file , $ step , $ heartbeat );
@@ -133,7 +129,9 @@ private function modifyXml(string $xmlContent, int $step, int $heartbeat): strin
133129 */
134130 private function listFiles (string $ hostname , RrdProcess $ rrdProcess ): array
135131 {
136- $ command = $ hostname === 'all ' ? ['list -r . ' , '' ] : "list ./ $ hostname " ;
132+ $ rrd_dir = LibrenmsConfig::get ('rrd_dir ' , LibrenmsConfig::get ('install_dir ' ) . '/rrd ' );
133+
134+ $ command = $ hostname === 'all ' ? "list -r $ rrd_dir " : "list $ rrd_dir/ $ hostname " ;
137135 $ output = rtrim ($ rrdProcess ->run ($ command ));
138136
139137 if (empty ($ output )) {
0 commit comments