设为首页 收藏本站
查看: 1254|回复: 0

[经验分享] The Cacti Manual

[复制链接]

尚未签到

发表于 2015-11-22 14:03:33 | 显示全部楼层 |阅读模式
  http://bsod2600.home.comcast.net/~bsod2600/install_windows.html
  The Cacti Manual

Prev

Next


Chapter 3. Installing Under Windows


Last updated: July, 2009



  • Installations
  • Patching
  • Configuration

  • Troubleshooting

  • Optimizations
  • FAQ



Downloads

Required:


  • Cacti
    .  
    Latest version available.
  • RRDTool
    .
    Minimum version: 1.0
    . Recommended: 1.2.26 Win32 Build
    .

    Note: Cygwin build for versions before 1.2.15 are required. Win32 build
    should work fine after 1.2.15.
    Note: RRDTool 1.3.x is only supported in Cacti 0.8.7c
    or later.
  • PHP
    .
    Minimum: 4.3.6
    .  Recommended: 5.2
    .x  Download the
    installer.

  • MySQL
    . Minimum:
    4.1
    .  Recommended: 5.0.x
      Download the Windows MSI Installer file, NOT Windows Essentials.
    Note: MySQL 5 is only supported in Cacti 0.8.6i or later.
  Optional:


  • Spine
    . Latest
    version available.
  • Cygwin
    . Recommended: 1.5.x
      Download setup.exe
    .
  • Apache
    .  Minimum
    version: 2.0
    . Recommended version: 2.2.x
    .  Download the
    MSI installer.

  • Net-SNMP
    .
    Minimum: 5.3.1
    .  Recommended: 5.4
    .x Download the Win32
    installer.

  • Cacti-Security
    script to configure NTFS permissions automatically for you.  Xcacls
    will be needed.


Back to Top

  

Installations


  Log on as an Administrator and install the following pieces of software.
  
  Cacti
Recommended Install Path:

C:/Inetpub/wwwroot/cacti/



  • Extract the cacti zip file to the root of your web server directory.  This will be
    c:/inetpub/wwwroot
    if you are using the default installation of IIS. The extracted directory will be called
    cacti-0.8.7e
    . Rename it to cacti
    .
  
  PHP
