Hello
i want to execute an alerte action.
On my Windows 2008 Server, i select "Alert Application", with the Absolute Path : OK !
On my RedHat 5.3 Server, i select "Alert Application", with the Absolute Path : ko, i see nothing, the omreport indicate nothing... i can write a absolute path like /home/scripts/test.sh ...
Why ?
Thank's !
Thierry
When you set Alert Actions for an event, you can specify the action to "execute an application". Limitations are on the applications that Server Administrator can execute. Follow these guidelines to ensure proper execution:
Do not specify X Window System-based applications because Server Administrator cannot execute such applications properly.
Do not specify applications that require input from the user because Server Administrator cannot execute such applications properly.
Redirect the stdout and stderr commands to a file when specifying the application so that you can see any output or error messages.
If you want to execute multiple applications (or commands) for an alert, create a script to do that and put the full path to the script in the application to execute box.
Example 1: ps -ef >/tmp/psout.txt 2>&1
The command in Example 1 executes the application ps command, redirects the stdout command to the file /tmp/psout.txt, and redirects the stderr command to the same file as the stdout command.
Example 2: mail -s "Server Alert" admin /tmp/mailout.txt 2>&1
The command in Example 2 executes the mail application to send the message contained in the file /tmp/alertmsg.txt to the Linux user, the Admin, with the subject "Server Alert." The file /tmp/alertmsg.txt must be created by the user before the event occurs. In addition, the stdout and stderr commands are redirected to the file /tmp/mailout.txt if an error occurs.
What is your "test.sh" script doing ? I assume it requires no user interaction.
Hello
thank's for your answer.
My script /home/scripts/test.sh :
#! /bin/bash
Subject="Alerte OM"
omreport system alertlog >/tmp/alertmsg.txt 2>&1
cat /tmp/alertmsg.txt | mail -s "$Subject" trenoir@ugap.fr >/tmp/mailout.txt 2>&1
when i run /home/scripts/test.sh : it's good! i receive the mail.
Before configure, i verify Alert with "omreport system alertaction -fmt tbl" :
Event | Console Alert| Broadcast Message| Execute Application| Absolute path to the application|
Power Supply Critical| Not selected | Not selected | Not selected | Not selected
=> ok, all is "clean"
i configure with omconfig system alertaction event=powersupply execappath="/home/scripts/test.sh"
I HAVE NO RESPONSE ! :
- no "successfully" like when i do "alert=true" and
- no "Error!" like when i do "alert=maybe" ...
Result of "omreport system alertaction -fmt tbl" :
Event | Console Alert| Broadcast Message| Execute Application| Absolute path to the application|
Power Supply Critical| Not selected | Not selected | Selected | |
Why nothing in "Absolute path to the application" ? syntax problem with execappath ? i am connect "root" : authorisation problem ?
Hey, Thierry, this did the trick for me as well... but... has anyone figured out what caused this? I have two other servers that worked fine without the leading space, but on my third server which holds virtually the same config, I need the leading space just like you.
Since you had experience with this issue would you please help me out?
When I execute my shell script from CLI I receive the Alert !
[root@xen2 /]# /home/scripts/email.sh Mar 18 11:14:20 xen2 sendEmail[15896]: Email was sent successfully!
But, when I set the same path " /home/scripts/email.sh" at the front of Absolute path to the application I don't receive any alert. (there is space before /home...)
Here is more info about my setup:
OS: Xen Server 6.5 (CentOS 5)
Dell OpenManage Server - V 7.4.0
Script:
#!/bin/sh
FROM=myemail@mydomain.com TO=myemail2@mydomain2.com SMTPSERVER=smtpout.mydomain.com USER=myemail@mydomain.com PASS=mypassword MESSAGE="This is a test" SUBJECT="XEN SERVER"
Scott Hanson
1 Rookie
•
342 Posts
1222
0
Posted February 5th, 2010 11:00
When you set Alert Actions for an event, you can specify the action to "execute an application". Limitations are on the applications that Server Administrator can execute. Follow these guidelines to ensure proper execution:
Do not specify X Window System-based applications because Server Administrator cannot execute such applications properly.
Do not specify applications that require input from the user because Server Administrator cannot execute such applications properly.
Redirect the stdout and stderr commands to a file when specifying the application so that you can see any output or error messages.
If you want to execute multiple applications (or commands) for an alert, create a script to do that and put the full path to the script in the application to execute box.
Example 1: ps -ef >/tmp/psout.txt 2>&1
The command in Example 1 executes the application ps command, redirects the stdout command to the file /tmp/psout.txt, and redirects the stderr command to the same file as the stdout command.
Example 2: mail -s "Server Alert" admin /tmp/mailout.txt 2>&1
The command in Example 2 executes the mail application to send the message contained in the file /tmp/alertmsg.txt to the Linux user, the Admin, with the subject "Server Alert." The file /tmp/alertmsg.txt must be created by the user before the event occurs. In addition, the stdout and stderr commands are redirected to the file /tmp/mailout.txt if an error occurs.
What is your "test.sh" script doing ? I assume it requires no user interaction.