Subversion Repositories computer_asset_manager_v1

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 rodolico 1
<?php
2
 
3
// Configuration file for getSysinfoMail.php, parse_sysinfo.php and other files
4
 
5
// set this to where the files parsed from mail should be placed.
6
$outpath = '/home/rodolico/temp/sysinfo_reports/unprocessed';
7
$logFile = '/home/rodolico/temp/sysinfo_reports/errors.log';
8
 
9
// server connection information
10
 
11
$servers = array( 
12
                  array ( 
13
                     'servername'      => 'book.dailydata.net', 
14
                     'port'            => 143,
15
                     'ssl'             => false,
16
                     'mailbox'         => '.Processed',
17
                     'username'        => 'serverstats',
18
                     'password'        => 'sachemic',
19
                     'deleteProcessed' => false,
20
                     'enabled'         => false
21
                     ),
22
                  array ( 
23
                     'servername'      => 'book.dailydata.net', 
24
                     'port'            => 143,
25
                     'ssl'             => false,
26
                     'mailbox'         => 'Processed.2011',
27
                     'username'        => 'serverstats',
28
                     'password'        => 'sachemic',
29
                     'deleteProcessed' => true,
30
                     'enabled'         => false
31
                     ),
32
 
33
                  array ( 
34
                     'servername'      => 'book.dailydata.net', 
35
                     'port'            => 143,
36
                     'ssl'             => false,
37
                     'mailbox'         => 'Processed.2012',
38
                     'username'        => 'serverstats',
39
                     'password'        => 'sachemic',
40
                     'deleteProcessed' => true,
41
                     'enabled'         => false
42
                     ),
43
 
44
                  array ( 
45
                     'servername'      => 'book.dailydata.net', 
46
                     'port'            => 143,
47
                     'ssl'             => false,
48
                     'mailbox'         => 'Processed.2013',
49
                     'username'        => 'serverstats',
50
                     'password'        => 'sachemic',
51
                     'deleteProcessed' => true,
52
                     'enabled'         => false
53
                     ),
54
 
55
                  array ( 
56
                     'servername'      => 'book.dailydata.net', 
57
                     'port'            => 143,
58
                     'ssl'             => false,
59
                     'mailbox'         => 'Processed.2014',
60
                     'username'        => 'serverstats',
61
                     'password'        => 'sachemic',
62
                     'deleteProcessed' => true,
63
                     'enabled'         => false
64
                     ),
65
 
66
                  array ( 
67
                     'servername'      => 'book.dailydata.net', 
68
                     'port'            => 143,
69
                     'ssl'             => false,
70
                     'mailbox'         => 'Processed.2015',
71
                     'username'        => 'serverstats',
72
                     'password'        => 'sachemic',
73
                     'deleteProcessed' => true,
74
                     'enabled'         => false
75
                     ),
76
 
77
                  array (
78
                     'servername'      => 'smtp.dailydata.net',
79
                     'port'            => 143,
80
                     'ssl'             => false,
81
                     'mailbox'         => 'INBOX',
82
                     'username'        => 'stats@dailydata.net',
83
                     'password'        => 'los,vce', 
84
                     'deleteProcessed' => false,
85
                     'enabled'         => false
86
                  ),
87
 
88
                  array (
89
                     'servername'      => 'smtp.dailydata.net',
90
                     'port'            => 143,
91
                     'ssl'             => false,
92
                     'mailbox'         => 'INBOX',
93
                     'username'        => 'test@dailydata.net',
94
                     'password'        => 'los,vce', 
95
                     'deleteProcessed' => true,
96
                     'enabled'         => true
97
                  )
98
               );
99
 
100
// these are regex's that define what we want to capture. Everything between startKey and endKey, inclusive
101
// we then process it with eval, which is an anonymous function accepting one paramter (body) and returning
102
// the array represented by the associated data definition
103
$bodyContents = array( 
104
                'xml'  => array( 
105
                      'startTag' => '\<sysinfo', 
106
                      'endTag' => '\<\/sysinfo[^>]*\>', 
107
                      // see http://stackoverflow.com/questions/6578832/how-to-convert-xml-into-array-in-php
108
                      'eval' => function ($body) { return json_decode(json_encode((array)simplexml_load_string($body)),1); }
109
 
110
                      ),
111
                'yaml' => array( 
112
                      'startTag' => '\-\-\-',
113
                      'endTag' => '\.\.\.',
114
                      'eval' => function ($body) { return yaml_parse( $body, 0 ); }
115
                      ),
116
                'ini'  => array( # this is an older format which we don't support, so we'll just write it out
117
                      'startTag' => '\[sysinfo version\]', 
118
                      'endTag' => '', 
119
                      'eval' => function ( $body ) {
120
                                    $data = array();
121
                                    preg_match( '/\[report date\](.*)[\r\n]/', $body, $date );
122
                                    preg_match( '/\[client name\](.*)[\r\n]/', $body, $client );
123
                                    preg_match( '/\[hostname\](.*)[\r\n]/', $body, $host );
124
                                    $data['report']['date'] = str_replace(array("\n", "\r"), '', $date[1]);
125
                                    $data['report']['client'] = str_replace(array("\n", "\r"), '', $client[1]);
126
                                    $data['system']['hostname'] = str_replace(array("\n", "\r"), '', $host[1]);
127
                                    return $data;
128
                                 }
129
 
130
                      )
131
                );
132
 
133
$databaseServer = 'localhost';
134
$databaseUsername = 'camp';
135
$databasePassword = 'camp';
136
$database = 'camp';
137
 
138
?>