heya Walter!
This works pretty well; with the exception that pvesh may only be run as root... (and for GOOD reason... it's got some pretty hefty privileges in that context.
I wonder if a better strategy would be to have a cronjob which
(create directory structure of the api in /tmp)
(iterate thru the main branches of the API that are selected to be fed to observium and collect output every N minutes... slice that into stub json files with jq
emits the output of each branch off the API
(there's more detail here than one might wanna shake a stick at:)
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/cluster/ceph/metadat...
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/cluster/ceph/status%...
mkdir /tmp/proxservium/cluster mkdir /tmp/proxservium/cluster/ceph mkdir /tmp/proxservium/cluster/config mkdir /tmp/proxservium/cluster/firewall ... mkdir /tmp/proxservium/nodes ... mkdir /tmp/proxservium/pools mkdir /tmp/proxservium/storage
echo "cluster nodes" pvesh get /cluster/config/nodes --output-format=json-pretty > /tmp/proxservium/cluster/config/nodes
echo "cluster totem" pvesh get /cluster/config/totem --output-format=json-pretty > /tmp/proxservium/cluster/config/totem
echo "Ceph metadata" /usr/bin/pvesh get /cluster/ceph/metadata/ --output-format=json-pretty >/tmp/cephmeta for face in osd node mon mgr mds; do echo -n " ${face}..." /usr/bin/jq .$face /tmp/cephmeta > "/tmp/cephmeta_${face}"; echo done
...
```version pvesh get /version -output-format=json-pretty { "release" : "8.1", "repoid" : "ec5affc9e41f1d79", "version" : "8.1.4" } ```
That way:
- there are fewer calls to the pxm api - the privilege that observium's agent needs (here) is simply reading some files in /tmp (or someplace similar) and doesn't have the ability to potentially do nastythings(tm)
(look at the things pvesh is permitted to do. it's really .... not optimal to use godmode privilege for stuff like this... )
I'd be open to trying to stub something out script-wise to do the cluster interaction if someone else is keen to feed the data into observium
Wolf Noble Hoof & Paw loiosh@wolfspaw.com
-=[ This message has been composed and transmitted with 100% recycled electrons ]=-
On Jan 12, 2024, at 02:46, Walter Onda via observium observium@lists.observium.org wrote:
Hello Abraham
Try this one in the proxmox-qmu script
#!/bin/bash
# Proxmox VE virtual machine listing # (c) 2015-2019, Tom Laermans for Observium
PVESH=`which pvesh` if [ $? -eq 0 ] then echo "<<<proxmox-qemu>>>"
VERSION=$(pveversion | awk -F/ '{print $2}' | sed 's/..*//') if [[ ${VERSION} -ge 5 ]] then qemu=$(mktemp) lxc=$(mktemp) pvesh get /nodes/$(hostname)/qemu --output-format=json-pretty > $qemu pvesh get /nodes/$(hostname)/lxc --output-format=json-pretty > $lxc jq -s add $qemu $lxc rm -f $qemu $lxc else pvesh get /nodes/$(hostname)/qemu 2>/dev/null fi fi
Regards Walter
Walter Onda Senior System Engineer Stadtantennen AG
Von: Yesaya A. Medellu via observium <observium@lists.observium.org mailto:observium@lists.observium.org> Gesendet: Freitag, 12. Januar 2024 09:12 An: 'Observium' <observium@observium.org mailto:observium@observium.org> Cc: Yesaya A. Medellu <yesaya.abraham@makingroup.com mailto:yesaya.abraham@makingroup.com> Betreff: [Observium] LXC Proxmox Container
Hi All
Can Observium Monitoring LXC Container
at least count it as VM inside PVE VMs <image001.png>
thanks in advance Abraham
observium mailing list -- observium@lists.observium.org mailto:observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org mailto:observium-leave@lists.observium.org