Sebastian Mogilowskis Blog

Just another blog about administration, linux and other stuff

Racktables

Reports

Racktables extension with custom report

Downloads:

Version 0.3.3: [download#24#size#nohits] Current Version

Installation

Attension: New installation procedure with version 0.3.3

Move all the contents of the “plugins” folder into the racktables “plugins” folder:

$ cp -r plugins/* /usr/local/racktables/plugins/

This enables ALL reports.

You can remove or add them by adding or deleting one of this files:

For Server Report: server-report.php
For Virtual Machines Report: vm-report.php
For Switch Report: switch-report.php
For Custom Report: custom-report.php

Don’t remove the other files !

Available on GitHub, too:

https://github.com/RackTables/racktables-contribs/tree/master/extensions

Screenshots:

Server report:

Virtual machines:

Switch report:

Custom Report:

Usage

Login into racktables and go to “Reports”.

Now you find “Server”, “Virtual machines”, “Switches” and “Custom” in the report menu.

Note: Sort multiple columns simultaneously by holding down the shift key and clicking a second, third or even fourth column header!

Modifikations

Add custom attribute:

Find the ID of your attribute. In this example it is “10002”. Open the report file “vm-report.php” for example. And add the following componets to the file:

[...]
$aResult[$Result['id']]['myValue'] = '';
if ( isset( $attributes['10002']['a_value'] ) )
    $aResult[$Result['id']]['myValue'] = $attributes['10002']['a_value'];
[...]

[...]
<th>My Value</th>
[...]

[...]
<td>'.$aRow['myValue'].'</td>
[...]

An easy way to find the ID of your custom attribute is to look in the source code (with your browser) of the attribute setting in the configuration.

Note: If it is an standart value and not an attribute (Don’t listed in attributes in the configuration menu) you can directly access the values:

Example with asset Tag:

[...]
$aResult[$Result['id']]['sAssetTag'] = $Result['asset_no'];
[...]

[...]
<th>Asset Tag</th>
[...]

[...]
<td>'.$aRow['sAssetTag'].'</td>
[...]

Custom sorter:

I have a lot of servers like vServer1, vServer2, …, vServer11, etc. but i want to list vServer10 after vServer2 so i created a custom sorter.

First create a new file in the jQuery-Folder called “sorter.js” with the following content:

$.tablesorter.addParser ( {
    id: 'vserver',
    is: function(s) {
        return false;
    },
    format: function(s) {
        s = s.replace(/<a\b[^>]*>/i,'');
        s = s.replace(/[^0-9]+/g,'');
        return s.trim(s);
    },
    type: 'numeric'
});

Now open your report file “vm-report.php” for example and add:

First the include of the new JS-Sorter:

"echo '	<script type="text/javascript" src="extensions/jquery/sorter.js"/>';"

And below the table in the tablesorter JS-Part:

[...]
headers: {
  0: { sorter: "vserver" },
  3: { sorter: "ipAddress" }
}
[...]

This sorter removes the hyperlink (added by the report) and all text parts from the name of the server (only for the sorting) and sorts the column now numeric.

Colors & Icons for Report:

Open “extensions/jquery/themes/racktables/style.css” and look for the examples at the end of the file. Like this one:

table.tablesorter tbody tr span.object_typeid_4 a {
    color:red;	
}

This set the color of all phyical servers (type4) to red.

Downloads:

Version 0.3.1: [download#20#size#nohits] Current Version

Plugins

Cable ID

Racktables Cable ID Plugin

cableidhelper

Shows cable ids of an rack and displays dublicate cable ids.

Download: [download#22#size#nohits]
Just copy the file into the plugin directory of racktables.

Nagios

Racktables Nagios Plugin

Download: [download#17#size#nohits]
Just copy the file into the plugin directory of racktables.

$nagios_user = 'nagiosadmin';
$nagios_password = 'nagios';
$nagios_url = 'https://localhost/nagios3';

Adjust this parameters to your configuration
Note: Racktables “Common name” and Nagios “Hostname” must be identical.
This plugin needs the php curl extension. (aptitude install php5-curl)

For Racktables 0.19.XX copy the nagios.php into the “inc” folder and add the following line to “local.php” in the “inc” folder:

require_once "inc/nagios.php";

Use FQDN instead of Hostname:

Replace:

[...]
$object = spotEntity ('object', $_REQUEST['object_id']);
[...]
$nagios_url_cgi = str_replace("%%NAGIOS%%", urlencode($object['name']), $nagios_url_cgi);
[...]

with:

[...]
$attributes = getAttrValues ($_REQUEST['object_id']);
[...]
$nagios_url_cgi = str_replace("%%NAGIOS%%", urlencode($attributes[3]['value']), $nagios_url_cgi);
[...]

Misc

NDOUtils – has problems

Small script reads nagios problems from ndo database and set has_problems flag in racktables:

[download#19#size#nohits]

Just download and unpack. You may want to create a cronjob like this one (crontab -e):

*/5 * * * * /path/to/updateProblems.pl

This cronjob executes the script every 5 minutes.

Works with plain Nagios and NDOUtils Setup or an Centreon installation. But you have to use the same name of a server in both system !

Donations

If you appreciate my work, feel free to make a donation with paypal:

Donate

71 thoughts on “Racktables

  • […] Download und Anleitung hier: Racktables […]

  • Guest says:

    Is it plugins workable on RackTables 0.20.4? I tried loading them in but the whole server went down..

  • blaza-pl says:

    It fails with newset PHP version (tested on 5.4.4-14) because $_POST[‘name’] is re-assign and this is forbidden by php.

    The error is: PHP Fatal error: Cannot re-assign auto-global variable _POST

  • Jacob says:

    Installed Racktables extensions per instructions. But it completely crashes the app and I get the following error in /var/log/httpd/error_log:

    [Tue Jan 28 15:57:26 2014] [error] [client 10.65.21.98] PHP Warning: require_once(../wwwroot/extensions/reports/server-report.php): failed to open stream: No such file or directory in /var/www/html/RackTables-0.20.6/plugins/extension.php on line 4
    [Tue Jan 28 15:57:26 2014] [error] [client 10.65.21.98] PHP Fatal error: require_once(): Failed opening required ‘../wwwroot/extensions/reports/server-report.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /var/www/html/RackTables-0.20.6/plugins/extension.php on line 4

    Component versions:
    Racktables 0.20.6
    php-5.3.3-27
    httpd-2.2.15-29
    Racktables Extension (Version 0.3.1)

    Any Ideas?
    Thanks,
    Jacob

    • sebastian says:

      Hi,

      the path doesn’t match. You have a different installation structure.

      You have to fix your relative path to your environment. Or use an absolut path:

      require_once “/var/www/html/RackTables-0.20.6/extensions/reports/server-report.php”

      But i’m not sure i don’t know exactly your path structure.

      My webroot is: “/var/www”
      There i have my “plugins” and “racktables” folders. The “extensions” folder is inside the “racktables” folder. (Same level as the index.php of racktables.

      I hope this helps you to change the require_once to your setup.

      Greetings

      Sebastian

      • Jacob says:

        Our path looks like:
        /var/www/html/RackTables-0.20.6/wwwroot/index.php
        I read through the RT install instuctions. It seems like the installation was done a little strange. (Install was not done by me.) Thanks for pointing out the issue. I will look correcting our installation or modifying the paths as you say.
        Thanks for your help.
        Jacob

  • Justin says:

    The extension has been working great. i would like to modify your server report and i’m having some problems when i do. I would like to remove the MAC col. I removed commented out the lines of code that I thought would do this but all i get is the MAC header removed but the data rows still have that col with empty data so everything is mis-alligned. I know i could create a custom report but would like to have this as a standard. Thanks

    • sebastian says:

      Hi,

      you have to remove the l2address foreach lines. (With

      )

      And you have to change the javascript on the bottom of the page. “1: {sorter: “ipAddress” },”

      Greetings

      Sebastian

      Greetings

      Sebastian

  • Aaron Webstey says:

    Incredible extensions. Any chance you’ll add support to “permalink to results” or something like that on custom reports?

    I was going to write my own report to list all list all IP addresses in use by any system, but your custom report pretty much does that for me. It would just be nice to be able to bookmark the report for quick access instead of clicking through the interface to get it.

    Again, incredible work!!! I would donate if I were allowed; my work doesn’t go for that sort of thing.

  • Rob Walker says:

    Is it possible to use this via wget? I would like to automate an inventory reporting script, and gathering data from this custom report would be awesome.

    Thanks,
    Rob

    • sebastian says:

      Hi,

      you can use it like that:


      wget --http-user=admin --http-password=XXXXX -O "vms.csv" "http://localhost/racktables/wwwroot/index.php?page=reports&tab=vm&csv"

      Please change the URL to your setup.

      Greetings

      Sebastian

  • Charelly says:

    The extension(v0.3.1) has been working excellent. i would like to modify your server report and i’m having some problems when do i want to modify the server report.

    Name MAC IP Comment Contact Type OEM S/N HW Expire Date OS Location
    -> Name FQDN IP(s) MAC SW(type) CPU Memory Disk HW(type) H/W Introduction Location Contact Comment

    How to do modified the server-report.php file???
    I wonder if you can help me??

    Also, Can I print out the Server or Switches report??

    Korean Language (Utf-8) is broken when CSV export.

    Linux RackTables 0.20.6 Apache (2.2.15) PHP 5.3.3 MySQL (5.1.71) racktables_extensions_v0.3.1

    • sebastian says:

      Hi,

      export the report as CSV and open it with libre office or excel and print it.

      Sure you can add or remove colums in the server report. You have to extend the “$aResult” array with the value you like to add to your report. Don’t forget to extend the CSV and HTML table for the new output values.

      If you don’t have any experience in PHP just use the custom report instead.

      Greetings

      Sebastian

      • Charelly says:

        HI sebastian…..

        Thank you for your quickly reply…

        Actually, I sometimes used the cusotm report….
        However, our co-workers want to use by defined server report.
        Thus, I want to configure the defined Server Report in order to replace our configuration document for our job.
        I shouldn’t have experienced in PHP. sigh… ㅠ.ㅠ

        Also, I want to view rack image with add object picture.
        https://bugs.racktables.org/view.php?id=999

        I’ll really be looking forward to your reply.. ^^

        Best Regards.

        Charelly

        • sebastian says:

          Hi,

          just try it. Look at the source code and try to add your own fields.

          There are examples in my racktables article: http://www.mogilowski.net/projects/racktables

          Look at “Modifikations” section.

          Greets

          Sebastian

          • Charelly says:

            Thank you for your advice….

            Though I have never experienced the PHP programming,
            I’ll try to look at the source code and I’ll customizing the report for our job.
            I think that Racktables extension 0.3.1 is great..

            Thank you..You’ve been a great hep already..

            Regards,

            Charelly

  • Charelly says:

    Hi….

    I’m sorry to have caused you so much trouble.
    I still have several questions regarding the customize of the racktables.
    I’d like to manage the DCIM (Data Center Infrastructure Management) by racktables.
    If i study the PHP programming, can I afford to do that(example)???
    I was wondoring if I could use to method by the Racktables Extension.
    Thank you for your time and prompt response.

  • Charelly says:

    Sorry…

    The example chart was broken.
    Could you removed before my comment??
    If you inform to me your e-mail, I’ll send the e-mail.
    I’ll attach an examle file.

    Regards.
    Charelly

    • sebastian says:

      Hi,

      sorry i don’t understand your specific problem. You can add custom colums to the reports by following the instructions in this article.

      Greetings

      Sebastian

      • Charelly says:

        HI….

        Thank you for your reply..
        Sorry to have bothered you…
        I sent an e-mail..
        I think that the extension function has been working great for custom report.
        However, I want to see a statistical data for system management.
        I’d like to see with a count of vendor equipment and amount of Locations.
        If I study the PHP programming, can I be customized the racktables by extension.
        Is it possible ????

        Thank you for your warnings and helpful suggestions. ^^

        Best regards
        Charelly

  • Michael says:

    Thank you so much for your work. These reports are awesome – especially the custom one!

  • Dan says:

    Great plugin.

    I have a question regarding custom reports. I would like to find out how many units a specific Object Type is utilizing. Is this possible? I can’t seem to figure it out.

    For instance I would like to find out how many units Object Type Servers is using and which are tagged with Tag MMX.

  • Raphael Nunes says:

    Hi. Thanks for your effort on this project.
    I can not make the plugin to work in version 0.20.8.
    My plugin dir is inside racktables dir, and the path is correct in the pre-init.php.
    My question is what else should be inside plugins? Right now I have only extensions.php. Is it right?

  • Rao says:

    Hi Guys,

    figured out how to get this installed. here is the process for racktables 0.20 install for this .

    INSTALL PLUGINS IN RACKTABLES

    WWWROOT folder for us is /var/www/html/racktables/

    Create plugins folder in /var/www/html

    +>racktablespc:/var/www/html$ sudo mkdir plugins

    unrar racktables_extensions_v0_3_1_tar_gz by doing

    +>racktablespc:/home/sydneyit$ sudo tar -zxf racktables_extensions_v0_3_1_tar_gz

    now move extensions folder to /var/www/html/racktables/

    +>sudo cp -R /home//racktables_extensions_v0.3.1/extensions /var/www/html/racktables/

    now copy extension.php to /var/www/html/plugins

    +>sudo cp extensions.php /var/www/html/plugins/

    Now, modify extensions.php to as below:

    +>racktablespc:/var/www/html/plugins$sudo vi extensions.php

    Code:
    BEGIN

    END

    Final step.

    restart apache.: sudo service apache2 restart

    should be all good

  • Egon says:

    Hi Sebastian,

    We recently add the “Customer Report” plugin into our Racktables 0.20.10. We don’t have output for the Object Type “Rack”. Is this a known issue? And is the a possibility to resolve this?

    Thanks in advance,
    Egon.

    • sebastian says:

      Hi,

      no there is no known issue about this at the moment.

      I’ll take a look at this problem. If you can mail me some more informations or details it will may help me.

      Greetings

      Sebastian

      • Egon says:

        Hi Sebastian,

        Sorry for the late reply, i’ve forgot to select the response by email 😉

        What information do you need? FYI: We have several locations with several rows and racks within a row. On selecting the object type “Rack” (or “Row”and/or “Location” btw!) and one/more/all “Common Values”, “Attributes” or “Tags” I’m getting only a “No items found !!!” response. All other types gives me the output.

        Egon.

        • Egon says:

          Hi Sebastian,

          Have you been able to have a look into this?

          Regards,
          Egon.

          • sebastian says:

            Hi,

            yes i did and i can confirm this bug.

            It would be fixed in the next version.

            Greetings

            Sebastian

          • Egon says:

            Hi Sebastian,

            Thanks for confirming this. Any ideas when the next release will be published? I have an urgent need for getting the rack info out of Racktables.

            Egon.

  • Yasin Shaikh says:

    Hi

    Any chance you can give me any ideas on how I can export/report all remote connection points on a switch, I have tried but cant find the excat id number I need o use.

    Thanks
    Much appreciated

  • iurii says:

    Hi all,

    It’s not working for RT 0.20.10. Not changes on page Reports, also if I open:
    1. http://example.com/extensions/reports/vm-report.php – Page is clear
    2. http://example.com/index.php?page=reports&tab=vm – Internal error. Failed to find handler for page ‘reports’, tab ‘vm’

    Anybody can provide normal instruction for installation plugins to RT 0.20.10 (PHP 5.4.16) ???

    • iurii says:

      I have done 🙂

      all folders and files in wwwroot (/var/www/racktables) have chown apache:apache
      1. mkdir /var/www/racktables/plugins
      2. cp extensions /var/www/racktables
      3. add to /var/www/racktables/inc/secret.php such row: $racktables_plugins_dir = ‘/var/www/racktables/plugins’;
      4. Make links in plugins folder to extensions files, for example
      /var/www/racktables/plugins:
      ln -s ../extensions/reports/vm-report.php vm-report.php

      it works for me!

      • sebastian says:

        Hi,

        i’m running my extension on 0.20.10, too.

        There shouldn’t be any changes on the installation.

        extensions.php in the plugin folder which includes the single reports should working.

        But if it works for you don’t change your setup 🙂

      • Marc says:

        I am having the same problem, however I still cannot get it to work after applying your changes. I am running RT 0.20.11.
        Any suggestions?
        Marc.

        • Marc says:

          After some more work I solved my own problem. The problem being that when I follow the instructions to install these plugins, upon logging into Racktables, I get a blank screen.
          I had to set ownership of user and group for all files to ‘www-data’ (this is the account running my apache daemon).
          chown www-data: *.php
          chown -R www-data: css js pix
          I also found that as long as I don’t have the files “extension.php” and “linkmgmt.php” available, it works. With these files available in the plugin directory, I get a blank screen directly after authenticating. I have tried setting the ownership of the above 2 files to www-data, but that did not solve the problem.
          Further details: I am running RT 0.20.11 on a TurnkeyLinux LAMP virtual machine.

          • Marc says:

            Further to my previous comment: I also added
            $racktables_plugins_dir = ‘/var/www/racktables/plugins/’;
            to the secret.php file.
            That is the directory where I keep all plugins. I am not symlinking anything.

            Marc.

  • Ed says:

    Hi!
    I Thank you very much for a great plugin. I have used it some and made some new reports and everything works fine except for one thing. In all the reports where there are some entries without ip-address that column is sorted fine, however if I have a report where all entries have an ip-address I can not sort on that column. This goes for all reports including the included ones. I tried to fix it by adding an empty character to the ip-address and if I do it is sortable but now as text, i.e in the “wrong” order.
    I have tried with chrome and explorer but it is the same.
    Am I the only one affected by this or has anyone else seen the same problem?

    Br

    /ed

  • RJ says:

    Hi Sebastian,

    This is a great plugin! Thanks for working on this. I have been playing with the server reports and manage to add ,ore columns by adding new attributes. However, I wanted to add the Location column – not by adding additional attribute but linking the actual location name against the the row and rack name for each object. Can you help me on this?

    Also, I wanted to ask if there is a way to bulk upload data on racktables.

    Thanks in advance!

    RJ

    • sebastian says:

      Hi,

      did you read the examples for adding additional attributes ?

      Greetings

      Sebastian

      • RJ says:

        Thanks Sebastian, I managed to sort this one out. I ended up adding some lines in the SQL schema. To further improve the report, I wanted to have filtering on the columns, is this possible? Similar to an excel spreadsheet when you apply filters.

  • Egon says:

    Hi Sebastian,

    Regarding my post on August 24: Do you know when the new release will be available with the fix for the issue I’ve mentioned?

    Thanks in advance,
    Egon.

  • Enzo says:

    Hello,

    I insstalled and work perftectly just one suggest, is not possible export all the objects for a rack, when in the custom report check ‘rack’, show all the racks, and select the rack then show an error:

    Object ‘object’#’75’ does not exist

  • Ron says:

    Hello, I write from Venezuela , I want to know where to find information for initial data loading, I have installed 0.20.11 RackTables in the Debian operating system 8.4.0 Jessie 64bits (Debian terminal or console ) , operating system mounted on my virtual machine ( VirtualBox ) , and I need to make a manual, for the initial loading of data regarding the installation and configuration and perform , I hope you can help me , greetings

    • sebastian says:

      Hello,

      i’m not sure what you want but have you tried to import “init-sample-racks.sql” from the script folder ?

      Greetings

      • Ron says:

        Thanks, I found what I wanted , I understand that my comment was somewhat confusing , this was due to the mistranslation , my native language is Spanish , Greetings

  • Ron says:

    Thanks, I found what I wanted , I understand that my comment was somewhat confusing , this was due to the mistranslation , my native language is Spanish , Greetings

  • RJ says:

    Hi Sebastian,

    Can you help me with the code in adding custom column in server report? What I want is to add a column to display all the tags for each object. As the tags are not part of the Attributes, I can’t seem to add them the way you described it in your guide.

    I know the same result can be achieved using your “Custom Report” plugin but I would like to have it on the other reports as well.

    Thanks.

    • sebastian says:

      Hi,

      best way is to take a look at the sourcecode from the custom report. (getResult Function)
      The tags are loaded with the functions “loadEntityTags” and “getImplicitTags” to the $Result array.
      This part is not in the server or vm report. Just copy and paste with little mods and it should work for you.

      Greetings

      Sebastian

  • Mehboob Chhipa says:

    Excellent Work works like charm
    I wanted to know can we order display of columns in custom report?

  • […] descargar la última versión desde el sitio del desarrollador (al momento de este tutorial es […]

  • brian says:

    After I install Nagios plugins, (Just copy the file into the plugin directory of racktables)

    then, I can see the tag on Main page : Objects : “Nagios”
    But How can I config the setting the Nagios?

Leave a Reply

Your email address will not be published. Required fields are marked *

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.