lol

The service snmpd failed to start

- Posted in VMware by

Error "The service snmpd failed to start" will be displayed if the service has not been configured.

Configure snmpd via ESXi shell as follows:

Reset settings, if any current exists: esxcli system snmp set -r

Community: esxcli system snmp set -c aners

Port (udp): esxcli system snmp set -p 161

Location: esxcli system snmp set -L "Room 641A"

Contact (email): esxcli system snmp set -C mail@yourmail.tld

Enable service? esxcli system snmp set -e yes

Then go to https://esxihost/ui/#/host/manage/services and start the service. Consider changing the start policy as well.

lol

storcli basic arguments

- Posted in Uncategorized by

The following arguments are ones I typically use to check drives on a controller with just storcli available for management.

storcli version 007.1017.0000.0000 May 10, 2019
Binary md5: c9d527d39b83583be84244364f8daa8a

Show all drives on all controllers and enclosures:
./storcli /call/eall/sall show

Find failed, copyback'ing, and unconfigured bad across all controllers and enclosures:
./storcli /call/eall/sall show|grep -i "failure|cpybck|failed|ubad"

Locate disk, start:
./storcli /c0/e0/s4 start locate

Locate disk, stop
./storcli /c0/e0/s4 stop locate

Show rebuild status across all controllers and enclosures for each drive:
./storcli /call/eall/sall show rebuild

Show copyback ("Cpybck") status for drive
./storcli /c0/e0/s9 show copyback

More details in this PDF

lol

The Airthings integration for HomeAssistant doesn't provide the status of the LED-ring in my Airthings Wave Plus. It does fetch the data I need though, and is required for this template.

Luckily Airthings have shared their thresholds, making it trivial to read data from Entities and making a new Entity for the LED-ring.

The template is pretty self-explanatory. Edit name of entities to match your installation.

A custom card could be created for changing the color of the ring-icon, but I haven't bothered.

Download the template-code here

lol

Module 'CPUID' power on failed.

- Posted in VMware by

Even though the number of configured vCPUs in the VM wasn't changed nor excessive, a VM wouldn't cross-migrate (got an EVC error) hot.

After powering off the VM and migrating to another cluster, which was on the same EVC level, powering on the VM resulted in the error "Module 'CPUID' power on failed."

Inspecting the CPU Identification Mask settings (Edit Settings -> CPU > CPUID Mask -> Advanced) and resetting to default did not resolve the issue.

I assumed the VMX had some clues, and found multiple lines of cpuid-related flags:

[aners@derp:/vmfs/volumes/vsan:5..2]grep -i cpu *.vmx:

...
sched.cpu.units = "mhz"
cpuid.80000001.edx = "---- ---- ---0 ---- ---- ---- ---- ----"
cpuid.80000001.eax.amd = "---- ---- ---- ---- ---- ---- ---- ----"
cpuid.80000001.ebx.amd = "---- ---- ---- ---- ---- ---- ---- ----"
cpuid.80000001.ecx.amd = "---- ---- ---- ---- ---- ---- ---- ----"
cpuid.80000001.edx.amd = "---- ---- ---0 ---- ---- ---- ---- ----"
sched.cpu.latencySensitivity = "normal"
...

Removing all 'cpuid...'-lines from the VMX resolved the issue, the VM was now able to boot.

lol

vSphere Remove snapshot task 0%, stuck?

- Posted in VMware by

When removing large snapshots, the task status is progressing towards 100%, or so it should be; sometimes it goes to 0% in the web UI and the user is left clueless.

Updating the web UI doesn't bring the current progress back. Luckyli the shell on the host can be used to retrieve the progress:

Chaining a few commands, will get the progress of the "Snapshot.remove"-task:

1) Get a list of all VMs and filter by the name of your VM: vim-cmd vmsvc/getallvms|grep -i garg|awk '{print $1}'

[root@virt58:/vmfs/volumes/vsan:5...2/4...9] vim-cmd vmsvc/getallvms|grep -i garg|awk '{print $1}'
72

The Vmid is returned, in this example 72

2) Verify the Vmid is in fact the VM you're interested in, fetch it's name: vim-cmd vmsvc/get.summary 72|grep name

[root@virt58:/vmfs/volumes/vsan:5...2/4...9] vim-cmd vmsvc/get.summary 72|grep name
name = "Gargoil",

3) Having verified the Vmid, get the running tasks: vim-cmd vmsvc/get.tasklist 72

(ManagedObjectReference) [
   'vim.Task:haTask-72-vim.vm.Snapshot.remove-138283664'
]

