UNSOLVED

TRenoir1

updated

17 years ago

T

TRenoir1

3 Posts

0

54095

February 5th, 2010 08:00

OpenManage Server : Alert Application

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
  • Scott Hanson

    1 Rookie

    •

    342 Posts

    1222

    0

    Posted February 5th, 2010 11:00

    Here's the limitations for linux :

    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.
  • TRenoir1

    3 Posts

    1222

    0

    Posted February 8th, 2010 01:00

    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 ?

    Thank's
    Thierry
  • TRenoir1

    3 Posts

    1222

    0

    Posted February 8th, 2010 05:00

    Hello !

    i find The bug !

    if i create a alertaction with execappath=" /home/script/mail.sh", i have the result "Alert action(s) configured successfully" !!!

    i test : it's ok, i receive the mail !

    The space before the name of the script is VERY important !!!

    Thank's !!!
    Thierry
  • ninelalas

    2 Posts

    1222

    0

    Posted October 29th, 2014 11:00

    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.

  • Mohammad84

    1 Message

    1222

    0

    Posted March 18th, 2015 10:00

    Hi Thierry,

    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"

    sendEmail -f $FROM -t $TO -u $SUBJECT -m $MESSAGE -s $SMTPSERVER -xu $USER -xp $PASS

    Thank You,

    Mohammad

    1 Attachment