Operating System - HP-UX
1821546 Members
1996 Online
109633 Solutions
New Discussion юеВ

Re: Want SHORT email format for Event Monitor Software Messages.

 
SOLVED
Go to solution
Steve Post
Trusted Contributor

Want SHORT email format for Event Monitor Software Messages.

The EMS software works great. The email I get on an event used to look great.

Unfortunately the email is now sent to my cell phone. The cell phone busts it up into 7 separate pages, and sends them in scrabbled order.

I got 28 pages last night. All I could tell was I needed to log in. It was faster to log in, than to unscramble the pages.

So here's my question: Is there a way to send a SMALLER format message? Then I would get one page per error.

I see /etc/opt/resmon/lbin/monconfig has an email option, but I don't see a email FORMAT option.

I am using hpux11.0

steve
5 REPLIES 5
Bill Hassell
Honored Contributor

Re: Want SHORT email format for Event Monitor Software Messages.

There is no formatting option in monconfig. Since it would be difficult to decide just what should be reported (ie, date/time, severity, event, etc), the only way to accomplish this is to send the email to a dummy address, then in /etc/mail/aliases specify a script to process the message and send the needed data to your cell phone. Another alternative would be to dire4ct all messages to syslog, than use cron to monitor the messages and reformat them for an email message.


Bill Hassell, sysadmin
Bhuvaneswari Selvaraj
Valued Contributor

Re: Want SHORT email format for Event Monitor Software Messages.

No, the EMS software does not provide an option to format the email messages.As all the fields are importatnt, it does not provide this feature.

However, you can change the notification type to TCP target and can make the tcp client to send you a mail whenever it receives a notification. For instance, the tcp_target file that comes along with the EMS Devkit is a simple C file that receives the notification, decode it to soem extent and prints the same to the screen. The same can be changed to send a mail of needed format to you.

The other option is the writing to the syslog or textlog and monitoring it by our own shell scripts and making it a part of cron.
Steve Post
Trusted Contributor

Re: Want SHORT email format for Event Monitor Software Messages.

I thought there would be some file that would let me change the format. A file like /var/stm/config/tools/monitor/default_disk_em.clcfg. But I don't know how to use the file.

I'll have to read up on sendmail before I can use alias.
I would not know what port to send the message to for a tcp message.
I don't know the format of the message as it hits the syslog.
But at least I can start there.

steve
Bill Hassell
Honored Contributor
Solution

Re: Want SHORT email format for Event Monitor Software Messages.

The files in /var/stm/config/tools/monitor are used to control thresholds and limits but not the formatting of the messages. You have a couple of choices:

1. send EMS messages to syslog.log and create a syslog script that watches for new messages, extracts the useful info and sends the shortened message to your cellphone via mailx.

2. create a mail processing script using /etc/mail/aliases and send the shortened messages to your cellphone. The procmail package can perform this task but is probably overkill for this task.

For choice #2, you don't need to read the several hundred pages on sendmail, the man page for aliases describes the basics. Here is the technique:

/etc/mail/aliases can be used to redirect email to other addresses. For example:

root : billh@mycpu.domain.com
postmaster : root
webmaster : root

So now all messages to root will be sent to billh@... and messages sent to postmaster or webmaster will also go to root which in turn is redirected to billh@...

Now for email processing, you can simply alias the address (which doesn't have to be a login on the system) to a pipe and script as in:

emsnotify : | "/usr/local/bin/emsformat"

In this case, the entire email message will be sent (via stdin) to the script emsformat. The script must be runnable by the daemon user, and that daemon can create/access any file(s) needed by the script. The script will see all of the mail headers first followed by a single blank line. The format for the EMS message is the same for each notification. To setup the email filter:

1. Create a script called /usr/local/bin/emsfilter. To make things easier, just put something simple in it such as:

#!/usr/bin/sh
PATH=/usr/bin
cat > /tmp/ems.test.log
QWIKMSG=$(head -3 /tmp/ems.test.log)
logger "$0 $QWIKMSG"

2. Store this script with owner daemon:bin and 755 permission. Test that it works OK by using su - daemon and run the script with something like:

cat /etc/issue | /usr/local/bin/emsfilter.

You should see /etc/issue copied into the file /tmp/ems.test.log and in syslog.log, you'll see a message. Once this is working, replace the test code with the formatting code, then configure EMS to send all messages to the email address: emsnotify

In case things don't work, start with the file /var/adm/syslog/mail.log. You'll typically see a couple of errors: error 127 usually means that the daemon user could not run the script (permissions for the file and also for the parent directories), or error 2 which usually means the script itself is having a problem running as the daemon user (errno 2 means no such file). By running the script as the daemon user via su - daemon, you should see any errors reported.


Bill Hassell, sysadmin
Steve Post
Trusted Contributor

Re: Want SHORT email format for Event Monitor Software Messages.

THANK you. I should have gave you 10 points. But I clicked too fast.
Steve