View Issue Details

IDProjectCategoryView StatusLast Update
406RackTablesdefaultpublic2012-12-07 17:45
Reporteruser205Assigned Tohollo  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version0.19.1 
Target Version0.20.2Fixed in Version0.20.2 
Summary406: Code for displaying munin graphs in Racktables
DescriptionHi,

My colleagues has modified interface.php to include munin graphs in the Racktables. Below code will come under

  renderFilesPortlet ('object', $object_id);

#############code to be pasted



###############Code Ends


if (count ($info['ports']))
        {
                startPortlet ('ports and links');


############Code############
$has_munin = false;
       foreach (getAttrValues ($object_id) as $attr_id => $record)
       {
                if ($record["name"] == "munin URL" && $record["value"]!="")
                       $has_munin = $record['value'];
       }
        if ($has_munin !== false)
        {
               startPortlet ('munin');
               echo "<iframe frameborder=0 width='100%' height=600 src='$has_munin'></iframe>";
               finishPortlet ();
       }


#################Code Ends##############
Additional InformationAlso, I have attached the modified file for reference
TagsNo tags attached.

Relationships

related to 306 closeduser105 Rack Tables + Cacti 

Activities

2011-02-24 11:33

 

interface.php (338,665 bytes)

user205

2011-02-24 11:35

  ~0000272

One has to associate "munin URL" (case sensitive) attribute (string field) with the server.
infrastation

infrastation

2011-07-26 13:13

administrator   ~0000382

Jonathan, could you review this?
infrastation

infrastation

2012-10-18 10:38

administrator   ~0000881

Could you explain the structure of Munin URLs and if Munin feature can be designed after the existing Cacti feature?
infrastation

infrastation

2012-10-18 10:50

administrator   ~0000883

I have contacted the requestor by means of SourceForge. It is OK to close this bug on 18 Nov 2012, if there is no feedback provided by that time.
hollo

hollo

2012-10-19 12:45

reporter   ~0000911

Hi,

I would really much like this feature as well.. but i dont want to enter all the informations for each munin url, can it be something like:

        $url = 'http://munin.example.com/munin/example.com/nagios.example.com/index.html';
        $has_munin = false;
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_NOBODY, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        $o = curl_exec($ch);
        curl_close($ch);
        if (preg_match("/200 OK/", $o)) {
                $has_munin = $url;
        }

        if ($has_munin !== false)
        {
                startPortlet ('munin');
                echo "<iframe frameborder=0 width='100%' height=600 src='$has_munin'></iframe>";
                finishPortlet ();
        }

That would be awesome..
hollo

hollo

2012-10-19 12:54

reporter   ~0000913

But i just started to look at the way cacti was implemented by now.. is that a requirement, then i can try to do that.. else, this would work really really good for me..

Please let me know if i have to do anything.
infrastation

infrastation

2012-10-19 14:13

administrator   ~0000915

If you could produce a patch implementing the Munin feature, that would be of a great help (with appropriate credits). I don't have any Munin installations to develop/test this against. And probably not the time right now. Looking at the code above, once the CURL call above succeeds, would it be better to print the retrieved HTML inline rather than generate an IFRAME?
hollo

hollo

2012-10-19 14:22

reporter   ~0000917

You are properly right, its better inline.. so if im looking for a solution:

1. add munin graphs in style with cacti
2. add list of graphs to view
  - load daily
  - mem daily
  - network load daily

<?php

$host = 'dev.example.com';

$munin_servers = getMuninServers();
$munin_images = getMuninImages();

if (count($munin_servers) > 0) {
  foreach ($munin_servers as $server) {
    if (curlCheckIfExistsOnHost($host, $server)) {
      $images = array();
      foreach ($munin_images as $image) {
        $images[] = $url.$image;
      }
    }
  }
}

renderStuff();

if thats something you like, i will be glad to add this.. but i really dont like to add support for each and every server, that will require SO much manually work to have munin enabled for all servers, i like some auto stuff?

let me know what you think.
infrastation

infrastation

2012-10-19 22:07

administrator   ~0000919

Well, I've had a talk with Munin people on IRC to understand their data model. Seems like the most reasonable way to implement this should include:

1. a list of Munin URIs (like the list of Cacti servers), with each URI standing for a different server and/or domain (group) on the server
2. a list of Munin graph names (load, cpu, memory etc)
3. a config option with RackCode telling if a host should have Munin graphs or not (see any _LISTSRC option for a reference and triggers.php)
4. a modification to renderObject() displaying an IMG element for each configured Munin graph
5. a Munin graph management tab on the object page, allowing the user to delete/modify configured graphs and add new graphs, with one SELECT for pre-configured URIs and another (or a text field) for graph name

Would you take care of this?
hollo

hollo

2012-10-20 11:32

reporter   ~0000921

Hi,

Well no problem.. i will properly have some questions about the code design when i get started.. but if you are up for helping me out once in a while.. i will make the extension?
infrastation

infrastation

2012-10-20 12:07

administrator   ~0000925

Fine, let's try. This bug is now yours, please try producing a working code by the next release, 0.20.2 is out (within next, say, 4 weeks). The source code is here: https://github.com/RackTables/racktables

I will provide some guidance, but keep in mind the guys on #racktables IRC channel on FreeNode may have answers to some of your questions faster.
hollo

hollo

2012-10-22 12:48

reporter   ~0000929

has made a pull request on github.
hollo

hollo

2012-10-22 12:50

reporter  

hollo

hollo

2012-10-22 12:50

reporter  

Issue History

Date Modified Username Field Change
2011-02-24 11:33 user205 New Issue
2011-02-24 11:33 user205 File Added: interface.php
2011-02-24 11:35 user205 Note Added: 0000272
2011-02-24 11:53 infrastation Relationship added related to 306
2011-07-26 13:13 infrastation Status new => assigned
2011-07-26 13:13 infrastation Assigned To => user105
2011-07-26 13:13 infrastation Note Added: 0000382
2012-10-18 10:38 infrastation Note Added: 0000881
2012-10-18 10:38 infrastation Assigned To user105 =>
2012-10-18 10:38 infrastation Status assigned => feedback
2012-10-18 10:50 infrastation Note Added: 0000883
2012-10-19 12:45 hollo Note Added: 0000911
2012-10-19 12:54 hollo Note Added: 0000913
2012-10-19 14:13 infrastation Note Added: 0000915
2012-10-19 14:22 hollo Note Added: 0000917
2012-10-19 22:07 infrastation Note Added: 0000919
2012-10-20 11:32 hollo Note Added: 0000921
2012-10-20 12:07 infrastation Note Added: 0000925
2012-10-20 12:07 infrastation Assigned To => hollo
2012-10-20 12:07 infrastation Status feedback => assigned
2012-10-20 12:07 infrastation Target Version => 0.20.2
2012-10-22 12:48 hollo Note Added: 0000929
2012-10-22 12:50 hollo File Added: 2012-10-22-124939_1312x956_scrot.png
2012-10-22 12:50 hollo File Added: 2012-10-22-125050_1312x956_scrot.png
2012-10-23 16:40 infrastation Status assigned => closed
2012-10-23 16:40 infrastation Resolution open => fixed
2012-10-23 16:40 infrastation Fixed in Version => 0.20.2