Yes, I had the trigger enabled; if it wasn't enabled, I didn't get that
line of "Time =============" in the trigger log.

Found out what the problem was.  It was a bug in my script that was
being run.  The weird thing was that it worked on a system running PHP
4.x, but not on a system running PHP 5.x.  Maybe this is a difference in
requirements between the two versions?

Note to Javier and Craig - the included email.inc.php script won't work
on a PHP 5 system (at least with my testing) as it doesn't use the
quotes inside the interface array, and will bomb out (see below).  The
smsclient.inc.php script does use the quotes, and will work.  Or maybe
I'm smoking some really good crack at the moment... =P

Anyway, the problem was two-fold:

Event Data
==========
In my first script (which worked on a PHP 4.x system), I was just using
the $events array by doing things like:
        "event-type = $event[type]\n".
      "event-host_name = $event[host_name]\n".

The script would run, but no data would be produced.  I needed to do a
foreach loop, like:

   foreach ($event as $key=>$event) {
       $testdata = "Event[date] = ".$event[date].
       "\nEvent[severity] = ".$event[severity].
}

I would then get data output from the script.

Interface Data
==============
My script, which was working fine on a PHP 4.x system, was:

        "interface-host_name = $interface[host_name]\n".
      "interface-interface = $interface[interface]\n".

That will cause the script to bomb and give you the weird trigger log
output.  Instead, you have to reference it using quotes inside the
array, such as:

        "interface-host_name = $interface["host_name"]\n".
      "interface-interface = $interface["interface"]\n".



Thanks,
Tim Carr
Buchanan Associates

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Javier
Szyszlican
Sent: Saturday, January 14, 2006 8:07 AM
Cc: jffnms-users@lists.sourceforge.net
Subject: Re: [jffnms-users] PHP Error when Trigger/Action

Are you sure the admin user has the trigger Enabled (checkbox) ?

Because the trigger is not getting executed at all.

Javier

Tim Carr wrote:
> Javier - thanks for the lead...that got us part of the way.  Any
> thoughts on what I still might be doing wrong?  (php version 5.0.4)
> 
> Here's my current trigger log:
> 
>
10:30:13================================================================
> ===
>
11:00:13================================================================
> ===
>
11:30:14================================================================
> ===
>
12:00:13================================================================
> === 
>
12:30:15================================================================
> ===
>
12:40:13================================================================
> ===
>
12:50:14================================================================
> ===
>
13:00:13================================================================
> ===
>
13:10:14================================================================
> ===
> 
> So it is getting triggers, but nothing is happening.
> 
> This line is in the consolidate log, referring to the last trigger
> above:
> 
> 13:30:28 New Alarm: 40807 := 2006-01-12 13:30:14 - 2006-01-12 14:00:44
-
> 111 - 12 - 3 - 303349 - 303349
> 
> This line is in the rrd_analyzer log:
> 13:30:14 New Event (303349): 2006-01-12 13:30:14 - 12 - 24 - C: -
alert
> - rrd_analizer_sla - Storage Used > 80%: 94.36 % - 9
> 
> 
> My configuration:
> 
> - Under "User Triggers", the Admin user is setup for the trigger "Any
> Event" that I defined.
> - Under "Trigger Configuration", the "Any Event" trigger is a Type
> "Match Events".
> - The rules for "Any Event" are:
>       ID = 2
>       Position = 1
>       Field = Any
>       Operator = Is
>       Action = "makeaticket"
>       If Match = Stop This Trigger
>       Final Operator = and
> - The Action Defitions are:
>       ID = 10002
>       Description = makeaticket
>       Command = makeaticket
>       Internal Parameters = <blank>
>       User Parameters = <blank>
> - In the /opt/jffnms/engine/actions directory, I have the
> "makeaticket.inc.php" file (owner is jffnms:jffnms), chmod to 777
> 
> This is the "makeaticket.inc.php" file (which just creates a text
file):
> <?
> /* This file is part of JFFNMS
>  * Adapted by Tim Carr to generate CTS tickets
>  * Copyright (C) <2002-2005> Javier Szyszlican <[EMAIL PROTECTED]>
>  * This program is licensed under the GNU GPL, full terms in the
LICENSE
> file
>  */
> 
> function action_makeaticket ($data) {
>     extract($data);
>     //debug ($data);
> 
>     // ***Test code for output of all possible variables
>     $file = "/opt/jffnms/engine/actions/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
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Javier
> Szyszlican
> Sent: Wednesday, January 11, 2006 8:01 PM
> Cc: jffnms-users@lists.sourceforge.net
> Subject: Re: [jffnms-users] PHP Error when Trigger/Action
> 
> You have enable that trigger for a user for it to be active.
> 
> Look into the triggers users menu.
> 
> Javier

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
jffnms-users mailing list
jffnms-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jffnms-users


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
jffnms-users mailing list
jffnms-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jffnms-users

Reply via email to