@@ -18,8 +18,10 @@ package oracle
1818import (
1919 "bufio"
2020 "bytes"
21+ "fmt"
2122 "strings"
2223
24+ "github.com/ercole-io/ercole-agent/v2/marshal"
2325 "github.com/ercole-io/ercole/v2/model"
2426)
2527
@@ -54,15 +56,45 @@ func MemoryAdvisor(cmdOutput []byte) (*model.OracleDatabaseMemoryAdvisor, error)
5456 switch splitted [0 ] {
5557 case "MEMORY_SIZE_LOWER_GB" :
5658 res .AutomaticMemoryManagement = true
57- res .MemorySizeLowerGb = splitted [1 ]
59+
60+ val , err := marshal .TrimParseUnsafeFloat64Pointer (splitted [1 ], marshal .TrimParseFloat64 )
61+ if err != nil {
62+ return nil , err
63+ }
64+
65+ if val == nil {
66+ res .MemorySizeLowerGb = "N/A"
67+ } else {
68+ res .MemorySizeLowerGb = fmt .Sprintf ("%.3f" , * val )
69+ }
5870
5971 case "PGA_TARGET_AGGREGATE_LOWER_GB" :
6072 res .AutomaticMemoryManagement = false
61- res .PgaTargetAggregateLowerGb = splitted [1 ]
73+
74+ val , err := marshal .TrimParseUnsafeFloat64Pointer (splitted [1 ], marshal .TrimParseFloat64 )
75+ if err != nil {
76+ return nil , err
77+ }
78+
79+ if val == nil {
80+ res .PgaTargetAggregateLowerGb = "N/A"
81+ } else {
82+ res .PgaTargetAggregateLowerGb = fmt .Sprintf ("%.3f" , * val )
83+ }
6284
6385 case "SGA_SIZE_LOWER_GB" :
6486 res .AutomaticMemoryManagement = false
65- res .SgaSizeLowerGb = splitted [1 ]
87+
88+ val , err := marshal .TrimParseUnsafeFloat64Pointer (splitted [1 ], marshal .TrimParseFloat64 )
89+ if err != nil {
90+ return nil , err
91+ }
92+
93+ if val == nil {
94+ res .SgaSizeLowerGb = "N/A"
95+ } else {
96+ res .SgaSizeLowerGb = fmt .Sprintf ("%.3f" , * val )
97+ }
6698 }
6799 }
68100 }
0 commit comments