next up previous
Next: The scheduler Up: PICA Framework for Integrated Previous: PICA Framework for Integrated

Directories and caller scripts

By default, alarms are searched in $picasrc/alarms, but you can specify an absolute path to override this. They get installed in $picaalarms/priority in the remote machine. Because one can pass arbitrary (yes, we love that word) parameters to the alarm, it's not called directly, but through a script, called ``alarmname-picacaller''. This also lets us use scripts not designed originally for PICA. The only thing one needs is to define the calling convention (it's one of the alarm optional attributes). In its definition we can take advantage of the many features of the preprocessor, as variable substitution or Perl on-the-fly code generation. It describes the parameters the alarm will be called with. For example, we could define an alarm like this:

alarm DNSChkUrgent {
   priority = 'Urgent';
   source = 'DNSChk';
   perms = '755';
   calling-convention = '-w 1 -c $threshold';

   vars {
      threshold = 8;
   }
}

Supposing $picaalarms points to /var/lib/pica/alarms, DNSChkUrgent would get installed in

-rwxr-xr-x zoso zoso /var/lib/pica/alarms/Urgent/DNSChkUrgent

(note that we haven't specified any uid or gid) and the contents of DNSChkUrgent-picacaller would be this:

#!/bin/sh
/var/lib/pica/alarms/Urgent/DNSChkUrgent -w 1 -c 8 "$@"

Cool, uh? The last "$@" lets you add more parameters if you want to call it by hand.


next up previous
Next: The scheduler Up: PICA Framework for Integrated Previous: PICA Framework for Integrated
Esteban Manchado Velázquez 2002-12-13