object uname in notification subject?
Sebastian Kayser
Sebastian.Kayser at bifab.de
Wed Dec 15 12:54:16 EST 2004
> i have been playing around with customized notifications methods a while
> ago. Currently my overriden mail notifcation method looks like this:
>
> Method "mail" {
> command: /usr/sbin/sendmail -t
> send: To: %R\nFrom: %F\nSubject: [Argus] - %O %S\n\n%M\n\n\
> Overview: https://argus.ma.bifab.de/cgi-bin/arguscgi?func=ntfylist\n\
> Notify: https://argus.ma.bifab.de/cgi-bin/arguscgi?func=ntfyack;idno=%I
> }
>
> Is it possible to display the uname of an object in the subject of the
> notification mails? Currently the subjects get rather messed up by those
> long object names.
>
> I tried the %O{param} sequence (%O{'uname'}, %O{uname}) to no avail.
> Aren't the items listed on the debugging page of an object its
parameters?
I just dug into the source code - nice comments there ;) - and it seems as
if the problem is hidden in NotMe.pm. The message text is normally
referred to as $txt and when it comes to expansion for %O parameters as
$msg.
The following "patch" fixes this for both the current dev version
(20041008) and the stable 3.3.
--- src/NotMe.pm 2004-12-15 18:36:32.000000000 +0100
+++ src/NotMe.pm.patched 2004-12-15 18:36:53.000000000 +0100
@@ -189,7 +189,7 @@
if( $txt =~ /%O/ ){
my( $param, $value );
- if( $msg =~ /%O{([^\}]+)}/ ){
+ if( $txt =~ /%O{([^\}]+)}/ ){
$param = $1;
$param =~ s/^\s+//;
$param =~ s/\s+$//;
Regards,
Sebastian Kayser
More information about the Arguslist
mailing list