@@ -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 ();
@@ -30,9 +26,9 @@ public function handle(RrdProcess $rrdProcess): int
3026 {
3127 $ this ->configureOutputOptions ();
3228
33- $ this -> systemStep = (int ) LibrenmsConfig::get ('rrd.step ' , 300 );
34- $ this -> icmpStep = (int ) LibrenmsConfig::get ('ping_rrd_step ' , $ this -> systemStep );
35- $ this -> systemHeartbeat = (int ) LibrenmsConfig::get ('rrd.heartbeat ' , $ this -> systemStep * 2 );
29+ $ systemStep = (int ) LibrenmsConfig::get ('rrd.step ' , 300 );
30+ $ icmpStep = (int ) LibrenmsConfig::get ('ping_rrd_step ' , $ systemStep );
31+ $ systemHeartbeat = (int ) LibrenmsConfig::get ('rrd.heartbeat ' , $ systemStep * 2 );
3632
3733 $ hostname = (string ) $ this ->argument ('device ' );
3834 if ($ hostname !== 'all ' ) {
@@ -55,8 +51,8 @@ public function handle(RrdProcess $rrdProcess): int
5551 $ rrdFile = basename ($ file , '.rrd ' );
5652
5753 [$ step , $ heartbeat ] = $ rrdFile === 'icmp-perf '
58- ? [$ this -> icmpStep , $ this -> icmpStep * 2 ]
59- : [$ this -> systemStep , $ this -> systemHeartbeat ];
54+ ? [$ icmpStep , $ icmpStep * 2 ]
55+ : [$ systemStep , $ systemHeartbeat ];
6056
6157 try {
6258 $ this ->checkRrdFile ($ rrdProcess , $ file , $ step , $ heartbeat );
@@ -135,7 +131,9 @@ private function modifyXml(string $xmlContent, int $step, int $heartbeat): strin
135131 */
136132 private function listFiles (string $ hostname , RrdProcess $ rrdProcess ): array
137133 {
138- $ command = $ hostname === 'all ' ? ['list -r . ' , '' ] : "list ./ $ hostname " ;
134+ $ rrd_dir = LibrenmsConfig::get ('rrd_dir ' , LibrenmsConfig::get ('install_dir ' ) . '/rrd ' );
135+
136+ $ command = $ hostname === 'all ' ? "list -r $ rrd_dir " : "list $ rrd_dir/ $ hostname " ;
139137 $ output = rtrim ($ rrdProcess ->run ($ command ));
140138
141139 if (empty ($ output )) {
0 commit comments