Open vom513 opened 2 years ago
In my case, I got it working by modifying the proces_ssh_output function to the following:
def process_ssh_output(ssh_output: str): command_outputs = ssh_output.split("::")
distro, ansi_color = filter_os_release(command_outputs[0])
kernel = command_outputs[2].strip()
hostname = command_outputs[3].strip()
cpu = filter_cpu(command_outputs[4])
mem_total, mem_avail, mem_used = filter_memory(command_outputs[5])
system_platform = command_outputs[6].strip().replace("\n", " ")
uptime = process_uptime(command_outputs[7])
shell = filter_shell(command_outputs[8])
It seems there is an extra value present in the 'command_outputs' variable. 'command_outputs[3]' was passing the hostname info to the filter_cpu function resulting in the ValueError.
EDIT: Corrected array value numbers.
Looking into it further it looks like some native OS support information is included in command_outputs[1] which may be unexpected behavior but I'm unsure.
I just pushed a commit with a new --debug
flag that will print the raw data from the target, could you pull that version and post the output of your server?
I will post a debug from FreeBSD in a bit. However looking at your code - looks like you are grabbing the model from /proc/cpuinfo. You'll probably need an if condition to maybe check uname for BSD and if so, do this:
[vom@freenas ~]$ sysctl hw.model
hw.model: Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
FreeBSD debug:
vom@ice:~/bin$ ./hlfetch -d -t vom@freenas
NAME=FreeBSD
VERSION="13.1-RELEASE"
VERSION_ID="13.1"
ID=freebsd
ANSI_COLOR="0;31"
PRETTY_NAME="FreeBSD 13.1-RELEASE"
CPE_NAME="cpe:/o:freebsd:freebsd:13.1"
HOME_URL="https://FreeBSD.org/"
BUG_REPORT_URL="https://bugs.FreeBSD.org/"
::FreeBSD 13.1-RELEASE
::::::::::::/usr/local/bin/bash
Strange, it seems most of the files I'm reading either don't exist or aren't in the same place on FreeBSD.
I'm downloading a FreeBSD ISO to test out how it works in a VM.
Tried this against my FreeNAS/TrueNAS box. I'm happy to troubleshoot to figure out what FreeBSD is doing...