Determine link-status via Proxmox UI on vmbrs with Linux VLANs

jsterr

Renowned Member
Jul 24, 2020
780
213
68
32
Is there a way to see the actual link status of the interfaces that are up via UI. We have the following situation, we cant tell if vmbr152 is up or not (it is not) because both (the vmbr152) and the raw-device (enp25s0f1.152) is up (Active=yes), but they are not (they are actually offline)

Is there a way to fix the view or am I missing something?
 

Attachments

  • linux-vlan-active-or-not-active.png
    linux-vlan-active-or-not-active.png
    22.4 KB · Views: 44
Last edited:
No, AFAIU that view parses the /etc/network/interfaces file. It does not check the current state as you can do with ip a for example.
 
Last edited:
  • Like
Reactions: jsterr
Is there a way to put something into the Datacenter-Notes? So I could get the infos via "ip a" and put it into the notes-view for a customer? AKA -> is there a file for it? I might open a feature request for a "Up" column, that checks the interface status.
 
Last edited:
Is there a way to put something into the Datacenter-Notes? So I could get the infos via "ip a" and put it into the notes-view for a customer? AKA -> is there a file for it?
/etc/pve/datacenter.cfg, Stored as the first lines as a comment. Create some notes and then check how it looks. All the other DC configs are stored there too.

So using the API is probably a better way. What worked in a quick test, to keep newlines intact, is to first write it into a file, and then use it for the API call:
For example:
Code:
cat ~/foo
This

is

a

test
```
codeblock
```
And then run
pvesh set cluster/options --description "$(cat ~/foo)"

I might open a feature request for a "Up" column, that checks the interface status.
Please :)
 
  • Like
Reactions: Fathi and jsterr
/etc/pve/datacenter.cfg, Stored as the first lines as a comment. Create some notes and then check how it looks. All the other DC configs are stored there too.

So using the API is probably a better way. What worked in a quick test, to keep newlines intact, is to first write it into a file, and then use it for the API call:
For example:
Code:
cat ~/foo
This

is

a

test
```
codeblock
```
And then run
pvesh set cluster/options --description "$(cat ~/foo)"


Please :)
Thanks Aaron! Did work out well, will script it so it shows all 3 nodes and maybe markdown tables.
How would I set it in nodes-view (notes)? via pvesh?

1692713180577.png
 
Hehe, nice. How often do you run the script to update the notes?

For the node specific description/notes: https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/config (the forum is messing up the link formatting a bit)

Thanks! I did it:

Code:
# Script zum Erstellen der Datacenter Notizen und Eintragen dieser

cat << 'EOF' > notes-interfacesstatus.sh
#!/bin/bash
hostname=`hostname`
ip -brief address > /tmp/interfacestatus &&
awk '{ $1=$1; gsub(" ", "|"); printf "|%s|\n", $0 }' /tmp/interfacestatus > /tmp/temp && mv /tmp/temp /tmp/interfacestatus &&
sed -i '1s/^/|Interface|Status |IP-Adresse| \n/' /tmp/interfacestatus &&
sed -i '2s/^/|--|--|--| \n/' /tmp/interfacestatus &&
echo "|||" >> /tmp/interfacestatus &&
pvesh set /nodes/$hostname/config --description "$(cat /tmp/interfacestatus)" &&
rm /tmp/interfacestatus
EOF

# Script ausführbar machen und testen
chmod +x notes-interfacesstatus.sh

# Cronjob einfügen und Notizen genießen (der Status der Interfaces wird 5 minütlich upgedated)
crontab -e ausführen und folgende Zeile einfügen und mit STRG+X speichern (nano)
*/5 * * * * /root/notes-interfacesstatus.sh >/dev/null 2>&1

Updates the notes every 5 minutes and looks like this:

1692879835000.png
 
Hey there, we've just set up ~30 new Proxmox nodes.
As you can imagine, some links were... wonky.

Not having any kind of basic interface information like connection status (up|down), link speed, etc. in the GUI is a real PITA.
We really didn't notice some links being down due to bonding...

