Ad Widget

Collapse

Zabbix Frontend Blues

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bharathu
    Member
    • Dec 2005
    • 56

    #1

    Zabbix Frontend Blues

    Greetings to all,

    I have setup all the required s/w for the zabbix. I am running on Solaris 9. My SQL is running well along with Apache which is compiled with PHP. But even after the configuration of my "httpd.conf" file, i am unable to view the zabbix frontend.

    When I give the correct address (http://10.*.*.*/zabbix) of the frontend in my explorer i just get a text display as shown below...

    Index of /zabbix
    Parent Directory
    acknow.php
    actionconf.php
    actions.php
    alarms.php
    audio/
    audit.php
    bulkloader.php
    chart.php
    chart2.php
    chart4.php
    chart5.php


    And when i click on any of the above links (for example "chart.php") then i get the following error in my internet explorer page

    Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (13) in /export/home/zabbix/html/include/db.inc.php on line 38

    Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (13) in /export/home/zabbix/html/include/db.inc.php on line 39

    Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /export/home/zabbix/html/include/db.inc.php on line 39
    Error connecting to database [Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (13)]



    Can anyone some some insights on why this is happening? Both my SQL server and apache 2.2 are still running. Is it any problem with the PHP compilation along with apache?

    Waiting for reply...

    Regards,
    Bharadwaj
    Last edited by Bharathu; 20-03-2007, 16:41. Reason: forgot to include OS details
  • Bharathu
    Member
    • Dec 2005
    • 56

    #2
    Settings in HTTPD.CONF File

    Hi All,

    Please guide me if my settings are correct in the httpd.conf file. I am working on Solaris 9!!


    Listen 80 (shud this be <server ip:80> like 10.*.*.*:80 ??)

    LoadModule php4_module modules/libphp4.so

    ServerName 10.*.*.* (gave the actual server IP... is port "80" also required??)

    I am not using the following Directory setting as I have used this within the VirtualHost setting.

    #<Directory /export/home/zabbix/html>
    # Options FollowSymLinks
    #AllowOverride None
    #Order deny,allow
    #Allow from all
    #</Directory>



    Alias /zabbix /export/home/zabbix/html/
    <Directory /export/home/zabbix/html/>
    Addhandler php-script .php .htm .html
    </Directory>


    AddType application/x-httpd-php .php .phtml
    AddType application/x-httpd-php-source .phps


    <VirtualHost *:80>
    ServerName 10.*.*.*
    DocumentRoot /export/home/zabbix/html
    #<Location />
    # Options Indexes
    #</Location>
    <Directory "/export/home/zabbix/html">
    AllowOverride None
    Options Indexes
    Order Allow,Deny
    Allow from all
    </Directory>
    </VirtualHost>


    Can you loook into my config file settings and let me know if I have gone wrong anywhere? I used a <Directory> setting within <VirtualHost> setting... is it advisable to use like that? Or shud i have explicit <Directory> settings?

    Regards,
    Bharadwaj

    Comment

    • James Wells
      Senior Member
      • Jun 2005
      • 664

      #3
      Greetings,
      Originally posted by Bharathu
      Listen 80 (shud this be <server ip:80> like 10.*.*.*:80 ??)
      Nope, this is correct as is. This entry just tells Apache what port to listen to and only needs an IP if your host is multi-homed and you only want to listen to a specific IP address.

      LoadModule php4_module modules/libphp4.so
      Here I would have to ask what version of Apache you are running. If you are running a pre 1.3 Apache, then this should work fine, however, if you are using a 1.4 or 2.x Apache, you will also need to pass -DPHP4 to Apache on startup, to tell it to use this module. By Default Apache will load the module, but not initialize it without the define there.

      ServerName 10.*.*.* (gave the actual server IP... is port "80" also required??)
      This is correct as is. You only need to specify the port if you are using a port other than the port as assigned above on the Listen line. I should point out that it is preferred that you use a hostname here instead of an IP. The only time you should use an IP addres is if your machine is multi-homed and you want to use a specific IP address.

      Alias /zabbix /export/home/zabbix/html/
      <Directory /export/home/zabbix/html/>
      Addhandler php-script .php .htm .html
      </Directory>
      You should probably add the following line in here as well;
      Code:
      AddDirectoryIndex index.php index.phtml
      This will tell Apache to process index.php files as your index pages so that the index.php can replace index.html

      Everything else looks correct. Now on to your first post;
      When I give the correct address (http://10.*.*.*/zabbix) of the frontend in my explorer i just get a text display as shown below...
      This is covered by the AddDirectoryIndex option above. Without that entry, Apache looks for files called index.html index.htm and if it does not find them, it assumes that you want a directory list instead of a web page.

      And when i click on any of the above links (for example "chart.php") then i get the following error in my internet explorer page

      Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (13) in /export/home/zabbix/html/include/db.inc.php on line 38
      Generally, this indicates that you are trying to connect to MySQL on the local machine, but that MySQL on the local machine is not configured correctly. When you tell Zabbix to use localhost for the DB server, the PHP code will attempt to open the MySQL socket file called /var/tmp/mysql.sock, or /tmp/mysql.sock. This is actually controlled in two places, the command line arguments for MySQL and your my.cnf file.

      In your my.cnf file, the entry you are looking for is 'Socket'. This tells clients where to look for the MySQL socket, and in your command line it will be --socket. Please make sure that these two match then restart Apache and possibly MySQL.

      Personally, I recommend against using Zabbix with a localhost DB connection, even if you are running on the same system. Instead, my preference is to always use a TCP/IP connection to make it easier to move the UI and server where I want them.
      Unofficial Zabbix Developer

      Comment

      • Bharathu
        Member
        • Dec 2005
        • 56

        #4
        Hi,

        Thanks for the reply... I was trying the AddDirectoryIndex command in my config file but i am getting this error while restarting my Apache 2.2 server.

        "Syntax error on line 274 of /usr/local/apache2/conf/httpd.conf:
        Invalid command 'AddDirectoryIndex', perhaps misspelled or defined by a module not included in the server configuration"



        Can you tell me the exact syntax? Thanks a lot for ur help once again

        Comment

        • James Wells
          Senior Member
          • Jun 2005
          • 664

          #5
          Originally posted by Bharathu
          Thanks for the reply... I was trying the AddDirectoryIndex command in my config file but i am getting this error while restarting my Apache 2.2 server.
          That should work with your version of Apache.... Okay, try this, instead;
          Code:
          DirectoryIndex index.php index.phtml
          Unofficial Zabbix Developer

          Comment

          • Bharathu
            Member
            • Dec 2005
            • 56

            #6
            Greetings,

            Originally posted by James Wells

            Here I would have to ask what version of Apache you are running. If you are running a pre 1.3 Apache, then this should work fine, however, if you are using a 1.4 or 2.x Apache, you will also need to pass -DPHP4 to Apache on startup, to tell it to use this module. By Default Apache will load the module, but not initialize it without the define there.
            Can you explain give me the sytax for passing the DPHP4 to Apache? I never came across this.

            Comment

            • James Wells
              Senior Member
              • Jun 2005
              • 664

              #7
              In Apache 2.x, you need to define which modules to load at run time. You do this by passing various defines on the command line. Some of the notable ones are;
              • -D PHP4 -- This says to load the PHP 4 module
              • -D INFO -- Enable mod_info, used mostly for debugging.
              • -D SSL -- Loads SSL module.
              • -D PHP5 -- Load the PHP 5 modules.

              There is a rather large list of others in the Apache documentation.
              Unofficial Zabbix Developer

              Comment

              • Bharathu
                Member
                • Dec 2005
                • 56

                #8
                Frontend 99% success

                Greetings,

                My frontend started working after I added the "DirectoryIndex" tag. I also made the path for the mysql.sock file consistent everywhere (ie in the files my.cnf and zabbix_server.conf). I have taken the path as /var/tmp/mysql.sock

                Now my next question is should I explicitly complile PHP along with GD support? i am using PHP 4.4.6. during ./config i did not specify "--with-gd" tag. is it required?

                can anyone give the exact tag for enabling the GD module support for PNG/JPEG file support?

                Thanks

                Comment

                • Bharathu
                  Member
                  • Dec 2005
                  • 56

                  #9
                  -d Php4

                  Greetings,

                  Firstly thanks for the reply.

                  Originally posted by James Wells
                  In Apache 2.x, you need to define which modules to load at run time. You do this by passing various defines on the command line. Some of the notable ones are;
                  • -D PHP4 -- This says to load the PHP 4 module
                  • -D INFO -- Enable mod_info, used mostly for debugging.
                  • -D SSL -- Loads SSL module.
                  • -D PHP5 -- Load the PHP 5 modules.

                  There is a rather large list of others in the Apache documentation.
                  Should I be using these while using the command

                  Code:
                   ./apachectl start
                  or during the apache configuration?

                  Currently my front end is getting displayed ..but i am not able to see the graphs. is it becoz of GD module missing?

                  Comment

                  • Bharathu
                    Member
                    • Dec 2005
                    • 56

                    #10
                    GD Required for graphs

                    Hi all,

                    I solved the problem where my graphs were not getting displayed. It was due to the missing GD module in PHP.

                    I had to fist install LIBPNG (libpng-1.2.16.tar) and ZLIB (zlib-1.2.3.tar) and then I used the line (--with-gd) in configure for PHP.

                    After I did that... my ghraphs were getting displayed. I hope this information will be helpful for others too.

                    Comment

                    • tronite
                      Senior Member
                      • Jun 2007
                      • 147

                      #11
                      Originally posted by James Wells
                      In Apache 2.x, you need to define which modules to load at run time. You do this by passing various defines on the command line. Some of the notable ones are;
                      • -D PHP4 -- This says to load the PHP 4 module
                      • -D INFO -- Enable mod_info, used mostly for debugging.
                      • -D SSL -- Loads SSL module.
                      • -D PHP5 -- Load the PHP 5 modules.

                      There is a rather large list of others in the Apache documentation.
                      When I type apach --version I get an error and when I search for apache on yumex I don't find it.

                      Comment

                      Working...