How to monitor trunk registration via ssh

We are using a trunk (pjsip) and we had one issue with it in the past where it didn’t register properly and freepbx gave up on retrying which led to being not reachable via phone from the outside.

I’m using a server monitoring solution in our network where I can check return values from http requests and ssh commands. The idea would be to implement a trunk status checking procedure. In this monitoring solution I can analyze return values/content from http request and ssh commands.
Is there a ssh command which returns the status of trunks? Like how many of them registered or similar?
I’ve been looking into the “fwconsole” commands but none of them seem to return a current status like fo example the page:
http:///admin/config.php?display=asteriskinfo

The summary reports:
… PJSip Registrations: 1 …
which should be the value I’m looking for - anyway I can’t do a complex automated login via http - this is too complicated for the monitoring software - or is there a way to submit user+pw via URL variables?

asterisk -x "pjsip show registrations"

awesome! Thank you for the fast and brilliant response!
Since I’m quite new to asterisk and freepbx could you tell me where I could find more documentation about how to use the asterisk cli commands?
I guess -x is for execute but which asterisk commands could I use inside the dashes?

I just run

asterisk -r

and use <tab> to autocomplete everything.