Sebastian Mogilowskis Blog

Just another blog about administration, linux and other stuff

Racktables

Reports

Report extension für RackTables mit Custom Report.

Downloads:

Version 0.3.3: Racktables Extension (Version 0.3.3) (502.1 kB) Aktuelle Version

Installation

Achtung: Neue Installationsanleitung seit Version 0.3.3

Alle Dateien aus dem “plugins” Verzeichnis in das racktables “plugins” Verzeichnis kopieren:

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

Man kann natürlich auch einzelne Reports hinzufügen oder entfernen durch hinzufügen oder löschen der folgenden Dateien:

Für Server Report: server-report.php
Für Virtual Machines Report: vm-report.php
Für Switch Report: switch-report.php
Für Custom Report: custom-report.php

Bitte keine anderen Dateien entfernen !

Auch auf GitHub zu finden unter:

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

Screenshots:

Server Report:

Virtuelle Maschinen:

Switch report:

Custom Report:

Benutzung

Nun in die Racktables Webseite einloggen und “Reports” aufrufen.

Man findet nun vier neue Reiter “Server”, “Virtual machines”, “Switches” und “Custom” im Menü.

Bemerkung: Man kann mehrere Spalten gleichzeitig sortieren durch das gedrückthalten von Shift wärend man auf weitere Spalten in der Kopfzeile klickt!

Modifikationen

Eigene Attribute hinzufügen:

Zuerst sucht man sich die ID seines Attributes. In diesem Beispiel ist es die “10002”. Nun öffnet man zum Beispiel die Datei “vm-report.php” und fügt folgende Teile ein:

[...]
$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>
[...]

Ein einfacher Weg, die ID seines Custom Attributes zu finden ist sich den Quelltext (mit dem Browser) der Attribute in der Konfiguration anzuschauen.

Bemerkung: Falls es sich um einen Standartwert handelt und nicht um ein Attribut (Nicht in der Attributliste im Konfigurationsmenü enthalten) kann man den Wert direkt auslesen:

Beispiel mit Asset-Tag:

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

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

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

Eigene Sortierung:

Ich habe jede Menge Server mit Namen wie vServer1, vServer2, … vServer11, etc. und ich möchte vServer 10 nach vServer2 in meiner Liste haben. Deswegen habe ich eine eigene Sortierung gebaut.

Zuerst erstellt man eine neue Datei mit dem Namen “sorter.js” im JQuery-Verzeichnis mit folgendem Inhalt:

$.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'
});

Nun öffnet man seine Report Datei wie zum Beispiel “vm-report.php” und fügt folgendes hinzu:

Zuerst den neuen Sorter einfügen:

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

und unterhalb der Tabelle im Tablesorter JS-Teil:

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

Dieser Customsorter entfernt den Hyperlink (durch den Report hinzugefügt) und alle Textteile vom Servernamen (nur für die Sortierung) und sortiert den Rest nummerisch.

Farben und Icons für den Report:

Öffne “extensions/jquery/themes/racktables/style.css” und suche nach den Beipielen am Ende der Datei. Wie zum Beispiel diese:

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

Dies ändert die Farbe für alle physikalischen Server (type4) auf rot.

Downloads:

Version 0.3.1: Racktables Extension (Version 0.3.1) (223.36 kB) Aktuelle Version

Plugins

Cable ID

Cable ID Plugin für Racktables

cableidhelper

Liste alle Cable IDs in einem Rack und hebt Duplikate hervor.

Download: Racktables Cable ID Plugin (47.58 kB)
Die Datei einfach in das Pluginverzeichnis von Racktables kopieren.

Nagios

Nagios Plugin für Racktables

Download: Racktables Nagios Plugin (102.51 kB)
Die Datei einfach in das Pluginverzeichnis von Racktables kopieren.

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

Diese Variablen müssen ggf. angepasst werden.
Bemerkung: “Common name” in Racktables und “Hostname” in Nagios müssen identisch sein.
Das Plugin benötigt die php curl Erweiterung. (aptitude install php5-curl)

Für Racktables 0.19.XX kopiert man die nagios.php Datei in das “inc” Verzeichnis und fügt folgende Zeile in die “local.php” im “inc” Verzeichnis ein:

require_once "inc/nagios.php";

FQDN anstelle des Hostnamens verwenden:

Ersetze:

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

durch:

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

Verschiedenes

NDOUtils – has problems

Ein kleines Script, dass Probleme aus einer Nagios NDO Datenbank liest und das has_problems Flag in Racktables setzt:

Racktables Update Problems (10 kB)

Einfach herunterladen und entpacken. Warscheinlich möchte man auch einen Cronjob wie diesen anlegen (crontab -e):

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

Dieser Cronjob führt das Skript alle 5 Minuten aus.

Funktioniert mit einer normalen Nagios Installation mit NDOUtils oder einer Centreon Installation. Allerdings muss man den Servern in beiden Systemen den selben Namen geben.

Donations

Wenn dir meine Arbeit gefällt und du mich unterstützen möchtest, spende einfach ein paar Euro via 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.