Skip to content

Support OpenBSD#20

Merged
L1so merged 6 commits into
L1so:mainfrom
danipragustia:main
Oct 21, 2022
Merged

Support OpenBSD#20
L1so merged 6 commits into
L1so:mainfrom
danipragustia:main

Conversation

@danipragustia

@danipragustia danipragustia commented Oct 13, 2022

Copy link
Copy Markdown

This commit include using custom shuf() function based awk instead coreutils which doesnt ship by default on OpenBSD. Disk benchmark broke cause disklabel(8) require run as root to get partition table.

Fix list

  • Info size not in convertsize format
  • iperf3 latency always 0.0ms

Example Results

# # # # # # # # # # # # # # # # # # # # #
#             Benchy v2.2               #
#    https://github.com/L1so/benchy     #
# # # # # # # # # # # # # # # # # # # # #
#        17 Oct 2022 14:05 WIB          #
# # # # # # # # # # # # # # # # # # # # #

Server Insight                                  Hardware Information
---------------------                           ---------------------
OS         : OpenBSD                            Model       : Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz
Location   : United States                      Core        : 1 @ 639 Mhz
Kernel     : 7.0                                AES-NI      : ✔ Enabled
Uptime     : 1 hrs 59 mins                      VM-x/AMD-V  : ✔ Enabled
Virt       : none                               Swap        : 512.0 MiB 

Disk & Memory Usage                             Network Data
---------------------                           ---------------------
Disk       : 1.1 GiB                            ASN         : AS63023   
Disk Usage : 86.4 MiB (8% Used)                 ISP         : GTHost    
Mem        : 495.9 GiB                          IPv4        : ✔ Enabled
Mem Usage  : 40.0 MiB (8 % Used)                IPv6        : ✔ Enabled

Network Performance Test (Region: Mixed)
+---------------------------------------------------------------------------------+
| Prot. | Provider    | Location        | Send         | Receive      | Latency   |
+=================================================================================+
| IPv4  | Clouvider   | Dallas, US      |   81.0 Mb/s  |  109.4 Mb/s  |   20.6 ms |
|       | Uztelecom   | Tashkent, UZ    |   62.1 Mb/s  |   62.2 Mb/s  |  187.4 ms |
|       | Hybula      | Amsterdam, NL   |   87.9 Mb/s  |   84.0 Mb/s  |   97.3 ms |
|       | Clouvider   | Frankfurt, DE   |   39.7 Mb/s  |   71.6 Mb/s  |   97.3 ms |
+---------------------------------------------------------------------------------+
| IPv6  | Clouvider   | Dallas, US      |   94.9 Mb/s  |  104.6 Mb/s  |   20.6 ms |
|       | Uztelecom   | Tashkent, UZ    |   38.2 Mb/s  |   53.1 Mb/s  |  186.3 ms |
|       | Hybula      | Amsterdam, NL   |   73.8 Mb/s  |   89.5 Mb/s  |   95.1 ms |
|       | Clouvider   | Frankfurt, DE   |   25.6 Mb/s  |   68.7 Mb/s  |   97.3 ms |
+---------------------------------------------------------------------------------+

Dani Pragustia added 4 commits October 13, 2022 14:27
This commit include using custom shuf() function based awk instead coreutils
which doesnt ship by default on OpenBSD. Disk benchmark broke cause disklabel(8)
require run as root to get partition table.
In openbsd there no -4 command line argument on ping(8)
using ping to IPv4 and ping6 for IPv6
Trying fix regular size with rough-way. Use vmstat(8) instead get
from dmesg and covert it to covertable size. All tested works on
OpenBSD 7.0. Any cleaner possible soon.
casting mem_usage to int to prevent illegal character awk and
fix error non-exist /proc/version on OpenBSD
@danipragustia

Copy link
Copy Markdown
Author

Updated example results. And all looks good to me

@L1so

L1so commented Oct 19, 2022

Copy link
Copy Markdown
Owner

Referring to danipragustia@27d36af

is_openbsd() {
if [ $(uname) = "OpenBSD" ]; then
    return 0;
fi
return 1;
}

Shouldn't this be.

is_openbsd() {
if [ $(uname) = "OpenBSD" ]; then
    return 0;
else
    return 1;
fi
}

Because otherwise the return value is going to be overwritten by that non-zero value, this break the following if clause..

Just revisited this issues, your codes should be fine. Though I recommend to shorten it.

is_openbsd() {
  [ "$(uname)" = "OpenBSD" ] && return 0 || return 1
}

Does the same thing and less line.

Comment thread benchy Outdated
@danipragustia

Copy link
Copy Markdown
Author

All set!

Comment thread benchy Outdated
Comment thread benchy Outdated
@L1so

L1so commented Oct 20, 2022

Copy link
Copy Markdown
Owner

Thanks for taking the time to create a PR, I really appreciate it. I'll be sure to merge it 😃

Never used *BSD before, so I don't know the environment there— your PR really helps the development of this script.

Again, thanks (Makasih ya gan he he 👍 )

@L1so mention ping will pick IPv4 when avaiable by default without specified with -4
and mem_info didn't require use any arithmetic expansion.
@danipragustia

Copy link
Copy Markdown
Author

Thanks for taking the time to create a PR, I really appreciate it. I'll be sure to merge it smiley

Never used *BSD before, so I don't know the environment there— your PR really helps the development of this script.

Again, thanks (Makasih ya gan he he +1 )

Thanks!
This is just a trivial fix, nothing special.

@L1so L1so merged commit 92ba712 into L1so:main Oct 21, 2022
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.

2 participants