Rev 3 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<?php
// Configuration file for getSysinfoMail.php, parse_sysinfo.php and other files
// 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';
// 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' => '',
'eval' => function ( $body ) {
$data = array();
preg_match( '/\[report date\](.*)[\r\n]/', $body, $date );
preg_match( '/\[client name\](.*)[\r\n]/', $body, $client );
preg_match( '/\[hostname\](.*)[\r\n]/', $body, $host );
$data['report']['date'] = str_replace(array("\n", "\r"), '', $date[1]);
$data['report']['client'] = str_replace(array("\n", "\r"), '', $client[1]);
$data['system']['hostname'] = str_replace(array("\n", "\r"), '', $host[1]);
return $data;
}
)
);
$databaseServer = 'localhost';
$databaseUsername = 'camp';
$databasePassword = 'camp';
$database = 'camp';
?>