Recommended Install Path:
C:/PHP/
Note: Do not install into a path containing spaces (i.e.
C:/Program Files/PHP/).
Note: PHP 5.2.10 and later dropped ISAPI support in favor for FastCGI.



  • Double-click on the php installer to start it running.

  • Click Next
    to the welcome page.
  • Click I Agree
    to accept the license agreement.
  • At the Destination Folder page, change the path to:
    C:/PHP/
    and click Next
    .
  • At the Web Server page:

    • PHP 5.2.9 or earlier: select IIS ISAPI Module
      and click Next
      .
    • PHP 5.2.10 or later: select IIS FastCGI
      and click Next
      .


  • At the Choose Item page, do the following:
  • Click on the Program folder and select entire
    feature will be installed on local hard drive

    . The icon
    should now be white.
  • Click on the Script Executable folder and select entire
    feature will be installed on local hard drive

    . The icon
    should now be white.
  • Under the Extensions folder, select MySQL
    ,
    SNMP
    , and Sockets
    to be
    installed. If you want to use  LDAP authentication in Cacti, also enable the LDAP
    extension.


  • Click Next
    .
  • Click Install
    .
  • Once done installing, click Finish
    .


  • Create new folders under C:/PHP/
    called
    Uploadtem, Session
    and MIBS
    .
  • Move the contents of the C:/usr/mibs/
    folder to
    C:/PHP/Extras/mibs/
    .


      MySQL
    Recommended Install Path:
    C:/MySQL/



    • Extract the MySQL zip file to a temporary directory (e.g. C:/Temp) and run the
      Setup.exe
      file.

    • At the Welcome screen, click Next
      .
    • At the Setup Type screen, select Custom
      and click
      Next
      .
    • At the Custom Setup screen for component selection, leave the
      defaults.
    • At the bottom of the page, click on Change...
      and alter the destination
      folder to be C:/MySQL/
      and click
      OK

      .
    • Click on Next
      .
    • Click Install
      to proceed with the installation.
    • Close the MySQL Enterprise screen.
    • At the Wizard Completed screen, leave Configure MySQL Server now
      checked and click Finish
      .


  • MySQL Service Instance Configuration Wizard
  • At the Welcome screen, click Next
    .
  • At the MySQL Service Instance Configuration screen, select Detailed Configuration
    and click
    Next
    .
  • At the server type screen, select Server Machine
    and click
    Next
    .
  • At the database usage screen, select Non-Transactional Database Only
    and click
    Next
    .
  • At the concurrent connection screen, select Decision Support OLAP
    and click
    Next
    .
  • At the networking options page, check Enabled TCP/IP
    networking

    and leave default port 3306.  Uncheck
    Enable Strict Mode
    .  Click Next
    .
  • At the default character set page, select Standard Character Set
    and click
    Next
    .
  • At the Windows options page, check Install as Windows
    Service

    and Include Bin Directory in Windows PATH
    . Click
    Next
    .
  • At the security options page, type in a root password.  Click
    Next
    .
  • At the Ready to execute page, click on Execute
    .
  • Click on Finish
    .


      
      RRDTool
    Recommended Install Path:
    C:/RRDTool/



    • Extract the rrdtool zip file to C:/RRDTool/.
      
      Now at this point you have enough installed to configure and test before adding further complication
    and problems.  Continue on to the patching
    section.
      
      
    Installations - Optional Components

      These various components are not required for Cacti to function.  Some
    are a choice of preference or performance.
      
      Spine
    Recommended Install Path:

    C:/Spine/
    Information:
    Spine is a poller for Cacti that primarily
    strives to be as fast as possible. For this reason it is written in native C,
    makes use of POSIX threads, and is linked directly against the net-snmp library
    for minimal SNMP polling overhead. Spine is a replacement for the default
    cmd.php poller so you must decide if using Spine makes sense for your
    installation.  It is highly recommended that users start out with the
    default cmd.php poller until their installation is fully functional!  
    Cactid was renamed to Spine for the 0.8.7 release.
      Cactid is for Cacti 0.8.6 and below.
    Spine is for Cacti 0.8.7 and above.


    • Extract the spine zip file to C:/Spine/
      WARNING:

    Spine is only compiled
    with Cygwin and thusly needs a few Cygwin dlls on the system.  These are
    included with the downloaded zip file.  This can become a problem if
    RRDTool is also compiled under a different Cygwin version, since then there will
    be different Cygwin dll versions on the system which can cause issues.  If
    you're using a Win32 build of RRDTool, then nothing to worry about.  There
    are a few ways to solve the problem:


    • Install a base install of Cygwin and delete all cygwin files from the
      RRDTool and Spine folders.
    • Move RRDTool and Spine into the same folder, so they share the Cygwin
      dlls.  Your mileage may vary due to each binary being compiled against
      a different Cygwin version.
      
    Cygwin
    Recommended Install Path: C:/Cygwin/
    Information:
    Cygwin is a Linux-like environment for Windows.  
    The benefit of having Cygwin installed is so there that there are only one
    set of Cygwin dlls on the system.  Both RRDTool and Spine come with
    cygwin dlls and can cause version conflicts.  If you plan on compiling
    RRDTool or Spine, Cygwin is required.



    • Run setup.exe.
    • Once you reach the portion of setup entitled Select Packages
      , install the following:
      Base (whole thing)
      Libs
      libart_lgpl
           libfreetype26
      libintl3
           libpng12
      readline
           zlib
      Utils
      patch
      Web
      wget
    • Add c:/cygwin/bin
      to your system path.
    • Move setup.exe
      to c:/cygwin
      for future use.
      
      Apache
    Recommended Install Path:
    C:/Apache2/
    Note: Do not install into a path containing spaces (i.e.
    C:/Program Files/Apache/) unless you're prepared to deal with 8.3 filenames.
    Information:
    Using Apache instead of IIS is purely preferential
    as Cacti works with either.  


    •   
      If planning on using Apache, it should be installed before installing PHP.

    •   Make sure you have stopped & disabled all IIS services before you proceed with the Apache installation.

    • Run the apache setup msi file

      • At the Welcome screen, click Next
        .
      • At the license agreement screen, select I Accept
        and click Next
        .
      • At the Read this first page, click Next
        .
      • At the Server Information page, enter in the network domain, server
        name and email (if applicable) and click Next
        .
      • At the Setup type page, select Typical
        and click
        Next
        .
      • At the Destination folder page, click on Change...
        .  
        Change the folder name to C:/Apache2/
        . Click
        OK
        and then Next
        .
      • Click Install
        .
      • Click Finish
        to close the installer.


      
      Net-SNMP
    Recommended Install Path:
    C:/Net-SNMP/
    Information:
    If PHP 5.2 is not installed, then Net-SNMP should
    be installed.  If you plan to use any hosts with SNMP v3 support, you must install the Net-SNMP
    binaries,
    since the PHP SNMP extension does not handle SNMPv3.  You do NOT
    need to install/use the Net-SNMP SNMP agent. The Microsoft SNMP agent is
    recommended.  The Net-SNMP binaries are useful when creating custom
    scripts, as they provide an easy way to query SNMP data from devices.


    • Run the net-snmp installer

      • At the Welcome page, click Next
        .
      • At the license agreement page, select I Agree
        and
        click Next
        .
      • At the Components page:

        • Check Base Components
          .
        • Under Net-SNMP Agent Service, check With Windows
          Extension DLL support

          .
        • Uncheck
          Net-SNMP trap service
        • Uncheck
          Perl SNMP modules
        • Uncheck
          Development files


      • Click Next
        .
      • At the Installation location page, change the destination folder to
        C:/Net-SNMP/
        .  Click Next
        .
      • At the Start menu folder location page, leave the default and click
        Install
        .
      • Once done installing, click Finish
        .


      


    Back to Top

      
      
    Appling Patches





    • There are two methods of applying patches to Cacti:

      • If you have Cygwin installed (installation instructions further down in this guide), then the patch instructions
        which use wget and patch, will work.
      • The other method requires you to visit http://www.cacti.net/downloads/patches/<cacti version>/pre-patched/
        and manually download and replace the patched files.


    • You
      must reapply file/folder security on the files patched, due to the fact they
      will not likely inherit the correct permissions. Double check they are correct.


    Back to Top

      

    Configuration
      PHP:



    •   Verify the PHP installer properly added
      C:/PHP/
      to your Windows PATH environment variable.

      •   The Windows path variable can be accessed via the Control Panel at: System | Advanced
        |
        Environment Variables


      •   In the System Variables groupbox, find Path
        and
        click Edit
        .  Make sure C:/PHP
        / is in there
        somewhere.



    •   Verify the PHP installer properly added a new system variable called
      PHPRC
      . Its value should be C:/PHP/
      .

    •   Add a new system variable called MIBDIRS
      .  
      Its value should be C:/PHP/Extras/mibs



      •   Refer to step 1 on the location of the System Variables

      •   Under the System variables groupbox, click on New
        .

      •   In the Variable name field, type MIBDIRS
        .

      •   In the Variable value field, type
        C:/PHP/Extras/mibs




      •   Click OK
        and close the dialog boxes.



    •   
      Find and then uncomment/modify the following lines in C:/PHP/php.ini
      .

      fastcgi
      .impersonate = 1


      register_argc_argv = On
      safe_mode = Off
      cgi
      .fix_pathinfo = 1


      cgi.force_redirect = 0
      upload_tmp_dir = &quot;C:/PHP/Uploadtemp
      &quot;
      session.save_path=&quot;C:/PHP/Session&quot;
    •   The
      following resource limits should be changed from their defaults.  
      Depending on the scripts, amount of data being returned and number of devices you use, they might need to
      be further increased at a later period in time.

      max_execution_time = 60 ; Maximum execution time of each script, in seconds
      max_input_time = 120 ; Maximum amount of time each script may spend parsing request data
      memory_limit = 128M ; Maximum amount of memory a script may consume (8MB)
    •   If
      you have had previous versions of PHP installed, you had likely moved
      the PHP system files to in the Windows directory structure. If so, you
      will have to remove those files. Please review your PHP installation
      documentation for instructions on removing those files.

    •   Change NTFS permissions on C:/PHP/Uploadtemp
      and C:/PHP/Session
      to grant Modify
      rights to the IUSR_
      and IIS_WPG
      users
      for only files in the directory.

    • Give the user who will be running the scheduled task,
      Modify
      rights to:
      c:/php/extras/mibs/.index
      
      IIS:

      Instead of retyping all the instructions configuring PHP for FastCGI, please read the following links. For IIS 7, read this link
    . For IIS 5.1 and 6, read this link
    .
      
      The instructions below are for older PHP versions which use the
    ISAPI module. FastCGI users will still need to follow the bottom half
    of the instructions though, just disregard the php5isapi.dll stuff.
      Note:  IIS6  has the IIS_WPG user account. IIS7 it's called IIS_USRS.



    •   Start the Internet Information Services (IIS) Manager, right click on
      Default Web Site
      and select Properties
      .

    •   Under the ISAPI Filters
      tab:

      •   Click on Add
        .

      •   In the Filter Name field, type: .php
        .

      •   In the Executable field, click on Browse...


      •   Navigate to C:/PHP/php5isapi.dll
        .

      •   Click OK
        .



    •   Under the Home Directory
      tab:

      •   Verify the PHP installer created a mapping for the .PHP
        extension

        to C:/PHP/php5isapi.dll
        .

      •   Verify the .PHP mapping has All Verbs
        and
        Script Engine

        checked.



    •   Under the Documents
      tab, add index.php
      to the list.

    •   Click OK
      to close the Default Website Properties window.

    • If using IIS6, go to Web Service Extensions
      and add a new Web Service Extension
      .
      Name the extension php
      , click Add
      and browse to C:/PHP/php5isapi.dll
      ,  enable Set Extension status to Enable
      , and click
      OK
      .
    • Under the Default Web Site
      , right click on
      Cacti
      folder and select Properties
      .

      • Click on the Documents
        tab
      • Click on Add...
        .
      • In the Default Document Name field, type in: index.php
        and click OK
        .
      • Select index.php
        in the default document list
        and move it to the top.
      • Click OK
        to close the cacti properties window.


    • Give the COMPUTERNAME/IUSR_
      and COMPUTERNAME/IIS_WPG
      users
      R
      ead & Execute
      permissions to the file
      C:/Windows/system32/cmd.exe
      .   Yes, this can be a large
      security hole, but it's required so RRDTool can be launched for graphing by
      the anonymous web account.  For slightly improved security, one can
      specify a separate custom User account which would be used for the /wwwroot/Cacti/
      site.  Then, instead of using IUSR_ everywhere throughout this
      document, replace it with the custom User account.  This way, only a
      security hole in Cacti's code could exploit cmd.exe and not all sites on the
      IIS server.

      • Right click on cmd.exe
        and select
        Properties
        .
      • Click on the Security
        tab.
      • Select the IUSR_
        account
      • Click on Read & Execute
        in the Permissions box.
      • Repeat for the IIS_WPG user.
      • Click OK
        .


    • Both IUSR_ and IIS_WPG users will also need read permissions on
      C:/Inetpub/wwwroot/cacti/
      and its subfolders.

      • Right click on the folder C:/Inetpub/wwwroot/cacti

        and select Properties
        .
      • Click on the Security
        tab.
      • Click on Add...
        under the group or user names
        section.
      • Type in IUSR_
        COMPUTERNAME or click Advanced...
        and Find Now.  Repeat for the IIS_WPG account.
      • Click OK
        to close the select users or groups
        window.
      • Select the IUSR_
        COMPUTERNAME from the list.
      • Select Read & Execute
        from the Permissions box.
      • Repeat for the IIS_WPG account.
      • At the bottom of the Security tab, click on Advanced...
        .
      • In the Permissions tab, click on Replace permissions
        entries on all child objects with entries shown here that apply to
        child objects

        .
      • Click OK
        .
      • Click Yes
        to the Security warning dialog box.
      • Click OK
        to close the properties window.


    • Give the IUSR_
      and IIS_WPG
      users modify
      permissions to the folders
      C:/Inetpub/wwwroot/cacti/log
      and C:/Inetpub/wwwroot/cacti/rra
      .
    •   Completely stop and start the IIS service using the following commands
      from the command prompt.  Alternatively, use the Service MMC
      snap-in under Administrative Tools.

      net stop iisadmin

      net start w3svc
    • Verify PHP is functional by running: php -m
      at the command prompt.
      Note: If messages with, Cannot find module
      appearing, then there is
      something wrong with the MIBDIRS variable or missing mib files in the
      PHP/Extras/mib folder.  Make sure the MySQL, SNMP and Sockets PHP
      modules are in the list.
      c:/>
      php -m

      [PHP Modules]
      bcmath
      calendar
      com_dotnet
      ctype
      date
      dom
      filter
      ftp
      hash
      iconv
      json
      libxml
      mssql
      mysql

      odbc
      pcre
      Reflection
      session
      SimpleXML
      snmp

      sockets

      SPL
      standard
      tokenizer
      wddx
      xml
      xmlreader
      xmlwriter
      zlib

      [Zend Modules]
      
      RRDTool



    • If you plan on installing Cygwin, remove
      all DLL files from the C:/rrdtool directory.  Otherwise,
      nothing to configure.
      
      MySQL



    •   
      Stop the MySQL service.

    •   Edit your C:/MySQL/my.ini
      file

    •   Verify you don't have a sql-mode
      defined.  If so,
      comment it out.

    • You will need to apply the old client
      hack for user authentication to work with Cacti.

      • Add the following to the [mysqld] sub-section:
        #Use old password encryption method (needed for 4.0 and older clients).
        old-passwords


    •   Start the MySQL service.

    •   Set a password for the root user (if not set already during MySQL installation)

      c:/>

      mysqladmin --user=root password somepassword

      c:/>
      mysqladmin --user=root --password reload
    •   Create the MySQL database:

      c:/>
      mysqladmin --user=root --password create cacti
    •   Import the default Cacti database:

      c:/>
      mysql --user=root --password cacti < c:/inetpub/wwwroot/cacti/cacti.sql



      Note: If you get any errors during this
      phase, you likely have sql-strict mode enabled or something else
      misconfigured in my.ini!
    •   Create a MySQL username and password for Cacti.

      c:/>
      mysql --user=root --password mysql

      mysql>
      GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipw';

      mysql>
      flush privileges;
    • You will also need to update the cactiuser account with the old password style:
      mysql>
      UPDATE mysql.user SET Password = OLD_PASSWORD('cactipw') WHERE Host = 'localhost' AND User = 'cactiuser';

      mysql>
      FLUSH PRIVILEGES;

      mysql>
      exit
      

    Cacti

    • Reboot your server.  Some times environment variables and services need to be reset in order for everything to work properly.
    •   Edit c:/inetpub/wwwroot/cacti/include/config.php
      and specify the MySQL user, password and database for your Cacti configuration.

      $database_default = &quot;cacti&quot;;
      $database_hostname = &quot;localhost&quot;;
      $database_username = &quot;cactiuser&quot;;
      $database_password = &quot;cactipw&quot;;

    •   Point your web browser to http://localhost/cacti/
      You should be presented with the Cacti Installation Guide
      page.

    • Click Next
      .
    • Select New Install
      for the type of installation.  
      Click Next
      .
    • Verify the RRDTool, PHP, Cacti Log File, paths and RRDTool Utility
      version are all correct.  Ignore the Net-SNMP paths unless it was
      previously installed. Click Finish
      .
    • At the User Login page,
      log in the with a username of admin
      and password of
      admin
      . You will be required to change this password immediately.
      Note: If you are brought back to the User Login
      page with no error messages, then you have have a PHP session/cookie
      problem.
    • Once logged in, click on Settings
      and then the Paths
      tab. Verify/update your paths to point to the correct locations.
      Recommended examples are posted below.  If you plan on using Spine in
      the future, then it is very important that your all your paths and
      scripts use forward slashes. Additionally, RRDTool 1.0 used a
      mono-spaced font while RRDTool 1.2 defaults to variable width font.
      Using the latter will cause graph text to not align properly. That
      being the case, a solution is to specify a mono-spaced font like
      VeraMono or DejaVuSansMono-Roman in the RRDTool Default Font Path (i.e.
      C:/windows/fonts/VeraMono.ttf
      ).  
      Google for these fonts, as they don't come with Windows.  
      PHP Binary Path:


      c:/php/php.exe
        RRDTool Binary Path:


      c:/rrdtool/rrdtool.exe
        RRDTool Default Font Path:


      c:/windows/fonts/arial.ttf
        RRDTool Version:


      Select the appropriate version
        SNMPGET, SNMPWALK, SNMPBULKWALK, SNMPGETNEXT Paths:


      c:/net-snmp/bin/snmpget.exe
      c:/net-snmp/bin/snmpwalk.exe
      c:/net-snmp/bin/snmpbulkwalk.exe
      c:/net-snmp/bin/snmpgetnext.exe
        Cacti Logfile Path:


      c:/inetpub/wwwroot/cacti/log/cacti.log
        Spine Path:


      c:/Spine/Spine.exe
    • Click on Devices
      . Delete Localhost, since it's set up to use the Linux host template.
    • In the upper right corner, click on Add
      .   Fill in the following information and then click
      Add
      .
      Description: localhost


      Hostname: localhost


      Host Template: Windows 2000/XP
    • You
      should now be looking at the localhost device screen.  Right under it's
      name, there should be some SNMP Information listed regarding the
      system, uptime, hostname, location and contact.  If not, you should
      double check the SNMP settings on the server and firewall settings.  In
      the upper right-hand corner, click on Create Graphs for this Host
      .
    • On the following screen, select a disk partition and network interface.  At the bottom of the page, click on
      Create
      .
    • Log
      into the user account you'll be using  for the scheduled task
      and verify starting a Cacti polling cycle works.  Do this by running
      the following from the command prompt:
      php c:/inetpub/wwwroot/cacti/poller.php
      The output should look something like this after several command windows pop up:
      C:/>
      php c:/inetpub/wwwroot/cacti/poller.php

      10/28/2009 04:57:12 PM - SYSTEM STATS: Time:1.7272 Method:cmd.php Processes:1 Threads:N/A Hosts:1 HostsPerProcess:2 DataSources:4 RRDsProcessed:2
      After this has ran once, you should have cacti.log
      in
      /cacti/log/
      and rrd files in
      /cacti/rra/
      .
    •   You are going to need to schedule a task while logged on as an Administrator account, so
      poller.php
      can run every 5 minutes. Make sure the Task Scheduler service is started and follow the steps below to begin.

      •   Select Start
        -->
        Settings
        --> Control Panel
        and double click on
        Scheduled Tasks
        .

      •   Double click on Add Scheduled Task
        .

      •   Click Next
        and
        Browse
        on the following screen. Find
        c:/php
        and select php.exe
        . Choose
        Daily
        on and click
        Next
        .

      •   Click Next
        again without changing the time or date settings.

      •   When entering a username and password make sure the user has
        modify
        permissions to the following directories:

        c:/inetpub/wwwroot/cacti/rra/
        c:/inetpub/wwwroot/cacti/log/
          Make sure the user has Read & Execute
        permissions to the following directories:

        c:/php/
        c:/inetpub/wwwroot/cacti/
        c:/rrdtool/
      •   Click Next
        and
        Finish
        to close the wizard.

      •   Right click on the task you just created, and select
        Properties
        .

      •   Select the Schedule
        tab.

      •   Make sure Daily
        is selected and click the
        Advanced
        button.

      •   Check the Repeat
        checkbox, set the repetition for every 5 minutes, set the duration for 24 hours, and check
        the If the task is still running, stop it at
        this time
        checkbox.

      •   Click OK


      •   In the Run
        textbox enter the following text making sure to use the appropriate paths.

        c:/php/php.exe c:/inetpub/wwwroot/cacti/poller.php
          The start in box should say c:/inetpub/wwwroot/cacti
        .



    •   After waiting 10 minutes (aka 2 polling cycles), one should be able
      to view the graphs.

    •   Go to Graph Management
      and click on
      each graph to view its progress.

    •   Go to Graph Trees
      and click on
      Default Tree
      .

    •   Click on Add
      .

    •   Under Tree Item Type,
      select
      Host

      . Click on Create
      and then
      Save
      .

    •   View the new graph tree by clicking on the
      Graphs
      tab at the top of the screen.

      
    Configuration - Optional Components

      Apache:



    •   Add the following lines to your httpd.conf
      file in the c:/apache2/conf
      directory:

      LoadModule php5_module &quot;c:/php/

      php5apache2_2.dll&quot;

      AddType application/x-httpd-php .php
      PHPIniDir &quot;C:/php&quot;


      DirectoryIndex index.php index.html index.htm
    • Restart the Apache service.
      
      Net-SNMP



    •   Append the MIBDIRS
      system variable with the path of
      Net-SNMP MIB files.

      MIBDIRS=c:/php/extras/mibs;C:/Net-SNMP/share/snmp/mibs


    Spine


    •   Modify the Spine.conf
      file in c:/Spine
      to include the following statements.

      DB_Host      IP Address or Hostname (not localhost)
      DB_Databasecacti
      DB_User      cactiuser
      DB_Password cactipw
      DB_Port     3306
    •   If you have Cygwin
      installed, remove the DLL files from the c:/Spine
      directory.

      


    Back to Top

      
      
    Troubleshooting:




    • If
      you're not getting any graphs or rrd files created, it's possibly
      because Cacti is not collecting valid data. You must wait at least two
      polling cycles for data to show up in a graph. To check if Cacti is
      collecting valid data from your device in question, do the following:

      • Turn the Poller Logging Level
        in Cacti to debug (Settings | Polling level) for one cycle, wait for Cacti to run
      • This is an example of a successful SNMP query:
        CMDPHP: Poller[0] Host[2] DS[18] SNMP: v1: 192.168.100.1, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.1, output: 322328722
        CMDPHP: Poller[0] Host[2] DS[18] SNMP: v1: 192.168.100.1, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.1, output: 426701050
        If the output was NaN, then Cacti did not collect any data. This is where either the Net-SNMP tools or
        GetIF
        comes in handy for testing SNMP.
      • Test
        if you're able to retrieve SNMP data manually using the OID Cacti
        failed on. You might need to remove the last number from the OID when
        doing this. For example, in the case of retrieving interface data,
        instead of using .1.3.6.1.2.1.2.2.1.10.1 in the example above, you
        should snmpwalk .1.3.6.1.2.1.2.2.1. Using Net-SNMP snmpwalk, you would
        do:
        C:/net-snmp/bin>snmpwalk -v 1 -c public 192.168.2.1 .1.3.6.1.2.1.2.2.1
      • If
        you still receive no SNMP output, then you either didn't properly
        configure the SNMP agent or there is a firewall blocking the data.


    • Another thing you'll want to look for
      in the log file are CACTI2RRD entries. These are when Cacti updates the
      rrd files with the data it collected during a polling cycle. Here is an
      example of one from my traffic collected from above:
      POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:/inetpub/wwwroot/cacti/rra/cable_modem_traffic_1.rrd --template traffic_out:traffic_in 1141333802:322328722:426701050
    • If
      you saw in the log file Cacti updating the rrd file, but the
      modification date never changed on the rrd file, then you have a
      permission problem somewhere. Check the IUSR and IIS_WPG user accounts
      have read/execute rights on rrdtool.exe and cmd.exe. They'll also need
      modfiy rights to the /cacti/rra
      and
      /cacti/log
      folders.
    • Follow this guide
      on
      debugging NaN's.




    Back to Top

      
      

    Optimizations:


    There are several things you can do to speed up your Cacti web server.  It's suggested that you only apply these
    after
    you have a fully functional Cacti installation.


    • Switch the polling agent in Cacti from cmd.php to
      Spine.exe.  Go to Settings
      | Poller
      | Type
      .  
      Don't forget to configure your C:/Spine/Spine.conf
      file.
    • Install the Zend Optimizer
      for PHP.
    • Set up the query cache in MySQL.  Read about how to properly configure the settings
      .  You will need to stop the MySQL service when you edit c:/mysql/my.ini
      and put in the following:
      #The memory allocated to store results from old queries.
      query_cache_size=16M
      #Don't cache results that are bigger than this.
      query_cache_limit=1M
      #Query cache type to use.
      query_cache_type=1
    • Install FastCGI
      , which can offer
      x4 to x8 improvement
      (for IIS users at least).
    • An An extensive list of other optimizations for PHP and MySQL can be found over at phplens.com
      .
    • Install the Cacti
      plugin
      architecture
      and
      Boost plugin
      .


    Back to Top

      
      
    FAQ

    (eventually added to the FAQ section of Cacti)

      
      Q: Call to undefined function mysql_connect() in C:/Inetpub/www/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 338
    A:

    This is caused because newer versions of PHP no longer support
    the new client libraries for MySQL 4.1.0 and beyond.  The universal fix is to apply the
    old client
    hack, outlined in the MySQL section above. Cacti will not
    work with the php_mysqli
    extension.
      
      Q: How do I stop the command windows from opening every 5 minutes?
    A:
    This
    is occurring because your Cacti scheduled task is using the same user
    name you've logged onto the computer with. There are two possible
    fixes:


    • Use a different user name to run the Cacti scheduled task
    • Use a windows script to hide the command windows.  Only do this after your cacti installation is fully functional!

      • Create a file called invisible.vbs
        .  Place it where ever you like.
      • Edit invisible.vbs
        and paste the following
        Set objWSHShell = WScript.CreateObject(&quot;WScript.Shell&quot;)
        objWSHShell.Run &quot;poller.php&quot;, 0, False
      • Edit the Cacti scheduled task and change the Run
        to:
        C:/Windows/system32/wscript.exe &quot;C:/invisible.vbs&quot; &quot;C:/Inetpub/wwwroot/cacti/poller.php&quot;


      
    Q:  I see errors in the cacti.log file. How to I find out what is wrong?

    A:  Turn up the logging level in Cacti.  In Cacti go to Settings
    and change the Poller Logging Level
    to Debug for one cycle
    .
    If you notice your log file is filled with WEBLOG entries, which makes
    it hard to follow what is going on, then uncheck all of the Web Events
    , save and wait for the next polling cycle.

    Q: Does Cacti use MIB files?

    A:
    No. But they are handy to have around when making custom scripts in conjunction
    with Net-SNMP or GetIF. PHP SNMP and Net-SNMP do use MIB files to resolve OIDs to friendly names.
    Q: How can I debug SNMP output from a device?
    A:
    The easiest tools are either GetIf
    or Net-SNMP
    .
      GetIf is fairly self explanatory since it has a GUI.  Using the
    MBrowser tab is handy for navigating the SNMP trees and OIDs.  Net-SNMP
    is comprised of several tools. You'll want to use snmpget and snmpwalk.
      An example of parsing the interfaces on a device would be:

    C:/net-snmp/bin/>
    snmpwalk -v 1 -c public 127.0.0.1 .1.3.6.1.2.1.2.2

    An alternative would be to use a MIB name. This of course does require the use of MIB files:
    C:/net-snmp/bin/>
    snmpwalk -v 1 -c public 127.0.0.1 ifDescr

      
    Q: Why doesn't Windows return Disk or CPU usage via SNMP?
    A:
    Open up the SNMP Service and click on the Agent
    tab. Make sure all the service checkboxes are marked (they are not by
    default). Restart the SNMP service. Also try increasing the SNMP
    timeout and decreasing the Maximum OID's Per Get Request.
      
      Q: How do I get FastCGI working?

      A: For IIS 7, read this link
    . For IIS 5.1 and 6, read this link
    .
      

    The following has been superceeded by the above FAQ. Left in for history.
    Q: How do I get FastCGI to work
    with Windows 20003?

    A:
    A little modification needs to be done to the existing documentation
    .   

    • Make sure IIS_WPG account has read/execute rights on the PHP and Cacti folders.
    • Use the following modified fastcgi.reg
      file (assumes you're using PHP5)
      Windows Registry Editor Version 5.00

      [HKEY_LOCAL_MACHINE/SOFTWARE/FASTCGI]
      &quot;S&quot;StartServers&quot;=dword:00000002
      &quot;IncrementServers&quot;=dword:00000002
      &quot;MaxServers&quot;=dword:00000019
      &quot;Timeout&quot;=dword:00000258

      [HKEY_LOCAL_MACHINE/SOFTWARE/FASTCGI/.php]
      &quot;AppPath&quot;=&quot;c://php//php-cgi.exe&quot;
      &quot;BindPath&quot;=&quot;php-fcgi&quot;
    • Create a web site extension called  fastcgi
      . Add isapi_fcgi.dll
      and php-cgi.exe
      .
    • In the Default Website
      , under ISAPI filters
      , create a new filter in addition to the PHP one.  Call it fastcgi
      and point it to isapi_fcgi.dll
      .
    • Under the Home Directory
      tab, select Configuration
      and, change the .php extension to use isapi_fcgi.dll
      .
      

    Q:
    ERROR: change root is not supported by your OS or at least by this copy of rrdtool.
    A:

    This error message occurs when you use the Win32 version of rrdtool instead of the Cygwin one.  
    RRDTool 1.2.15 and later work with the Win32 build.
    Q: All my graphs are blank. Enabling graph debugging reveals a blank
    RRDTool Says output. What's wrong?
    A:

    It's very likely the NTFS permissions on cmd.exe or rrdtool.exe is
    not set correctly.  Both need Read/Execute rights by the web server.  
    Read about the exact details in the installation guide.
    Q: When attempting to run poller.php
    or cmd.php you get,
    This script is only meant to run at the command line
    .
    A:

    Most likely caused by a misconfiguration in your php.ini
    file. Make sure the following is set in it:
    register_argc_argv = On

    safe_mode = Off

    Another possibility is a logic bug in cmd.php only present in Cacti 0.8.6j and
    PHP 5.2.  Open cmd.php and go to line 49. Change it to:
    if (version_compare(&quot;5.2.0&quot;, PHP_VERSION, &quot;>=&quot;)) {



    Q: How do I get WMI scripts working on remote computers?
    A:

    There are several things one needs to do to accomplish this:

    • Open a hole in the firewall for DCOM.  For the Windows XP SP2 or Windows 2003 SP1 firewall, do the following:

      • Open up the Windows Firewall control panel
      • Click on Add Port
        .
      • Name:
        DCOM
        Port:
        135
        Type:
        TCP
      • You might need to change the scope of the rule, depending on where you will be remotely querying the server from.
      • Start | Run: gpedit.msc
      • Navigate to: Computer Configuration
        | Administrative Templates
        | Network
        | Network Connections
        | Windows Firewall
      • Enable the following:
        Allow remote administration exception
        Allow local port exceptions


    • Edit WMI security

      • Start | Run: wmimgmt.msc.
      •   Get properties on WMI Control
        .

      • Go to the Security
        tab
      • Click on the Root
        folder, then the security
        button at the bottom
      • Click on Advanced
      • Add the cactiuser account that's going to be used. Assign the following rights:
        Enable Account
        Enable Remote
      • Change the Apply onto
        to to: This namespace and subnamespaces
        .
      • Click OK several times and close the WMI window.


    • Edit DCOM security

      • Start | Run: dcomcnfg
      • Navigate to: Component Services
        | Computers
        | My Computer
        .
      • Get properties on My Computer
      • Click on the COM Security
        tab.
      • Under Launch and Activate Permissions
        , click on Edit Limits
      • Add the cactiuser account that's going to be used.  Assign the following rights:
        Remote Activation
      • Click OK and exit.


      Q: Why doesn't a WMI counter say it exists when I know it should?
    A:

    It's possible you need to run wmiadap
    /f which will re-parses all the performance libraries on the system.
      
      Q: I don't see any graphs on the main graph page, but when I click on one, I see 4 graphs with data.
    A:
    This happens because you have the wrong version of RRDTool selected in
    Cacti.  Set it by going to Settings and applying the proper RRDTool Utility Version.

      
      Q: Why do my graphs randomly
    not have any text while the data is properly displayed?

    A:
    It seems there is a bug in newer versions of PHP
    4 & 5, specifically in php4ts.dll. Get php4ts.dll from PHP 4.3.11 and replace the current one in your PHP directory. *WARNING*
    not responsible for any adverse affects this might have on your system.
      
      Q: How does one know if Cacti has debugging logging properly enabled?
    A:
    It seems there is a bug in Cacti were even though the logging level is set to DEBUG, you do not truly get debugging output.
      If your log file is filled with something like the following which constantly repeats, Cacti is NOT in debugging mode:

    CMDPHP: Poller[0] DEBUG: SQL Assoc: &quot;select  poller_output.output,  poller_output.time,  poller_output.local_data_id,  poller_item.rrd_path,  <snip>
    CMDPHP: Poller[0] DEBUG: SQL Assoc: &quot;select poller_id,end_time from poller_time where poller_id = 0&quot;
      If your log file contains things like the following, then debugging logging is properly enabled:

    CMDPHP: Poller[0] Host[1] SNMP: Host responded to SNMP
    CMDPHP: Poller[0] DEBUG: SQL Exec: &quot;update host set  status = '3',  status_event_count = '0',  status_fail_date = '2006-01-19 02:20:10',  <snip>
    CMDPHP: Poller[0] Host[1] RECACHE: Processing 3 items in the auto reindex cache for 'ares.mydomain.com'.
    CMDPHP: Poller[0] DEBUG: SQL Exec: &quot;update poller_reindex set assert_value='368365818' where host_id='1' and data_query_id='8' and arg1='.1.3.6.1.2.1.1.3.0'&quot;
    CMDPHP: Poller[0] DEBUG: SQL Exec: &quot;update poller_reindex set assert_value='368365819' where host_id='1' and data_query_id='14' and arg1='.1.3.6.1.2.1.1.3.0'&quot;
    CMDPHP: Poller[0] Host[1] DS[10] SNMP: v2: ares.mydomain.com, dsname: proc, oid: .1.3.6.1.2.1.25.1.6.0, output: 53
    CMDPHP: Poller[0] DEBUG: SQL Exec: &quot;insert into poller_output (local_data_id,rrd_name,time,output) values (10,'proc','2006-05-28 09:20:02','53')&quot;
    CMDPHP: Poller[0] DEBUG: SQL Assoc: &quot;select poller_id,end_time from poller_time where poller_id = 0&quot;
    CMDPHP: Poller[0] DEBUG: SQL Assoc: &quot;select  poller_output.output,  poller_output.time,  poller_output.local_data_id,  poller_item.rrd_path,  <snip>
    CMDPHP: Poller[0] DEBUG: SQL Exec: &quot;delete from poller_output where local_data_id='10' and rrd_name='proc' and time='2006-05-28 09:20:02'&quot;
    POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update c:/cacti/rra/ares_proc_10.rrd
      
      
    Q: What are  the NTFS permissions that need to be set for Cacti to
    function?

    A:

    Alias
    Username/Group
    Desciption
    TaskUser
    Domain/Usename
    The user account that runs the scheduled task for Cacti.
    IIS_USER
    IUSR_COMPUTERNAME
    Internet Guest Account (Windows NT/2000/XP/2003)
    IIS_USER
    IUSR
    Internet Guest Account (Windows Vista/2008)
    IIS_SERVICE
    IIS_WPG
    IIS Service Account (Windows 2003)
    IIS_SERVICE
    IIS_USRS
    IIS Service Account (Windows Vista/2008)  

    Path
    User
    NTFS Permissions
    C:/Spine/
    TaskUser
    Read & Execute
    C:/Cygwin/bin/
    TaskUser
    Read & Execute
    C:/Inetpub/wwwroot/cacti/
    TaskUser
    Read & Execute
    IIS_USER
    Read & Execute
    C:/Inetpub/wwwroot/cacti/rra/
    IIS_SERVICE
    Modify
    IIS_USER
    Modify
    TaskUser
    Modify
    C:/Inetpub/wwwroot/cacti/log/
    IIS_SERVICE
    Modify
    IIS_USER
    Modify
    TaskUser
    Modify
    C:/PHP/
    IIS_USER
    Read & Execute
    TaskUser
    Read & Execute
    C:/PHP/sessiondata/
    IIS_USER
    Modify (Files only)
    C:/PHP/uploadtemp/
    IIS_USER
    Modify (Files only)
    C:/Net-SNMP/
    IIS_USER
    Read & Execute
    C:/RRDTool/
    IIS_USER
    Read & Execute
    TaskUser
    Read & Execute
    C:/Windows/System32/cmd.exe
    IIS_USER
    Read & Execute
    IIS_SERVICE
    Read & Execute
    TaskUser
    Read & Execute  
      Q: How do I reset the default permissions and user rights for IIS?
    A

    : http://support.microsoft.com/kb/812614

      
      Q: How do I repair my Cacti database?
    A:
    Run the following from the command prompt:


    • mysqlcheck --auto-repair --databases cacti  
      OR
    • php <cactipath>/cli/repair_database.php

    Q: I'm getting errors with something like:
    Warning: fgets(): supplied argument is not a
    valid stream resource: <filename>



    A:
    This is most likely due to incorrect NTFS permissions
    on that file/folder. This prevents Cacti from accessing the file(s) to execute
    the code.  Read up above in the installation guide on what NTFS permissions
    need to be set.
    Q: How do I configure Microsoft SNMP?
    A:
    Read HOW TO: Configure the Simple Network Management Protocol (SNMP) Service in
    Windows Server 2003


    Prev
    Home>
    Next
    Installing Under Unix
    Up
    Upgrading Cacti  

  • 运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
    2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
    3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
    4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
    5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
    6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
    7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
    8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

    所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-142182-1-1.html 上篇帖子: Cacti监控Tomcat服务器实现过程 下篇帖子: 在Ubuntu整合Cacti与Nagios(一)
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    扫码加入运维网微信交流群X

    扫码加入运维网微信交流群

    扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

    扫描微信二维码查看详情

    客服E-mail:kefu@iyunv.com 客服QQ:1061981298


    QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


    提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


    本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



    合作伙伴: 青云cloud

    快速回复 返回顶部 返回列表