|
<?php |
|
if (!empty($agent_data['app']['bind'])) { |
|
$rrd_filename = $config['rrd_dir'] . '/' . $device['hostname'] . '/app-bind-' . $app['app_id'] . '.rrd'; |
|
|
|
$bind_data = array(); |
|
$bind_data_values = array(); |
|
|
|
$bind_rr_types = array( |
|
'A', |
|
'A6', |
|
'ANY', |
|
'AAAA', |
|
'CNAME', |
|
'DNSKEY', |
|
'DS', |
|
'KEY', |
|
'MX', |
|
'NS', |
|
'NSEC', |
|
'PTR', |
|
'RRSIG', |
|
'SOA', |
|
'SPF', |
|
'SRV', |
|
'TXT' |
|
); |
|
|
|
$bind_data_keys = array( |
|
'incoming_requests:query' => 'qry_requests', |
|
'name_server_statistics:ipv4_requests_received' => 'qry_requests4', |
|
'name_server_statistics:ipv6_requests_received' => 'qry_requests6', |
|
'name_server_statistics:responses_sent' => 'qry_responses', |
|
|
|
'name_server_statistics:queries_dropped' => 'qry_dropped', // unsure on key |
|
'name_server_statistics:queries_duplicate' => 'qry_duped', // unsure on key |
|
'name_server_statistics:auth_queries_rejected' => 'qry_rej_auth', |
|
'name_server_statistics:recursive_queries_rejected' => 'qry_rej_recursive', |
|
'name_server_statistics:queries_caused_recursion' => 'qry_res_recursive', |
|
'name_server_statistics:queries_resulted_in_successful_answer' => 'qry_res_success', |
|
'name_server_statistics:queries_resulted_in_authoritative_answer' => 'qry_res_authr', |
|
'name_server_statistics:queries_resulted_in_non_authoritative_answer' => 'qry_res_nonauthr', |
|
'name_server_statistics:queries_resulted_in_referral_answer' => 'qry_res_referral', // unsure on key |
|
'name_server_statistics:queries_resulted_in_nxrrset' => 'qry_res_nxrrset', |
|
'name_server_statistics:queries_resulted_in_srvfail' => 'qry_res_srvfail', // unsure on key |
|
'name_server_statistics:queries_resulted_in_formerr' => 'qry_res_formerr', // unsure on key |
|
'name_server_statistics:queries_resulted_in_nxdomain' => 'qry_res_nxdomain' |
|
); |
|
|
|
foreach (explode("\n", $agent_data['app']['bind']) as $line) { |
|
list($key, $value) = explode('=', $line, 2); |
|
|
|
$bind_data[$key] = $value; |
|
} |
|
|
|
foreach ($bind_data_keys as $key => $dummy) { |
|
$bind_data_values[] = (is_numeric($bind_data[$key]) ? $bind_data[$key] : 'U'); |
|
} |
|
|
|
foreach ($bind_rr_types as $type) { |
|
$in_key = strtolower("incoming_queries:$type"); |
|
|
|
$bind_data_values[] = (is_numeric($bind_data[$in_key]) ? $bind_data[$in_key] : 'U'); |
|
} |
|
|
|
if (!is_file($rrd_filename)) { |
|
$structure = array( |
|
'DS:qry_requests:DERIVE:600:0:125000000000', |
|
'DS:qry_requests4:DERIVE:600:0:125000000000', |
|
'DS:qry_requests6:DERIVE:600:0:125000000000', |
|
'DS:qry_responses:DERIVE:600:0:125000000000', |
|
|
|
'DS:qry_dropped:DERIVE:600:0:125000000000', |
|
'DS:qry_duped:DERIVE:600:0:125000000000', |
|
'DS:qry_rej_auth:DERIVE:600:0:125000000000', |
|
'DS:qry_rej_recursive:DERIVE:600:0:125000000000', |
|
'DS:qry_res_recursive:DERIVE:600:0:125000000000', |
|
'DS:qry_res_success:DERIVE:600:0:125000000000', |
|
'DS:qry_res_authr:DERIVE:600:0:125000000000', |
|
'DS:qry_res_nonauthr:DERIVE:600:0:125000000000', |
|
'DS:qry_res_referral:DERIVE:600:0:125000000000', |
|
'DS:qry_res_nxrrset:DERIVE:600:0:125000000000', |
|
'DS:qry_res_srvfail:DERIVE:600:0:125000000000', |
|
'DS:qry_res_formerr:DERIVE:600:0:125000000000', |
|
'DS:qry_res_nxdomain:DERIVE:600:0:125000000000' |
|
); |
|
|
|
foreach ($bind_rr_types as $type) { |
|
$type = strtolower($type); |
|
$structure[] = 'DS:qry_type_' . $type . ':DERIVE:600:0:125000000000'; |
|
} |
|
|
|
rrdtool_create($rrd_filename, '--step 300 ' . implode(' ', $structure) . ' ' . $config['rrd_rra']); |
|
} |
|
|
|
rrdtool_update($rrd_filename, 'N:' . implode(':', $bind_data_values)); |
|
} |
it works! Thanks.
I had to do a lot of configuration for Bind, I use a Virtualmin setup.
But it all works now, thanks!!!!!!!!!!!!!!!!!!!!