yeah, some wrong directions here. let us try to back to the real problem here:

from ATS, you get a 'alarm' feature, you get this in your documentation:

http://trafficserver.apache.org/docs/trunk/admin/configuration-files/records.config#proxy.config.alarm_email
proxy.config.alarm_email
STRING
Default: (none)
Reloadable.
The email address to which Traffic Server sends alarm messages. During a custom 
Traffic Server installation, you can specify the email address; otherwise, 
Traffic Server uses the Traffic Server user account name as the default value 
for this variable.

and


Alarm Configuration

proxy.config.alarm.bin
STRING
Default: example_alarm_bin.sh
Name of the script file that can execute certain actions when an alarm is 
signaled. The default file is a sample script named example_alarm_bin.sh 
located in the bin directory. You must edit the script to suit your needs.
proxy.config.alarm.abs_path
STRING
Default: NULL
The full path to the script file that sends email to alert someone about 
Traffic Server problems.


and you will get for sure, your can use those documentation to collect alarms, 
by mail or custom(still lack of official documents)


now, let me ask, how can we deliver the 'Alarm' feature for our users?

in our origin situation, we have a working mail solution for the alarm sending, 
for the newbies, and we have a way to custom the proxy.config.alarm.bin to your 
own needs, like the way documented 
https://blog.zymlinux.net/index.php/archives/378 .  how to do with the whole 
change then?


let us back to the change we made, we may use the following steps to get email 
alarm:
1, set up a working mail system, to get mail, for example alias and postfix 
setup.
2, copy the example_alarm_bin.sh into bin directory, and make it 
runnable(mostly done with the packager system)

and here is my system, and the testing, you will know why I claim that we break 
it:

zymtest1 trafficserver # grep alarm /etc/trafficserver/records.config
CONFIG proxy.config.alarm_email STRING nobody
   # execute alarm as "<abs_path>/<bin> "<MSG_STRING_FROM_PROXY>""
CONFIG proxy.config.alarm.bin STRING example_alarm_bin.sh
CONFIG proxy.config.alarm.abs_path STRING NULL
zymtest1 trafficserver # tail /etc/mail/aliases
noc:                root
security:           root
usenet:             root
uucp:               root
webmaster:          root
www:                webmaster

# trap decode to catch security attacks
# decode:           /dev/null
root: ming....@gmail.com
zymtest1 trafficserver # which sendmail
/usr/sbin/sendmail
zymtest1 trafficserver # ps aux | grep traffic
root      1448  0.0  0.0  59624  3116 ?        Ss   22:54   0:00 
/usr/bin/traffic_cop
nobody    1454  0.1  0.4 468044 16500 ?        Sl   22:54   0:01 
/usr/bin/traffic_manager
nobody    1464 12.9  4.5 1368068 184056 ?      Sl   22:54   2:08 
/usr/bin/traffic_server -M --httpport 8080:fd=7
root      1665  0.0  0.0  17764   936 pts/0    S+   23:10   0:00 grep 
--colour=auto traffic
zymtest1 trafficserver # kill -9 1464
zymtest1 trafficserver # ps aux | grep traffic
root      1448  0.0  0.0  59624  3116 ?        Ss   22:54   0:00 
/usr/bin/traffic_cop
nobody    1454  0.1  0.4 467888 16524 ?        Sl   22:54   0:01 
/usr/bin/traffic_manager
nobody    1682 18.0  4.4 841524 180520 ?       Sl   23:11   0:00 
/usr/bin/traffic_server -M --httpport 8080:fd=7
root      1726  0.0  0.0  17764   936 pts/0    S+   23:11   0:00 grep 
--colour=auto traffic
zymtest1 trafficserver # tail /var/log/trafficserver/traffic.out
[Aug 22 23:11:04.805] Manager {0x7ff74a608740} NOTE: [Alarms::signalAlarm] 
Server Process born
[Aug 22 23:11:05.825] {0x2aaaaab18bc0} STATUS: opened 
/var/log/trafficserver/diags.log
[Aug 22 23:11:05.825] {0x2aaaaab18bc0} NOTE: updated diags config
[Aug 22 23:11:05.831] Server {0x2aaaaab18bc0} NOTE: cache clustering disabled
[Aug 22 23:11:05.833] Server {0x2aaaaab18bc0} WARNING: no ssd disks specified 
in proxy.config.cache.ssd.storage:
[Aug 22 23:11:05.939] Server {0x2aaaaab18bc0} NOTE: cache clustering disabled
[Aug 22 23:11:05.939] Server {0x2aaaaab18bc0} WARNING: unable to open cache 
disk(s): SSD Cache Disabled
[Aug 22 23:11:05.949] Server {0x2aaaaab18bc0} NOTE: logging initialized[15], 
logging_mode = 3
[Aug 22 23:11:05.972] Server {0x2aaaaab18bc0} NOTE: traffic server running
[Aug 22 23:11:05.999] Server {0x2aaab4f0e700} NOTE: cache enabled
zymtest1 trafficserver # tail /var/log/messages
Aug 22 23:11:03 zymtest1 postfix/cleanup[1676]: EE0EB140514: 
message-id=<20130822151103.c2738141...@zymtest1.corp.aliyk.com>
Aug 22 23:11:03 zymtest1 postfix/local[1679]: C2738141499: 
to=<nob...@zymtest1.corp.aliyk.com>, orig_to=<nobody>, relay=local, delay=0.21, 
delays=0.03/0.14/0/0.04, dsn=2.0.0, status=sent (forwarded as EE0EB140514)
Aug 22 23:11:03 zymtest1 postfix/qmgr[3968]: EE0EB140514: 
from=<r...@zymtest1.corp.aliyk.com>, size=601, nrcpt=1 (queue active)
Aug 22 23:11:03 zymtest1 postfix/qmgr[3968]: C2738141499: removed
Aug 22 23:11:04 zymtest1 postfix/smtp[1680]: connect to 
gmail-smtp-in.l.google.com[2a00:1450:4010:c04::1b]:25: Network is unreachable
Aug 22 23:11:05 zymtest1 traffic_server[1682]: NOTE: --- Server Starting ---
Aug 22 23:11:05 zymtest1 traffic_server[1682]: NOTE: Server Version: Apache 
Traffic Server - traffic_server - 3.2.0 - (build # 6815 on Jul  8 2013 at 
15:06:15)
Aug 22 23:11:05 zymtest1 traffic_server[1682]: {0x2aaaaab18bc0} STATUS: opened 
/var/log/trafficserver/diags.log
Aug 22 23:11:09 zymtest1 postfix/smtp[1680]: EE0EB140514: 
to=<ming....@gmail.com>, orig_to=<nobody>, 
relay=gmail-smtp-in.l.google.com[74.125.129.27]:25, delay=5.5, 
delays=0.02/0.01/1.4/4.1, dsn=2.0.0, status=sent (250 2.0.0 OK 1377184269 
yk3si10312244pac.41 - gsmtp)
Aug 22 23:11:09 zymtest1 postfix/qmgr[3968]: EE0EB140514: removed

and I will get a mail with title:
zymtest1.corp.aliyk.com [TrafficManager] Traffic Server process was reset.


but with the git master codes, I will just get something in the traffic.out:
with ould script that can send mail:
[TrafficServer] using root directory '/usr'
Usage: example_alarm_bin.sh <message> [<email_from_name> <email_from_addr> 
<email_to_addr>]
Usage: example_alarm_bin.sh <message> [<email_from_name> <email_from_addr> 
<email_to_addr>]

with the new one:
[TrafficServer] using root directory '/usr'
bin/example_alarm_bin.sh: desc=[TrafficManager] Traffic Server process was 
reset. alarm=1
[TrafficServer] using root directory '/usr'


you may ask, why you care of the email alarms?
1, because it is useful, when you have some box, not tones of box, especially 
when you are not a full time ATS admin
2, we provide it as a feature

this is really long mail, thanks for you patient

在 2013-8-22,下午10:27,Igor Galić <i.ga...@brainsware.org> 写道:

> 
> 
> ----- Original Message -----
>> Thursday, August 22, 2013, 2:16:13 AM, you wrote:
>>> btw, the only reason I see right now for having an option for passing an
>>> additional, configurable parameter to a script, is to use it for sending
>>> "instance name" in a multi-instance setup.
>>> Question does anyone in our community run multiple instances of ATS on the
>>> the same node?
>> 
>> I have to disagree here - if you run multiple instances of ATS on different
>> machines it is *very* useful to be able to use the same script everywhere
>> and have it vary based on instance data. Having to maintain per machine
>> customized scripts is a real pain.
> 
>> _o
> 
> What, exactly, is the difference between having a configuration file (that
> you create and roll out with your configuration management) for Traffic
> Server, and an configuration file (that you create and roll out with your
> configuration management) for a (monitoring) script?
> 
> scripts, just because they are scripts, don't have to munge data and action.
> They can be configurable just like everything else. But of course you'd
> have to write them as such.
> 
> Anyway. This is starting to dissolve into a bikeshed issue, so I'll excuse
> myself from this discussion.
> 
> -- i
> Igor Galić
> 
> Tel: +43 (0) 664 886 22 883
> Mail: i.ga...@brainsware.org
> URL: http://brainsware.org/
> GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE
> 

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to