As was mentioned by @jsterr in that bugzilla, having at least the "green lamp" next to the interface would be a huge improvement.
Until such improvements arrive, i modified what @jsterr posted above to show speed instead of ip-addresses:

! Code slightly updated, was missing /usr/sbin/ which caused it to fail when run as cronjob !
Bash:
#!/bin/bash
# https://forum.proxmox.com/threads/determine-link-status-via-proxmox-ui-on-vmbrs-with-linux-vlans.132545/

#exclude some interfaces, e.g. all vlans, to keep the list clean
INTERFACES=`ip -br a | awk '{print $1}' | grep -v ^lo$ | grep -v enx | grep -vi ^v | sort`

for INTERFACE in $INTERFACES
do

        INTSTATUS=`/usr/sbin/ip -brief address | grep ^$INTERFACE | awk '{print $2}'`
        INTSPEED=`/usr/sbin/ethtool $INTERFACE | grep Speed | awk '{print $2}'`

        echo $INTERFACE $INTSTATUS $INTSPEED >> /tmp/interfacestatus

done

#formatting to show the notes as a table in the GUI
awk '{ $1=$1; gsub(" ", "|"); printf "|%s|\n", $0 }' /tmp/interfacestatus > /tmp/interfacetemp && mv /tmp/interfacetemp /tmp/interfacestatus
sed -i '1s/^/|Interface|Status |Link-Speed| \n/' /tmp/interfacestatus
sed -i '2s/^/|--|--|--| \n/' /tmp/interfacestatus
echo "|||" >> /tmp/interfacestatus
pvesh set /nodes/`hostname`/config --description "$(cat /tmp/interfacestatus)"

#cat so we can also easily just run it directly and see the output
cat /tmp/interfacestatus
rm /tmp/interfacestatus

Result:
(yes we use .link files to name our interfaces, as mentioned here https://forum.proxmox.com/threads/netzwerkadapter-namen-wechseln-nach-reboot.123924/post-539697)
1716929241886.png
 
Last edited:
Hey there, we've just set up ~30 new Proxmox nodes.
As you can imagine, some links were... wonky.

Not having any kind of basic interface information like connection status (up|down), link speed, etc. in the GUI is a real PITA.
We really didn't notice some links being down due to bonding...

As was mentioned by @jsterr in that bugzilla, having at least the "green lamp" next to the interface would be a huge improvement.
Until such improvements arrive, i modified what @jsterr posted above to show speed instead of ip-addresses:

Bash:
# https://forum.proxmox.com/threads/determine-link-status-via-proxmox-ui-on-vmbrs-with-linux-vlans.132545/

#exclude some interfaces, e.g. all vlans, to keep the list clean
INTERFACES=`ip -br a | awk '{print $1}' | grep -v ^lo$ | grep -v enx | grep -vi ^v | sort`

for INTERFACE in $INTERFACES
do

        INTSTATUS=`ip -brief address | grep ^$INTERFACE | awk '{print $2}'`
        INTSPEED=`ethtool $INTERFACE | grep Speed | awk '{print $2}'`

        echo $INTERFACE $INTSTATUS $INTSPEED >> /tmp/interfacestatus

done

#formatting to show the notes as a table in the GUI
awk '{ $1=$1; gsub(" ", "|"); printf "|%s|\n", $0 }' /tmp/interfacestatus > /tmp/interfacetemp && mv /tmp/interfacetemp /tmp/interfacestatus
sed -i '1s/^/|Interface|Status |Link-Speed| \n/' /tmp/interfacestatus
sed -i '2s/^/|--|--|--| \n/' /tmp/interfacestatus
echo "|||" >> /tmp/interfacestatus
pvesh set /nodes/`hostname`/config --description "$(cat /tmp/interfacestatus)"

#cat so we can also easily just run it directly and see the output
cat /tmp/interfacestatus
rm /tmp/interfacestatus

Result:
(yes we use .link files to name our interfaces, as mentioned here https://forum.proxmox.com/threads/netzwerkadapter-namen-wechseln-nach-reboot.123924/post-539697)
View attachment 68924
I took the chance and put your post into the bugreport so it gets also seen there. Nice that you could reuse my snippet :)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!