Ad Widget

Collapse

Display device names as text not images

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alpha777
    Junior Member
    • Sep 2007
    • 11

    #1

    Display device names as text not images

    Hi all,
    I would like to display the names of my devices as text as opposed to images. We have over 400 devices been monitored and it takes time to create all those images and display them. Anyone done this before?
    Thanks.
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    this could be an interesting thing to pursue.
    i was suggesting to replace it by single image, but that would probably have other performance problems, and it was pointed out that it would create even more problems with layout.

    rotating text in table cells seems a quite hard thing to do - for example, there's something doable with svg, but that wouldn't be compatible with all broswers probably.



    there is msie specific css method, but that is not an acceptable solution.

    if anybody knows how to do this in a standardized and cross-browser portable way, tell us
    Zabbix 3.0 Network Monitoring book

    Comment

    • Crazy Marty
      Member
      • Sep 2007
      • 75

      #3
      Perhaps the images can be stored in the DB once they've been generated the 1st time?

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        Originally posted by Crazy Marty
        Perhaps the images can be stored in the DB once they've been generated the 1st time?
        This would kill performance even more!
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • Niels
          Senior Member
          • May 2007
          • 239

          #5
          Originally posted by Alexei
          This would kill performance even more!
          Why? How exactly does this work?

          Comment

          • Niels
            Senior Member
            • May 2007
            • 239

            #6
            The file in question is vtext.php.

            Here's a first shot at a faster (about 10x) solution. The reason it's faster is mainly that I've removed all validation and security... No caching yet, but that's fairly easy with a writeable folder. Or maybe simply a clever header.

            Code:
            <?php
            
            /*
            ** ZABBIX
            ** Copyright (C) 2000-2005 SIA Zabbix
            **
            ** This program is free software; you can redistribute it and/or modify
            ** it under the terms of the GNU General Public License as published by
            ** the Free Software Foundation; either version 2 of the License, or
            ** (at your option) any later version.
            **
            ** This program is distributed in the hope that it will be useful,
            ** but WITHOUT ANY WARRANTY; without even the implied warranty of
            ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
            ** GNU General Public License for more details.
            **
            ** You should have received a copy of the GNU General Public License
            ** along with this program; if not, write to the Free Software
            ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
            **/
            
            /*
            ** Rewritten somewhat by Niels
            */
            
            
            function textToImg($text='', $font=3) {
            
            	//prepare image
            	$imgHeight	= imageFontHeight($font);
            	$imgWidth	= imageFontWidth($font) * strlen($text);
            	$img		= imageCreate($imgHeight, $imgWidth);
            
            	//find colors
            	$backgroundColor	= imageColorAllocate($img, 255, 255, 255);
            	$textColor			= imageColorAllocate($img, 0, 0, 0);
            
            	//make the image!
            	imageStringUp($img, $font, 0, $imgWidth-1, $text, $textColor);
            	imageColorTransparent($img, $backgroundColor);
            
            	//
            	return $img;
            
            }
            
            
            //check input
            if (!array_key_exists('text', $_GET)) {
            	return;
            }
            
            //make image
            $img=textToImg($_GET['text']);
            
            //send the image to the browser
            header("Content-type: image/png");
            imagePNG($img);
            
            ?>

            Comment

            • alpha777
              Junior Member
              • Sep 2007
              • 11

              #7
              I managed to remove images and replace with text doing the following:
              File: items.inc.php approx line 883
              Remove the following line $header=array_merge($header,array(new CImg('vtext.php?text='.$hostname)));

              and replace with
              $header=array_merge($header,array($hostname));

              Very basic hack but helped alot.

              Comment

              • Alexei
                Founder, CEO
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Sep 2004
                • 5654

                #8
                Originally posted by alpha777
                Very basic hack but helped alot.
                It helped to display all 400 hostnames horizontally? You must be having very large LCD screen...
                Alexei Vladishev
                Creator of Zabbix, Product manager
                New York | Tokyo | Riga
                My Twitter

                Comment

                • alpha777
                  Junior Member
                  • Sep 2007
                  • 11

                  #9
                  It would be wonderful if I could display vertically...
                  Any ideas out there would be welcomed.
                  I have tried and failed many times

                  Comment

                  • Niels
                    Senior Member
                    • May 2007
                    • 239

                    #10
                    Something like this might be slightly better for you:
                    Code:
                    $header=array_merge($header,array(implode('<br />', str_split($hostname))));
                    (not tested)

                    Comment

                    • Sypher
                      Junior Member
                      • Jan 2007
                      • 24

                      #11
                      I'm bumping this topic because vtext.php is IMHO a big performance hit. Why would you want to reload that many images over and over again?

                      Comment

                      Working...