Command Line

Get Started on the Command Line

Getting Started

The place to begin using montior.chat is on the command line. Here is an example of sending a message to your chatroom:

/usr/local/bin/monitor.chat.sh "Hello World."

The First Parameter

The first parameter is required. There are three possibilities:

First Parameter Value Effect
"Your Message" (self-explanatory)
"HELP" Provides you with some helpful hints.
"REPORT" Provides you with a report about your API Key.

“HELP”

Have you forgotten how to do something? Run the monitor.chat.sh script with the first parameter as “HELP”.

/usr/local/bin/monitor.chat.sh "HELP"

“REPORT”

How many days remain on my license? How many hosts are currently on my license? How many recipients are enabled? Run the monitor.chat.sh script with the first parameter as “REPORT”.

/usr/local/bin/monitor.chat.sh "REPORT"

The Second Parameter

The second parameter is optional. The following table explains:

Second Parameter Value Effect
[no value] Sends your message to your chatroom.
"test" Sends your message to the test chatroom.
"reco" Sends your message to the recovery contact only.
"both" Sends your message to the recovery contact and to your chatroom.
"all" Sends your message to all your verified recipients and to your chatroom.
A comma seperated list of recipients,
chatroom optional.
Recipients that are not verified will be ignored.

“test”

When you are testing, you may not want to send messages to your chatroom, but you still want to see the messages. In that case, use the word “test” as the second parameter. Your message will be posted in the test chatroom monitor.test@e2e.chat.

/usr/local/bin/monitor.chat.sh "Hello World" "test"

“reco”

There may be some cases in which the recovery contact is expected to change in the future. You can use “reco” to send the message to the recovery contact only. In that way, if the recovery contact changes, you will not have to update the code.

/usr/local/bin/monitor.chat.sh "Hello World" "reco"

“both”

If you want to send your message to both your recovery contact and to the chatroom, use “both” as the second parameter.

/usr/local/bin/monitor.chat.sh "Hello World" "both"

“all”

When the second parameter is the word “all” the message will be sent to all of your recipients and to your chatroom.

/usr/local/bin/monitor.chat.sh "An important message for all recipients and the chatroom." "all"

A Comma Seperated List of Recipients

You can use a comma-seperated list of recipients. This list can include your chatroom. The list should have no spaces. The list can only include recipients who have verified their XMPP IDs as included in your API Key.

# Send a message to one recipient, but not to the chatroom:
/usr/local/bin/monitor.chat.sh "Hello World" "recip1@e2e.ee"

# Send a message to two recipients, but not to the chatroom:
/usr/local/bin/monitor.chat.sh "Hello World" "recip1@e2e.ee,recip2@e2e.ee"

# Send a message to two recipients and to the chatroom:
/usr/local/bin/monitor.chat.sh "Hello World" "recip1@e2e.ee,recip2@e2e.ee,monitor-my-servers@e2e.chat"

Enclosing your Message in Quotes

To send a message consisting of multiple words, the message must be enclosed in quotes to be understood as a single parameter on the command line. There are differences between using single-quotes and using double-quotes. In most cases, using single-quotes preserves the literal value of each character within the quotes. Using double-quotes preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.

For most messages, you can use either single-quotes or double-quotes. There are cases in which you need to use one and not the other.

An example in which you must use single-quotes

This message includes ‘!’ which can expand out to text from the previous command if enclosed in double-quotes.

/usr/local/bin/monitor.chat.sh 'Tablespace CUSTOMER_DATA is full!!'

An example in which you must use double-quotes

If we don’t surround the variable $MY_MESSAGE in double-quotes, the variable won’t be recognized and the command will fail.

MY_MESSAGE='HELLO WORLD!
> I AM SENDING A MESSAGE ON TWO LINES!'
/usr/local/bin/monitor.chat.sh "$MY_MESSAGE"
Symbol Shortcodes

Include Common Symbols in your messages!

Emoji Shortcodes

Add Emojis to Your Messages!

Last modified December 20, 2020