Previous Up Next

6  PICA inner workings

PICA is built up from several components. There is a central executable, pica, a Perl preprocessor, and an alarm manager and Perl library (PIFIA). The central executable reads the supplied command line arguments and does the job; the Perl preprocessor is used for every configuration and non-verbatim distribution file before processing (obviously); and the alarm manager is used to setup and install alarms, and comes with a handy Perl library.

6.1  Variables and namespaces

As we already said when describing the configuration files, the PICA central executable begins by preprocessing and reading pica.conf. After that, hosts.conf is parsed. Here, the program finds out about the machines, their attributes, variables and such. Then, and once for each host, PICA preprocess and reads objects.conf. Obviously, as the file is preprocessed once for each machine, the result can be different, because the preprocessor namespace is, in general, distinct. That way, we can define different distribution files, or in different ways, for each machine. Thus, we can:
  1. Make the host definition depend on command line definitions,
  2. Make the objects definition depend on command line and host variables and
  3. Make the contents of the objects depend on almost everything
Understanding this is very important to understand PICA behaviour. Once you get the hang of it, you will know how to make PICA do what you want.

6.2  PIFIA

PIFIA is a collection of files and conventions to get your servers look at themselves and act if they see something wrong (trying to fix it, telling you, or both). To make this easy to handle, there is a file to be included in your objects.conf file (with #include <pifia.conf>, yes). A pifia.conf file looks like this (yes, usual disclaimers about content updating apply):
###############################################
# PIFIA (PICA Framework for Integrated Alarms #
###############################################
group pifia {
   # Scheduler executable
   file scheduler {
      path = '<#$picabin#>/scheduler';
      source = 'alarms/scheduler';
      perms = '755';
      vars {
         # Where to send mail notifications
  notifymail = 'kuko@ulpgc.es,zoso@ulpgc.es';
  # How to send mail notifications
         mailcmd = '/usr/sbin/sendmail $notifymail';
         # Where to send pager (or sms) notifications
  notifypager = 'kukom@airtel.net';
  # How to send pager notifications
         pagercmd = '/usr/sbin/sendmail $notifypager';
         #pagercmd = 'cat';
      }
   }
   # Cron file
   file pifia.cron {
      path = '/etc/cron.d/pifia.cron';
      source = 'alarms/pifia.cron';
      perms = '644';
   }
   # PIFIA lib (Perl package)
   file pifia.pm {
      path = '/usr/local/lib/site_perl/pifia.pm';
      source = 'alarms/pifia.pm';
      perms = '644';
   }
   # README file (forces the creation of the persitence files dir, so leave it
   # here)
   file README {
      path = '<#$picaalarms#>/persistence/README';
      source = 'alarms/README';
      perms = '644';
   }
}

Previous Up Next