From: [EMAIL PROTECTED] on behalf of Javier Szyszlican
Sent: Tue 9/27/2005 4:08 PM
Cc: [email protected]
Subject: Re: [jffnms-users] New Action Question
You should enable debugging/logging in setup.php and check
the logs/trigger.log
file to see if the trigger you created is being
matched.
Javier
Tim Carr wrote:
> OK, back from vacation and
trying to get this up and running again. I'm
> trying to get JFF to
execute a script if something happens. I've
> modified the
"email.inc.php" to "makeaticket.inc.php" (see below for the
> script) to
just try to create a file so I can see what parameters are
> passed in
what variables.
>
> The steps I followed, from a default
JFFNMS install (which will fire off
> the email action when something
happens, right?), were to:
> - Go to the "Actions Definition"
menu.
> - For the "Send Mail" action, I changed the command to be
"makeaticket"
> from "email".
>
> JFF will show that a
system goes down in the event log, but it doesn't
> create my file, so I'm
guessing the action isn't happening (or my script
> is screwed up
somehow). Any thoughts here?
>
> The script I'm using
is:
>
> <?
> function action_makeaticket
($data) {
> extract($data);
> //debug
($data);
> $from = $parameters[from];
> $to =
$parameters[to];
> $subject = $parameters[subject];
>
$short = (isset($parameters["short"])?true:false);
> if (!$short)
$content[hello] = "Hello ".$user[fullname].":\n";
>
> if
(!$short) $signature =
>
"---------------------------------------------------------------------\nJFFNMS
>
- Just for Fun Network Management System\n";
> if (is_array($alarm))
{
> $content[alarm]= "Alarm
Time:\t".$alarm[date_start];
>
>
if ($alarm[alarm_state]==ALARM_UP)
> $content[alarm] .= " To
".$alarm[date_stop];
>
>
$content[alarm] .= "\n".
> "Alarm
Type:\t".$alarm[type_description]." ".
>
$alarm[state_description]." ".
>
($short?"":"\n");
> }
>
> if
(is_array($interface))
>
$content["interface"]= "Interface:\t".
>
$interface[type_descripton]." ".
>
$interface[host_name]." ".
>
$interface[zone_shortname]." ".
>
$interface["interface"]." ".
>
$interface[client_name]." ".
>
$interface[description]." ".
>
"\n";
> if (is_array($event) && !$short)
//FIXME
> foreach ($event as
$key=>$event)
> $content["event-$key"]=
"Event:\t".
> $event[date]."
".
> $event[type]."
".
> $event[host_name]."
".
>
$event[zone]."\n".
>
"Event:\t".events_replace_vars($event,$event[text])."
".
>
"\n";
>
> $all_content =
join($content,"\n");
>
> if ($parameters[comment]
&& !$short)
> $all_content .=
"\nComment:
".$parameters[comment]."\n";
>
>
> $body =
"$all_content \n$signature";
>
> if ($short) $body =
str_replace("\t","
",$body);
>
> $file
= "./testoutput.txt";
>
$testdata = "event-date =
$event[date]\n".
>
"event-type =
$event[type]\n".
>
"event-host_name =
$event[host_name]\n".
>
"event-text =
$event[text]\n".
>
"alarm-date_start =
$alarm[date_start]\n".
>
"alarm-type_description =
$alarm[type_description]\n".
>
"alarm-state_description =
$alarm[$state_description]\n".
>
"interface-type_description =
$interface[type_descripton]\n".
>
"interface-host_name =
$interface[host_name]\n".
>
"interface-interface =
$interface[interface]\n".
>
"interface-description =
$interface[description]\n";
>
>
$fp = fopen ("$file",
"wb");
> fwrite ($fp,
$testdata);
> fclose
($fp);
>
> return
$result;
> }
> ?>
>
>
Thanks,
> Tim Carr
> Buchanan Associates
>
>
------------------------------------------------------------------------
>
*From:* [EMAIL PROTECTED] on behalf of Craig
Small
> *Sent:* Mon 9/12/2005 5:24 PM
> *To:*
[email protected]
> *Subject:* Re: [jffnms-users] New
Action Question
>
> On Mon, Sep 12, 2005 at 02:38:58PM -0500, Tim
Carr wrote:
> > - I've not had any PHP experience.
Does anyone have an example php
> > script that would do
something like that?
> Look at the email.inc.php Instead of the mail
command you could
> use exec()
>
> > - I'm
having trouble understanding how the existing PHP action scripts
>
> (i.e., email.inc.php) are getting their information about what is
down.
> > Is there some sort of documentation about that?
>
Hmm, that section needs some work!
> Time to fire up vim.
>
>
Javier evilly uses extract() in that example.
>
> The action
function gets one parameter, which is an array of
> arrays. The arrays
are:
> $data['parameters'] = an array of the user and action
parameters,
> defined in the gui
>
$data['alarm'] = the usual alarm values
> $data['interface'] =
the usual interface vaues
>
> See
> http://www.jffnms.org/docs/expanding.html#sec:commonparms
>
for that those values are.
>
> >
> >
Thanks,
> > Tim Carr
> > Buchanan
Associates
> >
>
> --
> Craig
Small GnuPG:1C1B D893 1418 2AF4 45EE 95CB
C76C E5AC 12CA DFA5
> Eye-Net Consulting http://www.enc.com.au/
MIEE Debian developer
>
csmall at :
enc.com.au
ieee.org
debian.org
>
>
>
-------------------------------------------------------
> SF.Net email is
Sponsored by the Better Software Conference & EXPO
> September 19-22,
2005 * San Francisco, CA * Development Lifecycle Practices
> Agile &
Plan-Driven Development * Managing Projects & Teams * Testing &
QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
>
_______________________________________________
> jffnms-users mailing
list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jffnms-users
>
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Javier
Szyszlican, Project Leader, JFFNMS
[EMAIL PROTECTED]
I hope JFFNMS or
I were helpful to you, if you
can, please donate at http://jffnms.org/donate
-------------------------------------------------------
This
SF.Net email is sponsored by:
Power Architecture Resource Center: Free
content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
jffnms-users
mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jffnms-users