4) Copy the vim.Task identifier and get task_info, filter "state" and "progress": vim-cmd vimsvc/task_info haTask-72-vim.vm.Snapshot.remove-138283664|grep "state|progress"

   state = "running",
   progress = 86,

What the web UI failed to display, is that the "Snapshot.remove"-task is running and 86% complete, I guess this is why CLI is usually my favourite goto.

For more verbose output, remove the pipe to grep

lol

When "Placement and Availability status" is "Unknown" for storage objects in vSAN, it can be as simple as an ISO mounted from another cluster. If so, simply unmount the ISO and return to the overview.

enter image description here

lol

Consider the following scenario:

Wireguard (daemon) is running on a *:123/udp

Not always a great way out from a hotel network, since NTP is usually rate-limited - sometimes a great way out. Things change.

Instead of deciding on 1 service-port for Wireguard, having Wireguard transparently serve on more ports, seems like a good solution and does not require running multiple interfaces or services.

In the following example, iptables will translate requests coming in at port 8443/udp and redirect them to where Wireguard is actually listening; 123/udp

iptables -t nat -I PREROUTING -i ens160 -d 10.87.132.254/32 -p udp -m multiport --dports 8443  -j REDIRECT --to-ports 123

Now connecting to :8443/udp (and still 123/udp, obviously) will access Wireguard, just that it's translated internally.

As always, change the arguments to fit your environment.

lol

Creating a fifo-based ffmpeg service

- Posted in Linux by

I needed an encoder-service waiting to handle ffmpeg-workloads, and decided to use systemctl and a fifo pipe, so jobs could be queued without the need of RabbitMQ/other.

I'm aware of DLQ and fancy scaling, however this does the trick and hasn't failed for years.

1) Create script for initiating the fifo pipe, save it at /opt/createWorkerPipe.sh:

#!/bin/bash
# pipe location
pipe=/tmp/ffmpeg-pipe

trap "rm -f $pipe" EXIT

# Initiate pipe
[[ -p $pipe ]] || mkfifo $pipe

while true; do
    exec 3<> $pipe
    read line < $pipe
    bash <<< "/opt/ffmpeg-worker.sh $line"
done

2) Create your ffmpeg-worker, with your ffmpeg args, at /opt/ffmpeg-worker.sh:

#!/bin/bash 
# Do ffmpeg stuff
/usr/bin/ffmpeg -y input.avi [yourargs] output.mp4

3) Create service file at /etc/systemd/system/ffmpeg-encoder.service:

[Unit]
Description=ffmpeg encoder service
DefaultDependencies=no
After=network.target

[Service]
Type=simple
User=www-data
Group=www-data
ExecStart=/opt/createWorkerPipe.sh:
TimeoutStartSec=0
RemainAfterExit=yes

[Install]
WantedBy=default.target

3) Reload systemctl daemon: systemctl daemon-reload

4) Enable service: systemctl enable ffmpeg-encoder.service

Verify the service state with: systemctl status ffmpeg-encoder.service

Verifying service status programatially can be done by running:

systemctl is-active --quiet ffmpeg-encoder.service

where exitcode 0 is the active state of the service.

I also wrote a simple ffmpeg-log-parser for polling state via PHP, but that's for another post.

lol

Wasabi API, polling active storage

- Posted in Uncategorized by

Programatically fetching your quota/active utilization, etc. from Wasabi (wasabi.com) is pretty straightforward with their API.

1) Create a user at https://console.wasabisys.com/users with API-access

2) Create access keys for new subuser and assign permissions via policies. My user has the following policies assigned: WasabiReadOnlyAccess, WasabiViewAuditLogs, WasabiViewBillingAccess and WasabiViewEventNotifications

Query their API like so:

curl -H "Authorization: ACCESS-KEY:SECRET-KEY" https://billing.wasabisys.com/utilization

Note that no type of Authorization is set, no "Basic", "Digest", etc.

Getting this via jQuery is trivial, I've written a simple script for it you can try out.

Replace ACCESS-KEY and SECRETKEY on line 7 with your credentials.

lol

For scaling a video with ffmpeg with a target of 1280px width or height, I use the following filters:

enter image description here

If the source width or height is less than 1280px, the original dimensions will be kept.

If the source width or height is larger than 1280px, the output is scaled to 1280px

Since scaling requires division by 2, the dimensions are calculated and ensured to add up

Change (both) '1280' to fit your output needs.

Escaping ruins the formatting, click here to get the source in plain text