[racktables-users] Re: new report

  • From: "Vater, Wolfgang" <wolfgang.vater@xxxxxxxxxxxxx>
  • To: "racktables-users@xxxxxxxxxxxxx" <racktables-users@xxxxxxxxxxxxx>
  • Date: Wed, 15 Feb 2017 17:09:40 +0000

I played around with an example for the IPv4 logging and based on that I 
created this script:

<?php

/********************************************
*
* Display the IP-Addresses by VLAN Domain
*
*/

$tab['ipv4space']['report'] = 'Report';
$tabhandler['ipv4space']['report'] = 'ipreport_tabhandler';

function ipreport_tabhandler()
{
        $result = usePreparedSelectBlade('SELECT VLANDomain.description as 
VLAN_Domain,VLANIPv4.vlan_id as VLAN_ID,IPv4Network.name as 
VLAN_Description,IPv4Network.ip as Subnet,IPv4Network.mask as Netmask  FROM 
racktables.IPv4Network left join racktables.VLANIPv4 ON (I$

        $rows = $result->fetchAll(PDO::FETCH_ASSOC);

        startPortlet("Report");

        echo "<center><table>";
        echo 
"<th>VLAN_Domain</th><th>VLAN_ID</th><th>VLAN_Description</th><th>Subnet</th><th>Netmask</th>";

        $odd = true;
        foreach($rows as $row)
        {
                $ip_bin = ip4_int2bin ($row['Subnet']);
                $straddr = ip4_format ($ip_bin);

                echo "<tr class=\"".($odd ? "row_odd" : 
"row_even")."\"><td>".$row['VLAN_Domain']."</td><td>".$row['VLAN_ID']."</td><td>".$row['VLAN_Description']."</td><td><a
 href=\"".makeHref (array ('page' => 'ipaddress', 'ip' => 
$straddr))."\">$straddr</td><td alig$
                $odd = !$odd;
        }
        echo "</table></center>";

        finishPortlet("Report");
}

?>

Just create a file in the plugins directory with right owner and permission, 
and you get a "report" tab on the IPv4 page that lists the result of my query.




Wolfgang Vater | Lead Client Architect | Enterprise Services
Unisys Deutschland GmbH | +49 162 255 9338 | wolfgang.vater@xxxxxxxxxx | 
Philipp-Reis-Str. 2 | 65795 Hattersheim

[unisys_logo]<http://www.unisys.com/>

Unisys Deutschland GmbH | Geschäftsführer: Sandro Lindner & Dr. Uwe Heckert | 
Sitz der Gesellschaft: Hattersheim | Amtsgericht: Frankfurt/Main HRB  7929
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.
DIESE E-MAIL IST AUSSCHLIESSLICH FÜR DEN ADRESSATEN BESTIMMT UND KANN 
VERTRAULICHE INFORMATIONEN ENTHALTEN. Sollten Sie nicht der Adressat dieser 
Informationen sein, bitten wir Sie, sich mit dem Absender in Verbindung zu 
setzen und die Informationen von Ihren Endgeräten zu entfernen.
[Grey_LI]<http://www.linkedin.com/company/unisys>  [Grey_TW] 
<http://twitter.com/unisyscorp>  [Grey_GP] 
<https://plus.google.com/+UnisysCorp/posts> [Grey_YT] 
<http://www.youtube.com/theunisyschannel> [Grey_FB] 
<http://www.facebook.com/unisyscorp> [Grey_Vimeo] <https://vimeo.com/unisys
[Grey_UB] <http://blogs.unisys.com/>

From: racktables-users-bounce@xxxxxxxxxxxxx 
[mailto:racktables-users-bounce@xxxxxxxxxxxxx] On Behalf Of Vater, Wolfgang
Sent: Wednesday, February 15, 2017 17:37
To: racktables-users@xxxxxxxxxxxxx
Subject: [racktables-users] new report


This sender failed our fraud detection checks and may not be who they appear to 
be. Learn about spoofing<http://aka.ms/LearnAboutSpoofing>

Feedback<http://aka.ms/SafetyTipsFeedback>

Hi,

I created a query that I would like to see on the reporting page.  How do I do 
that?

This is the SQL query

SELECT
       `VLANDomain`.`description` as "VLAN_Domain"
       ,`VLANIPv4`.`vlan_id` as "VLAN_ID"
       ,`IPv4Network`.`name` as "VLAN_Description"
       ,INET_NTOA(`IPv4Network`.`ip`) as Subnet
       ,`IPv4Network`.`mask` as "Netmask"

FROM `racktables`.`IPv4Network`
left join `racktables`.`VLANIPv4`         ON (`IPv4Network`.`id` = 
`VLANIPv4`.`ipv4net_id`)
left join `racktables`.`VLANDomain`       ON (`VLANIPv4`.`domain_id` = 
`VLANDomain`.`id`)

order by       `VLANDomain`.`description`
              ,`VLANIPv4`.`vlan_id`
              ,`IPv4Network`.`name`



Wolfgang Vater | Lead Client Architect | Enterprise Services
Unisys Deutschland GmbH | +49 162 255 9338 | 
wolfgang.vater@xxxxxxxxxx<mailto:wolfgang.vater@xxxxxxxxxx> | Philipp-Reis-Str. 
2 | 65795 Hattersheim

[unisys_logo]<http://www.unisys.com/>

Unisys Deutschland GmbH | Geschäftsführer: Sandro Lindner & Dr. Uwe Heckert | 
Sitz der Gesellschaft: Hattersheim | Amtsgericht: Frankfurt/Main HRB  7929
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.
DIESE E-MAIL IST AUSSCHLIESSLICH FÜR DEN ADRESSATEN BESTIMMT UND KANN 
VERTRAULICHE INFORMATIONEN ENTHALTEN. Sollten Sie nicht der Adressat dieser 
Informationen sein, bitten wir Sie, sich mit dem Absender in Verbindung zu 
setzen und die Informationen von Ihren Endgeräten zu entfernen.
[Grey_LI]<http://www.linkedin.com/company/unisys>  [Grey_TW] 
<http://twitter.com/unisyscorp>  [Grey_GP] 
<https://plus.google.com/+UnisysCorp/posts> [Grey_YT] 
<http://www.youtube.com/theunisyschannel> [Grey_FB] 
<http://www.facebook.com/unisyscorp> [Grey_Vimeo] <https://vimeo.com/unisys
[Grey_UB] <http://blogs.unisys.com/>

PNG image

JPEG image

JPEG image

JPEG image

JPEG image

JPEG image

JPEG image

JPEG image

Other related posts: