Install Net-SNMP

本文介绍如何安装配置Cacti网络监控系统,包括Net-SNMP的安装、Cacti和Cactid的配置步骤、任务计划设置及性能优化建议。
Install Net-SNMP

1.

If you plan to use any hosts with SNMP v2c support, you must download and install the Net-SNMP libraries. Net-SNMP provides installers to install their product. However, caution must be taken not to use long file names as Cacti does not support them in this version. We suggest you install Net-SNMP in a directory such as c:net-snmp.

Configure Cactid

1.

Modify the cactid.conf file in c:cactid to include the following statements.

DB_Host IP_Address or Hostname (not localhost)
DB_Database cacti
DB_User cactiuser
DB_Password cactipw


All other pre 0.8.6 settings are obsolete. Cactid may not complain if you leave them in, but they are not longer required. Cactid now comes with a binary distribution. Therefore, a basic installation of Cygwin is not longer required, but suggested to help maintain dll version conflicts.
2.

If you have Cygwin installed, remove the DLL files and the SH.EXE file from the c:cactid directory.

Configure Cacti

1.

Edit <web root>/cacti/include/config.php and specify the MySQL user, password and database for your Cacti configuration.

$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipw";


2. 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:<web root>cactipoller.php

After this has ran once, you should have cacti.log in /cacti/log/ (and possibly rrd files if you've already added some data queries in /cacti/rrd/).
3.

You are going to need to schedule a task so poller.php can run every 5 minutes. Make sure the Task Scheduler service is started and follow the steps below to begin.
1.

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

Double click on Add Scheduled Task.
3.

Click Next and Browse on the following screen. Find c:php and select php.exe. If using PHP 5, use php-win.exe instead. Choose Daily on and click Next.
4.

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

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

c:<web root>cactirra
c:<web root>cactilog

Make sure the user has read, and execute access to the following directories:

c:php
c:phpsapi

6.

Click Next and Finish to close the wizard.
7.

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

Select the Schedule tab.
9.

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

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.
11.

Click Ok
12.

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

c:phpphp.exe c:<web root>cactipoller.php

The start in box should say c:<web root>cacti.
4.

Point your web browser to:

http://your-server/cacti/

Log in the with a username of admin and password of admin. You will be required to change this password immediately.

Once logged in, you must go to Settings->Paths and verify/update your paths to point to the correct locations. Recommended examples are posted below. If you plan on using Cactid, then it is very important that your all your paths and scripts use forward slashes.

PHP Binary Path:

If using PHP 4, you should change this to:

c:/php/php.exe

If using PHP 5, you should change this to:

c:/php/php-win.exe

RRDTool Binary Path:

c:/rrdtool/rrdtool.exe

RRDTool Default Font Path:

%windir%/fonts/arial.ttf

RRDTool Version:

Select the appropriate version


SNMPGET, SNMPWALK Paths:

c:/net-snmp/bin/snmpget.exe
c:/net-snmp/bin/snmpwalk.exe

Cacti Logfile Path:

c:/mycacti/website/cacti/log/cacti.log

Cactid Path:

c:/cactid/cactid.exe

Apply Patches

1. There are two methods of applying patches to Cacti:
1. If you have Cygwin installed, then the patch instructions which use wget and patch, will work.
2. 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.
2. You might need to reapply file/folder security on the files patched. Double check they are correct.

Tweaking

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.

1. Switch the polling agent in Cacti from cmd.php to Cactid.exe. Go to Settings | Poller | Type.
2. Install the Zend Optimizer for PHP.
3. 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:mysqlmy.ini and put in the following:

#The memory allocated to store results from old queries.
query_cache_size=3M
#Don't cache results that are bigger than this.
query_cache_limit=1M
#Query cache type to use.
query_cache_type=1

4. Install FastCGI, which can offer x4 to x8 improvement (for IIS users at least).
5. An extensive list of other optimizations for PHP and MySQL can be found over at phplens.com.
<think>好的,我现在需要帮用户解决关于“yum install net-snmp-utils -y”换一种安装方法的问题。用户可能已经知道用yum直接安装,但想了解其他方法。首先,我应该考虑不同的包管理工具或安装方式。 首先,想到的替代方法可能是使用dnf,因为Fedora和较新的RHEL/CentOS版本已经用dnf替代了yum。dnf的用法和yum相似,所以用户可以轻松转换。但需要确认用户系统是否支持dnf,不过大多数情况下应该没问题。 接下来,用户可能想手动下载rpm包安装。这时候需要找到正确的rpm包来源。可以考虑从官方仓库或镜像站点下载,比如vault.centos.org。这里需要指导用户如何查找和下载正确的版本,特别是注意系统版本和架构。例如,使用wget或者curl来下载,然后用rpm命令安装,但要注意依赖问题,可能需要手动安装依赖包,这可能比较麻烦。 另外,启用EPEL仓库也是一个方法,特别是如果包在基础仓库中没有的话。EPEL经常提供额外的软件包,安装EPEL后,用户仍然可以使用yum或dnf来安装,但这也算另一种途径。需要告诉用户如何安装EPEL版本,比如用yum install epel-release,然后再安装net-snmp-utils。 还有,配置本地仓库或使用remi仓库可能也是选项,但可能比较复杂,特别是对于新手用户来说。可能不太推荐,除非用户有特定需求。 然后,需要考虑是否还有其他方法,比如源码编译安装。不过这对于普通用户来说可能难度较大,需要安装开发工具和依赖项,编译时间长,而且管理起来不如包管理器方便。所以可能作为备选方案提及,但提示用户谨慎使用。 总结下来,主要的替代方法有:1. 使用dnf代替yum;2. 手动下载rpm包安装;3. 启用EPEL仓库后用yum安装;4. 源码编译安装。需要逐一解释这些方法的步骤,注意事项,以及优缺点。例如,dnf和yum类似,推荐使用;手动rpm安装需要注意依赖;EPEL可能需要额外步骤;源码编译适合高级用户。 需要确保步骤清晰,避免用户操作时出错。例如,在手动下载rpm时,要给出具体的URL示例,并提醒替换系统版本和架构。在启用EPEL时,给出具体的安装命令。同时,在源码编译部分,提供下载链接和典型的编译命令,但提醒依赖问题。 最后,应该比较这些方法的优缺点,帮助用户根据自身情况选择。例如,推荐优先使用dnf或EPEL,因为它们自动处理依赖;手动安装和源码编译作为备选。 检查是否有遗漏的方法,比如是否可以使用snap或flatpak,但net-snmp-utils可能不提供这些格式。或者使用第三方仓库,但需要用户信任来源。可能这些不太常见,所以可能不提及。 确保用中文回答,结构清晰,步骤详细,语法正确,特别是LaTeX格式的应用,但根据用户的问题,可能不需要数学公式,所以这部分可能用不上,但需要确保其他格式正确。 现在整理回答,分步骤说明每种方法,注意事项,并给出示例命令。确保用户能逐步跟随操作,同时了解可能遇到的问题,如依赖关系或版本兼容性。</think>以下是几种替代 `yum install net-snmp-utils -y` 的安装方法,分步骤说明: --- ### 方法 1:使用 `dnf` 替代 `yum`(适用于新版本系统) **步骤:** 1. 更新软件包缓存: ```bash sudo dnf update ``` 2. 安装 `net-snmp-utils`: ```bash sudo dnf install net-snmp-utils -y ``` **注意**: `dnf` 是 `yum` 的升级版(Fedora/RHEL 8+ 默认使用),语法与 `yum` 兼容,自动处理依赖。 --- ### 方法 2:手动下载 RPM 包安装 **步骤:** 1. 访问镜像站(如 [vault.centos.org](https://vault.centos.org)),根据系统版本和架构(如 CentOS 7 x86_64)搜索 `net-snmp-utils` 的 RPM 包。 2. 下载 RPM 包: ```bash wget https://vault.centos.org/.../net-snmp-utils-5.7.2-49.el7.x86_64.rpm ``` 3. 安装 RPM 包: ```bash sudo rpm -ivh net-snmp-utils-*.rpm ``` **注意**: 若提示依赖缺失,需手动下载并安装所有依赖包(不推荐,易引发依赖冲突)。 --- ### 方法 3:通过 EPEL 仓库安装 **步骤:** 1. 启用 EPEL 仓库: ```bash sudo yum install epel-release -y ``` 2. 清理缓存并安装: ```bash sudo yum clean all sudo yum install net-snmp-utils -y ``` **注意**: EPEL 仓库提供额外软件包,适用于 CentOS/RHEL 系统。 --- ### 方法 4:源码编译安装(适合高级用户) **步骤:** 1. 下载源码包: ```bash wget https://sourceforge.net/projects/net-snmp/files/net-snmp/5.9.4/net-snmp-5.9.4.tar.gz ``` 2. 解压并编译: ```bash tar -zxvf net-snmp-5.9.4.tar.gz cd net-snmp-5.9.4 ./configure make sudo make install ``` **注意**: 需提前安装开发工具(如 `gcc`、`make`)和依赖库,且无自动更新支持。 --- ### 方法对比 | 方法 | 优点 | 缺点 | |------------|-------------------------|---------------------------| | `dnf` | 自动依赖处理,推荐首选 | 仅适用于新版本系统 | | 手动 RPM | 无需网络(离线可用) | 依赖复杂,易出错 | | EPEL 仓库 | 扩展包丰富 | 需额外启用仓库 | | 源码编译 | 可自定义配置 | 耗时、需手动管理依赖 | --- **推荐优先级**: 1. 优先使用 `dnf` 或 `yum` + EPEL(自动化最佳)。 2. 离线环境选择手动 RPM(需解决依赖)。 3. 源码编译仅用于特定需求(如版本定制)。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值