0uegyg
Last Updated: February 25, 2016
·
1.318K
· just3ws

Read Monit status from the command line using html2text

I have a Monit instance managing several daemons and processes on a VPS. I don't want to expose the Monit endpoint over the internet but I do want to be able to quickly view my system's status. Monit serves their status page as HTML which isn't the easiest thing to read from the console. So I installed html2text and now I can curl the HTML response into html2text and see a pretty formatted text output that is close enough to the HTML layout to be useful.

curl -sSB http://localhost:2812 | html2text -ascii

curl -s silences the progress bar output.

curl -S allows for showing errors.

curl -B converts the output to ASCII.

html2text seemed to have issues with rendering Unicode/UTF-8 output and since that support wasn't necessary for me I chose to simply go with the ASCII character set and avoid any warnings from html2text.

html2text -ascii let's it know to expect ASCII format.

Now instead of a mangled mess of HTML I see a nicely formatted table.

html2text example output

3 Responses
Add your response

17232

Install html2text on Ubuntu using sudo apt-get -y install html2text.

over 1 year ago ·
17431

Did you try "monit summary"? That gives you a nice overview as well...

over 1 year ago ·
26559

In case anyone stumbles on this post: you don't need to use html2text anymore. Just make a request to "/_status" instead of "/":

curl -sSB http://127.0.0.1:2812/_status

You can also get it in XML format by adding "?format=xml". To get a very brief summary, append "?level=summary".

That page has several other parameters to customize the output, but they don't seem to be documented. Here's a link to the source.

over 1 year ago ·
Filed Under