xo-cli - Get alarms
-
Hi,
I tried to get alarms from xen orchesta with xo-cli, as I have some alarms on my hosts :
Is it possible to get alarms like xoa with xo-cli, I would like to centralize alarms on our monitoring interface
Can you help me with xo-cli ?
-
Everything you see in the web UI can be fetched by the CLI.
Feel free to read the guide to find everything you need: https://xcp-ng.org/docs/management.html#xen-orchestra
-
@olivierlambert Thanks for the answer
I tried to get the xo-cli documentation but I found a 404
https://xen-orchestra.com/docs/xo-cli.htmlIs there any specific section about the CLI and how to get alarms ?
-
Hey thanks for spotting a bad link! I'll correct that ASAP.
Here is the good one: https://xen-orchestra.com/docs/architecture.html#xo-cli-cli
There's a command to show everything, so you'll find how to access alarms from there. If you can't find it, please reping us, I'll ask someone here.
-
@olivierlambert Thanks for the link
I've executed the command "xo-cli --list-objects" to show all objects xoa can find, but did not found any alarm or event occurence, I don't find what I can see in "Dashboard > Health" web page, and I don't know how xoa get those alarms (as I saw in the properties of my xen hypervisors that a control domain memory usage alarm is set by default to 95% of memory usage during 1 minute).
Could you ask to someone who can help me please ?
-
IIRC, it might be "messages" or something like that.
-
@olivierlambert Yees I got it !
# xo-cli --list-objects type=message name=ALARM [ { "body": "value: 0.950419\nconfig:\n<variable>\n\t<name value=\"mem_usage\"/>\n\t<alarm_trigger_level value=\"0.95\"/>\n\t<alarm_trigger_period value=\"60\"/>\n\t<alarm_auto_inhibit_period value=\"3600\"/>\n</variable>\n", "name": "ALARM", "time": 1611562060, "$object": "xxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx", "id": "xxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx", "type": "message", "uuid": "xxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx", "$pool": "xxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx", "$poolId": "xxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx"
And I found another method to get this, on our monitoring server we can use XE command to get alarms :
# xe message-list name=ALARM |head -n +20 uuid ( RO) : xxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx name ( RO): ALARM priority ( RO): 3 class ( RO): VM obj-uuid ( RO): xxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx timestamp ( RO): 20210210T10:28:47Z body ( RO): value: 1.027494 config: <variable> <name value="mem_usage"/> <alarm_trigger_level value="0.95"/> <alarm_trigger_period value="60"/> <alarm_auto_inhibit_period value="3600"/> </variable>
Thank you for your help Olivier
-
You are welcome Enjoy! (great thing about xo cli is that you can get alarms of all your hosts from a single endpoint)