Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Bad df command #1632

Merged

Conversation

madestreel
Copy link
Contributor

If the filesystem name is to long the result of df -h / will end up on two lines. Which causes the following error:

panic: runtime error: index out of range [1] with length 1

goroutine 477 [running]:
github.com/memphisdev/memphis/server.getUnixStorageSize()
	/go/src/memphis/server/memphis_handlers_monitoring.go:1054 +0x454
github.com/memphisdev/memphis/server.MonitoringHandler.GetSystemComponents({0xc0001ced80?})
	/go/src/memphis/server/memphis_cloud.go:382 +0x9be8
github.com/memphisdev/memphis/server.MonitoringHandler.getMainOverviewDataDetails.func2()
	/go/src/memphis/server/memphis_cloud.go:1680 +0x45
created by github.com/memphisdev/memphis/server.MonitoringHandler.getMainOverviewDataDetails
	/go/src/memphis/server/memphis_cloud.go:1679 +0x2ca

Example:

/run # df -h /
Filesystem                Size      Used Available Use% Mounted on
/dev/mapper/cryptvol-root
                        446.5G    268.3G    170.7G  61% /

Solution for this is to force the output in POSIX output format.

/run # df -h -P /
Filesystem                Size      Used Available Capacity Mounted on
/dev/mapper/cryptvol-root         446.5G    268.3G    170.7G  61% /

If the filesystem name is to long the result of `df -h /` will end up on two lines. Which causes the following error:

```
panic: runtime error: index out of range [1] with length 1

goroutine 477 [running]:
github.com/memphisdev/memphis/server.getUnixStorageSize()
	/go/src/memphis/server/memphis_handlers_monitoring.go:1054 +0x454
github.com/memphisdev/memphis/server.MonitoringHandler.GetSystemComponents({0xc0001ced80?})
	/go/src/memphis/server/memphis_cloud.go:382 +0x9be8
github.com/memphisdev/memphis/server.MonitoringHandler.getMainOverviewDataDetails.func2()
	/go/src/memphis/server/memphis_cloud.go:1680 +0x45
created by github.com/memphisdev/memphis/server.MonitoringHandler.getMainOverviewDataDetails
	/go/src/memphis/server/memphis_cloud.go:1679 +0x2ca
```

Example:

```
/run # df -h /
Filesystem                Size      Used Available Use% Mounted on
/dev/mapper/cryptvol-root
                        446.5G    268.3G    170.7G  61% /
```

Solution for this is to force the output in POSIX output format.
```
/run # df -h -P /
Filesystem                Size      Used Available Capacity Mounted on
/dev/mapper/cryptvol-root         446.5G    268.3G    170.7G  61% /
```
@madestreel
Copy link
Contributor Author

Forgot to mention that this is for mention that this is for Memphis v1.4.2

Copy link
Contributor

@idanasulin2706 idanasulin2706 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @madestreel approved and merged, it will be part of 1.4.3

@idanasulin2706 idanasulin2706 merged commit 97c01ae into superstreamlabs:master Jan 13, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants