Action script send email (529 Views)
Reply
Occasional Advisor
stemon
Posts: 10
Registered: ‎03-26-2012
Message 1 of 6 (540 Views)

Action script send email

Hi,

 

could you provide me an example of script that sends automatically an email when a incident occured?

What is the format of the parameter that I have to pass to the script in order to see in the email this information: nodename, intefacename, type of incident.

 

Thanks!

 

Stefano

Occasional Advisor
stemon
Posts: 10
Registered: ‎03-26-2012
Message 2 of 6 (539 Views)

Re: Action script send email

sorry, an additional question...I want to define a custom correlation rule, where I can find the list of attribute that I can use in the filter editor? (i.e. ${devVendorInterface}) ?

 

Thanks

Occasional Advisor
rodarcqu
Posts: 5
Registered: ‎07-27-2011
Message 3 of 6 (529 Views)

Action script send email

Hi Stefano,

 

You can use BLAT if you are using windows here you have an example:

 

http://support.openview.hp.com/selfsolve/document/KM1333614?searchIdentifier=-141e7df1%3a137e41e1c3c...

 

Hope this helps!

Occasional Advisor
stemon
Posts: 10
Registered: ‎03-26-2012
Message 4 of 6 (523 Views)

Re: Action script send email

Hi,

 

I use a Linux server. Can I insert in "command" text editor, in the Action tab, this script: "echo "Test message" | mail -s "Test topic" youremail@yourdomain.com" in order to send an email?

 

 

Thanks

Stefano

Occasional Advisor
stemon
Posts: 10
Registered: ‎03-26-2012
Message 5 of 6 (509 Views)

Re: Action script send email

I tried to insert a simple script echo ciao >> file.txt in the command text editor but it doesn't work.

How can I run a script? What kind of information I have to insert in command text editor?

 

Occasional Advisor
rodarcqu
Posts: 5
Registered: ‎07-27-2011
Message 6 of 6 (470 Views)

Action script send email

Hi Stephano,

 

In order to configure an incident to receivie an email notification: 

  • Be sure that Network Node Manager box is configured for sending emails.
  • Any application for sending and receiving email can be used as long as it has a CLI utility

Note: Most UNIX servers have mailx application installed by default, which is used to send quick email messages (i.e., without opening up a full-featured mail user agent).

1. Go to Configuration -> Incident configuration -> Management Events Configuration tab.

2. As an example, open Node Down from the list, then the Actions Configuration tab.

3. In Command Type use: ScriptOrExecutable

4. Add a new command*, using the "Registered" lifecycle state. Here are some examples of commands that could be used:

/usr/bin/mailx -s "$snn - Node Down" user@localhost </dev/null

or

echo "Subject:Node $sourceObjectName Down" | /usr/sbin/sendmail <email ID>

5. Save and Close 

*Note. In the command you may specify several Custom Incident Attributes (CIAs), the list of available CIAs is found in the "Help for Administrators" guide available to download at http://support.openview.hp.com/selfsolve/manuals
In the command example the following CIA is used: $snn. This indicates the name attribute of the incident's source node.

==================================================
==================================================
A couple of mail examples below:

# Example 1 - Simple:
echo "This is the body."| mailx -s "mailx Test1"
jsmith@abc.com

For examples 2 and 3, you can create an script and then call the it from the NNMi command field.

# Example 2 - Using Variables:
SUBJECT="mailx Test2"
EMAIL_ADDRESS="
jsmith@abc.com"
BODY="This is the body of the message."

echo "$BODY" | mailx -s "$SUBJECT" "$EMAIL_ADDRESS"

# Example 3 - Attached File:
SUBJECT="mailx Test3"
EMAIL_ADDRESS="
jsmith@abc.com"
BODY="This is the body of the message."
ATTACHED_FILE="/etc/hosts"

cat "$ATTACHED_FILE" | mailx -s "$SUBJECT" "$EMAIL_ADDRESS

 

http://support.openview.hp.com/selfsolve/document/KM1154783?searchIdentifier=-47af8070%3a138264e3583...

 

Hope this helps,

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.