function action_makeaticket ($data) {
extract($data);
//debug ($data);
$to = $parameters[to];
$subject = $parameters[subject];
$short = (isset($parameters["short"])?true:false);
if (!$short) $signature = "---------------------------------------------------------------------\nJFFNMS - Just for Fun Network Management System\n";
$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";
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;
}
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
