Subversion Repositories computer_asset_manager_v1

Rev

Rev 11 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

<?php
/*
 * This file is just an easy way to create the YAML configuration file.
 * You, as a PHP programmer, are probably more familiar with PHP than 
 * YAML, so create an array, $configuration, below, then run this
 * script (ie, php sysinfoRead.conf-creator.php). A properly formatted
 * YAML configuration stream will be sent to STDOUT, where you can
 * capture it.
 * OF COURSE, you can definitely hand code the YAML. It is actually much
 * simpler than doing the PHP, but not if you're familiar with PHP
 * and not so good with YAML.
 */
// Configuration file for getSysinfoMail.php, parse_sysinfo.php and other files
$configuration = array( 
      // set this to where the files parsed from mail should be placed.
      'outpath' => '/home/rodolico/temp/sysinfo_reports/unprocessed',
      'logFile' => '/home/rodolico/temp/sysinfo_reports/errors.log',
      'datapath' => '/home/rodolico/temp/sysinfo_reports',
      'unprocessed_path' => 'unprocessed',
      'getMailScript' => 'getSysinfoMail.php',
      'processMailScript' => 'parse_sysinfo.php',
      

      // server connection information

      'servers' => array( 
                        array ( 
                           'servername'      => 'book.dailydata.net', 
                           'port'            => 143,
                           'ssl'             => false,
                           'mailbox'         => '.Processed',
                           'username'        => 'serverstats',
                           'password'        => 'sachemic',
                           'deleteProcessed' => false,
                           'enabled'         => false
                           ),
                        array ( 
                           'servername'      => 'book.dailydata.net', 
                           'port'            => 143,
                           'ssl'             => false,
                           'mailbox'         => 'Processed.2011',
                           'username'        => 'serverstats',
                           'password'        => 'sachemic',
                           'deleteProcessed' => true,
                           'enabled'         => false
                           ),

                        array ( 
                           'servername'      => 'book.dailydata.net', 
                           'port'            => 143,
                           'ssl'             => false,
                           'mailbox'         => 'Processed.2012',
                           'username'        => 'serverstats',
                           'password'        => 'sachemic',
                           'deleteProcessed' => true,
                           'enabled'         => false
                           ),

                        array ( 
                           'servername'      => 'book.dailydata.net', 
                           'port'            => 143,
                           'ssl'             => false,
                           'mailbox'         => 'Processed.2013',
                           'username'        => 'serverstats',
                           'password'        => 'sachemic',
                           'deleteProcessed' => true,
                           'enabled'         => false
                           ),

                        array ( 
                           'servername'      => 'book.dailydata.net', 
                           'port'            => 143,
                           'ssl'             => false,
                           'mailbox'         => 'Processed.2014',
                           'username'        => 'serverstats',
                           'password'        => 'sachemic',
                           'deleteProcessed' => true,
                           'enabled'         => false
                           ),

                        array ( 
                           'servername'      => 'book.dailydata.net', 
                           'port'            => 143,
                           'ssl'             => false,
                           'mailbox'         => 'Processed.2015',
                           'username'        => 'serverstats',
                           'password'        => 'sachemic',
                           'deleteProcessed' => true,
                           'enabled'         => false
                           ),

                        array (
                           'servername'      => 'smtp.dailydata.net',
                           'port'            => 143,
                           'ssl'             => false,
                           'mailbox'         => 'INBOX',
                           'username'        => 'stats@dailydata.net',
                           'password'        => 'los,vce', 
                           'deleteProcessed' => false,
                           'enabled'         => false
                        ),

                        array (
                           'servername'      => 'smtp.dailydata.net',
                           'port'            => 143,
                           'ssl'             => false,
                           'mailbox'         => 'INBOX',
                           'username'        => 'test@dailydata.net',
                           'password'        => 'los,vce', 
                           'deleteProcessed' => true,
                           'enabled'         => true
                        )
                     ),

      // these are regex's that define what we want to capture. Everything between startKey and endKey, inclusive
      // we then process it with eval, which is an anonymous function accepting one paramter (body) and returning
      // the array represented by the associated data definition
      'bodyContents' => array( 
                      'xml'  => array( 
                            'startTag' => '\<sysinfo', 
                            'endTag' => '\<\/sysinfo[^>]*\>', 
                            // see http://stackoverflow.com/questions/6578832/how-to-convert-xml-into-array-in-php
                            'eval' => 'function ($body) { return json_decode(json_encode((array)simplexml_load_string($body)),1); }'
                            
                            ),
                      'yaml' => array( 
                            'startTag' => '\-\-\-',
                            'endTag' => '\.\.\.',
                            'eval' => 'function ($body) { return yaml_parse( $body, 0 ); }'
                            ),
                      'ini'  => array( # this is an older format which we don't support, so we'll just write it out
                            'startTag' => '\[sysinfo version\]', 
                            'endTag' => '', 

                            )
                    ),

      'datase' => array(
         'databaseServer' => 'localhost',
         'databaseUsername' => 'camp',
         'databasePassword' => 'camp',
         'database' => 'camp',
      ),
      'sendReport' => array(
         'emailScript'=>'/opt/sendEmail/sendEmail.pl',
         'mailTo'=> 'rodo@dailydata.net',
         'mailServer' => 'smtp.dailydata.net:587',
         'mailSubject' => 'Sysinfo Report',
         'mailFrom' => 'sysinfo@dailydata.net',
         'logFile' => '/tmp/mail.log',
         'tls' => "'auto'",
         'smtpUser' => 'stats@dailydata.net',
         'smtpPass' => 'UrLnuCp@G85',
      ),

   );
   
   // here is where we actually generate the YAML
   print yaml_emit( $configuration );
   

?>