mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 02:35:07 +01:00 
			
		
		
		
	Fix GPFS collector last state handling
This commit is contained in:
		@@ -70,6 +70,7 @@ func (m *GpfsCollector) Init(config json.RawMessage) error {
 | 
				
			|||||||
	for _, fs := range m.config.ExcludeFilesystem {
 | 
						for _, fs := range m.config.ExcludeFilesystem {
 | 
				
			||||||
		m.skipFS[fs] = struct{}{}
 | 
							m.skipFS[fs] = struct{}{}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						m.lastState = make(map[string]GpfsCollectorLastState)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// GPFS / IBM Spectrum Scale file system statistics can only be queried by user root
 | 
						// GPFS / IBM Spectrum Scale file system statistics can only be queried by user root
 | 
				
			||||||
	user, err := user.Current()
 | 
						user, err := user.Current()
 | 
				
			||||||
@@ -162,11 +163,16 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) {
 | 
				
			|||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Add filesystem tag
 | 
				
			||||||
		m.tags["filesystem"] = filesystem
 | 
							m.tags["filesystem"] = filesystem
 | 
				
			||||||
		if _, ok := m.lastState[filesystem]; !ok {
 | 
					
 | 
				
			||||||
			m.lastState[filesystem] = GpfsCollectorLastState{
 | 
							// Create initial last state
 | 
				
			||||||
				bytesRead:    -1,
 | 
							if m.config.SendBandwidths {
 | 
				
			||||||
				bytesWritten: -1,
 | 
								if _, ok := m.lastState[filesystem]; !ok {
 | 
				
			||||||
 | 
									m.lastState[filesystem] = GpfsCollectorLastState{
 | 
				
			||||||
 | 
										bytesRead:    -1,
 | 
				
			||||||
 | 
										bytesWritten: -1,
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user