Reports

Racktables extension with custom report.

Downloads:

Current Version: racktables_extension_v0.3.3.tar.gz (3794 Downloads )

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:

Current Version: racktables_extension_v0.3.3.tar.gz (3794 Downloads )

Plugins

Cable ID

Racktables Cable ID Plugin:

cableidhelper

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

Download: racktables_cableid_plugin_v0.2.tar.gz (5941 Downloads )

Just copy the file into the plugin directory of racktables.

Nagios

Racktables Nagios Plugin

Download: racktables_nagios_plugin_v0.1.tar1.gz (6658 Downloads )

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:

updateProblems.pl_.tar.gz (5966 Downloads )

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

*/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

This Post Has 71 Comments

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

    1. It should working. I currently can’t test it.
      I release a new version with small fixes in the end of august.

      1. It seems it fails with newest php version because $_POST variable cannot be re-assigned.
        PHP Fatal error: Cannot re-assign auto-global variable _POST

      2. It seems there is a problem with newset PHP version.
        The variable $_POST cannot be re-assigned.

        error message: PHP Fatal error: Cannot re-assign auto-global variable _POST custom-report.php on line 658

    2. I tried to put in my server, one guy install

      XAMPP

      C:\xampp\htdocs\racktables\

      what is the right configuration of extension.php to work in 20.3?

      1. Hi,

        it should placed in C:\xampp\htdocs\plugins

        But i’m not sure if it all runs on windows how it should.

  2. 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

  3. 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

    1. 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

      1. 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

  4. 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

    1. 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

  5. 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.

  6. 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

    1. 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

  7. 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

    1. 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

      1. 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

          1. 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

  8. 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.

  9. 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

    1. 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

      1. 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

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

  11. 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.

  12. 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?

    1. Hi,

      thank you !

      Put extensions.php inside the plugins folder and the extensions folder inside the wwwroot.

  13. 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

    1. Thanks man, you make my day 😉

  14. 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.

    1. 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

      1. 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.

        1. Hi Sebastian,

          Have you been able to have a look into this?

          Regards,
          Egon.

          1. Hi,

            yes i did and i can confirm this bug.

            It would be fixed in the next version.

            Greetings

            Sebastian

          2. 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.

  15. 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

    1. Hi,

      i created a Interface Mod for Racktables to show me external Patchpanel connections:

      http://www.mogilowski.net/wp-content/uploads/patchPanelInterfaces.tar.gz
      https://www.freelists.org/post/racktables-users/Patch-panels,3

      Look at the „renderObjectPortRowExtended“ function in the interface.php file.
      I check if the remote Object is type 9 (=Patchpanel)
      $remote_object[‚objtype_id‘]) == 9
      an than if there is an external connection on this remote object.

      Switches are Type #8 maybe it helps you to create your own script.

      Greetings

      Sebastian

    1. 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!

      1. 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 🙂

      2. 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.

        1. 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.

          1. 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.

  16. 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

    1. Hi,

      i created a own tablesorter type for ip-addresses.

      sorter: "ipAddress"

      make sure you use it for the correct column.

      Greetings

      Sebastian

      1. Thanks, worked directly.

        br

        /ed

  17. 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

    1. Hi,

      did you read the examples for adding additional attributes ?

      Greetings

      Sebastian

      1. 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.

        1. Hi,

          what about the Javascript Filters at the top of the table ?

  18. 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.

    1. Hi,

      sorry lots of other projekts 😉
      I thing end of next month.

      Greetings

      Sebastian

    2. Hi Egon.

      it’s done 😉

      The new version is here and the bug you had reported is fixed.

      Greetings

      Sebastian

      1. Hi Sebastian,

        You make my day 🙂 I’ll install the new version asap and will let you know.
        Thanks for the speed and effort! Keep up the good work…

        Greetiing,
        Egon.

      2. Hi Sebastian,

        Just installed 0.3.3 and Looks good! The only issue I see for now, is that Rack Objects don’t show Tags.

  19. 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

  20. 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

    1. Hello,

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

      Greetings

      1. 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

  21. 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

  22. 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.

    1. 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

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

  24. 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?

Schreibe einen Kommentar

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

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.