Skip to content

Commit 5434984

Browse files
committed
added additional Monit config
1 parent 28542b4 commit 5434984

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,22 @@ In a future release, the look and feel can be tailored to the specific Monit eve
130130
Below is a Monit statement triggers an alert if the memory exceeds 15MB for 2 cycles. It will repeat the alert every 3 cycles. Once the condition that triggered the alert returns to normal, Monit will issue an all clear message to Slack.
131131

132132
```
133-
if memory > 15 MB for 2 cycles then exec /usr/bin/bash -c "sh /usr/local/bin/slack.sh -a -c #testing -s error -M monit >> /ebs/logs/foo.log 2<&1" repeat every 3 cycles else if succeeded then exec /usr/bin/bash -c "sh /usr/local/bin/slack.sh -a -c testing -s ok -M monit >> /ebs/logs/foo.log 2<&1"
133+
if memory > 15 MB for 2 cycles then exec /usr/bin/bash -c "sh /usr/local/bin/slack.sh -a -c #testing -s error -M monit >> /ebs/logs/foo.log 2<&1" repeat every 3 cycles else if succeeded then exec /usr/bin/bash -c "sh /usr/local/bin/slack.sh -a -c #testing -s ok -M monit >> /ebs/logs/foo.log 2<&1"
134134
```
135-
The -a flag sets the attachment flag. This is the expanded message format seen above. The -c flag sets the channel to deliver the message to. In this case the channel is "testing". The -s flag sets the status the message should inherit. The example above uses "error" and
136-
ok". Lastly, the -M flag is set to "monit". This tells Hacky Slack to use the Monit config.
135+
The <code>-a</code> flag sets the attachment flag. This is the expanded message format seen above. The <code>-c</code> flag sets the channel to deliver the message to. In this case the channel is "#testing". The <code>-s</code> flag sets the status the message should inherit. The example above uses "error" and
136+
ok". Lastly, the <code>-M</code> flag is set to "monit". This tells Hacky Slack to use the Monit config.
137137

138+
Here is an example for monitoring crond:
139+
```
140+
check process crond with pidfile "/var/run/crond.pid"
141+
start program = "/etc/init.d/crond start" with timeout 60 seconds
142+
stop program = "/etc/init.d/crond stop"
143+
if 2 restarts within 3 cycles then exec /usr/bin/bash -c "sh /usr/local/bin/slack.sh -a -c #testing -s error -M monit" repeat every 3 cycles else if succeeded then exec /usr/bin/bash -c "sh /usr/local/bin/slack.sh -a -c #testing -s ok -M monit"
144+
if 5 restarts within 5 cycles then timeout
145+
```
138146
## Using Hacky Slack in with other apps.
139147

140-
Hacky Slack can be extended to support other applications. For example, Nagios monitoring or CRON. Really, any application can send messages via Hacky Slack.
148+
Hacky Slack can be extended to support other applications. For example, Nagios monitoring or Cron. Really, any application can send messages via Hacky Slack.
141149

142150
# Icons
143151

slack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ source ${IPCONFIG}
8383

8484
function GET_HELP()
8585
{
86-
echo "Usage: [options]"
86+
echo "Usage: [options]"
8787
echo " options:"
8888
echo "-a, Attachment Sends a messages as an attachment."
8989
echo "-A, Author Small text used to display the author's name."

0 commit comments

Comments
 (0)