I wrote this while tring to learn how Open-Audit works and thought someone else might find it useful.
I did have two problems, anyone see an error on the code or is it the database. One of the network devices has a blank name and card shows 13 hosts on the summary page but only 12 on the systems page.
list_viewdef_systems_for_netcard.php
[code] <?php
$query_array=array("headline"=>__("List Systems with Network Card Type"), "sql"=>"SELECT * FROM system, network_card WHERE net_uuid = system_uuid AND system_timestamp = net_timestamp AND net_description = '" . $_GET["net_description"] . "' ", "sort"=>"system_name", "dir"=>"ASC", "get"=>array("file"=>"system.php", "title"=>"Go to System", "var"=>array("pc"=>"%system_uuid", "view"=>"summary", ), ), "fields"=>array("10"=>array("name"=>"system_uuid", "head"=>__("UUID"), "show"=>"n", ), "20"=>array("name"=>"system_name", "head"=>__("Hostname"), "show"=>"y", "link"=>"y", ), "30"=>array("name"=>"net_ip_address", "head"=>__("IP"), "show"=>"y", "link"=>"n", ), "40"=>array("name"=>"system_model", "head"=>__("Brand/Model"), "show"=>"y", "link"=>"n", ), ), ); ?> [/code]
list_viewdef_statistic_netcards.php [code] <?php
$query_array=array("headline"=>__("Statistic for Network Card Versions"), "sql"=>"SELECT net_description, net_description AS full_net_card_name, COUNT( net_uuid ) AS count_item, round( 100 / (SELECT count(net_uuid) FROM network_card WHERE net_description != '') * COUNT( net_uuid ), $round_to_decimal_places ) AS percentage FROM network_card WHERE (1) GROUP BY net_description", "sort"=>"count_item", "dir"=>"DESC", "get"=>array("file"=>"list.php", "title"=>__("Systems installed this network card type"), "var"=>array("net_description"=>"%full_net_card_name", "view"=>"systems_for_netcard", "headline_addition"=>"%full_net_card_name", ), ), "fields"=>array("10"=>array("name"=>"net_description", "head"=>__("Type"), "show"=>"y", "link"=>"y", ), "20"=>array("name"=>"count_item", "head"=>__("Count"), "show"=>"y", "link"=>"n", "search"=>"n", ), "30"=>array("name"=>"percentage", "head"=>__("Percentage"), "show"=>"y", "link"=>"n", "search"=>"n", ), ), ); ?> [/code]
|