cfengine的基础安装和测试

简介:
cfengine的基础安装和测试
 
cfengine是一个功能强大的自动化系统管理工具,更详细的信息可以访问其主页
中文主页
网站里面有丰富的文档可以参考.现在我就来简单安装和测试以下.
按照其安装文档,cfengine需要opensslBerkely DB,一般系统自带的就满足要求了.按照文档采用源码方式安装,make报错,所以估计是没装Berkely DB的原因,所以源码安装了Berkely DB,路径为/usr/local/BerkeleyDB.4.6
安装cfengine在执行configure的时候,运行到一半停止了,显示
checking for BerkeleyDB location in default... /usr/local/BerkeleyDB.4.6
checking Berkeley DB Version... configure: error: This release of cfengine requires BerkeleyDB 3.2 or later
搜索到的原因如下
The linker might be the wrong place to look for the source of this error. The configure snippet builds a little program and checks the values of the DB_VERSION* macros from db.h .. So even if you have a newish bdb installed someplace, this will fail if '#include <db.h> ' either a) pulls in an old version from /usr/include or b) can't find your version at all.  If you installed the 4.5 specifically to fix this, remove it and install the 'db4-devel' rpm for your update level and architecture. The regular 'db4' rpm doesnt include the header file
安装db4-developensslrpm,再运行cfengineconfigure就通过.
 
看到别人的建议里面有这段话
You might be making this harder that it has to be.  Is there any
reason you don't use the already installed berkely db on your RHEL4
system (currently db4-4.2.52-7.1)?
原来系统自带的db4的包就是berkeley DB的包.系统是默认就安装好了的.
看了很多的建议,都说装rpm版的cfengine,不会有这些问题,很简单.所以改用rpm的装
下载地址
redhat 9 系统的
rhel 5 系统的
 
整个的安装过程确实没任何问题
所有的可执行程序都在/usr/sbin,
[root@server1 cfengine]# whereis cfagent
cfagent: /usr/sbin/cfagent /usr/share/man/man8/cfagent.8.gz
所有的配置文件路径,/var/cfengine
[root@server1 cfengine-2.2.1]# cd /var/cfengine/
[root@server1 cfengine]# ls
bin  inputs  modules  ppkeys  randseed  rpc_in  rpc_out  state
创建一个配置文件
[root@server1 cfengine]# cd inputs/
[root@server1 inputs]# vi cfagent.conf
control:
        actionsequence = ( shellcommands )
shellcommands:
        "/bin/echo Danger, Will Robison!"
 
以详细方式执行
[root@server1 inputs]# cfagent -f ./cfagent.conf -v
Reference time set to Thu Oct 18 16:02:42 2007
GNU Configuration Engine -
2.2.2
Free Software Foundation 1994-
Donated by Mark Burgess, Faculty of Engineering,
Oslo University College , Norway
------------------------------------------------------------------------
Host name is: server1
Operating System Type is linux
Operating System Release is 2.4.20-8smp
Architecture = i686
Using internal soft-class linux for host linux
The time is now Thu Oct 18 16:02:42 2007
------------------------------------------------------------------------
Additional hard class defined as: 32_bit
Additional hard class defined as: linux_2_4_20_8smp
Additional hard class defined as: linux_i686
Additional hard class defined as: linux_i686_2_4_20_8smp
Additional hard class defined as: linux_i686_2_4_20_8smp__1_SMP_Thu_Mar_13_17_45_54_EST_2003
GNU autoconf class from compile time: compiled_on_linux_gnu
Address given by nameserver: 127.0.0.1
Interface 1: lo
Interface 2: eth0
Interface 3: eth0:0
Trying to locate my IPv6 address
Looking for environment from cfenvd...
Unable to detect environment from cfenvd
cfengine:server1: No preconfiguration file
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 * (Changing context state to: main) *
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
---------------------------------------------------------------------
Loading persistent classes
---------------------------------------------------------------------
---------------------------------------------------------------------
Loaded persistent memory
---------------------------------------------------------------------
Looking for environment from cfenvd...
Unable to detect environment from cfenvd
Manually overidden relative path (./cfagent.conf)
Looking for an input file ./cfagent.conf
Cfengine input file had no explicit version string
Finished with ./cfagent.conf
Defined Classes = ( 192_168_0 192_168_1 32_bit Day18 Hr16 Hr16_Q1 Min00_05 Min02 October Q1 Thursday Yr2007 any cfengine_2 cfengine_2_2 cfengine_2_2_2 compiled_on_linux_gnu i686 ipv4_192 ipv4_192_168 ipv4_192_168_0 ipv4_192_168_0_111 ipv4_192_168_1 ipv4_192_168_1_112 linux linux_2_4_20_8smp linux_i686 linux_i686_2_4_20_8smp linux_i686_2_4_20_8smp__1_SMP_Thu_Mar_13_17_45_54_EST_2003 localhost localhost_localdomain net_iface_eth0 net_iface_eth0_0 net_iface_lo redhat redhat_9 server1 undefined_domain )
Negated Classes = ( )
Installable classes = ( no_default_route )
Global expiry time for locks: 120 minutes
Global anti-spam elapse time: 1 minutes
Extensions which should not be directories = ( )
Suspicious filenames to be warned about = ( )
Accepted domain name: undefined.domain
LogDirectory = /var/cfengine
Loaded /var/cfengine/ppkeys/localhost.priv
Loaded /var/cfengine/ppkeys/localhost.pub
Checksum database is /var/cfengine/checksum_digests.db
Default binary server seems to be server1
Reference time set to Thu Oct 18 16:02:42 2007
*********************************************************************
 Main Tree Sched: shellcommands pass 1 @ Thu Oct 18 16:02:42 2007
*********************************************************************
cfengine:server1:
Executing script /bin/echo Danger, Will Robison!...(timeout=0,uid=-1,gid=-1)
(Setting umask to 77)
cfengine:server1:/bin/echo Dange: Danger, Will Robison!
cfengine:server1: Finished script /bin/echo Danger, Will Robison!
Performance(Exec(/bin/echo Danger, Will Robison!)): time=0.0206 secs, av=0.0206 +/- 0.0316
---------------------------------------------------------------------
Alerts
---------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++
Summary of objects involved
++++++++++++++++++++++++++++++++++++++++
    global
    main
cfengine:server1: Outcome of version (not specified): Promises still kept 0%, Promises repaired 100%, Promises not kept 0%
简单方式执行
[root@server1 inputs]# cfagent -f ./cfagent.conf
cfengine:server1:/bin/echo Dange: Danger, Will Robison!
还有一种是模拟执行,也就是不真的执行,但是输出信息(-n参数表示不真实执行)
cfagent -v -f ./cfagent.conf -n
到上层目录查看,发现多了很多文件
[root@server1 inputs]# cd ..
[root@server1 cfengine]# ls
bin            cfengine_lock_db         inputs   performance.db  randseed  rpc_out
cf_classes.db  cfengine.server1.runlog  modules  ppkeys          rpc_in    state
其中有一个是日志文件,查看内容
[root@server1 cfengine]# less cfengine.server1.runlog
Thu Oct 18 16:02:42 2007:Lock removed normally :pid=28322:lock.__cfagent_conf.server1.shellcommand._bin_echo_Danger__Will_Robison__4206:
Thu Oct 18 16:04:05 2007:Lock removed normally :pid=28410:lock.__cfagent_conf.server1.shellcommand._bin_echo_Danger__Will_Robison__4206:
state目录下产生了一些文件,其中一个是类文件,程序会自动评估出这个主机所属于的
[root@server1 cfengine]# less state/allclasses
192_168_0
192_168_1
32_bit
Day18
Hr16
Hr16_Q1
Min00_05
Min04
October
Q1
Thursday
Yr2007
any
cfengine_2
cfengine_2_2
cfengine_2_2_2
compiled_on_linux_gnu
i686
ipv4_192
ipv4_192_168
ipv4_192_168_0
ipv4_192_168_0_111
ipv4_192_168_1
ipv4_192_168_1_112
linux
linux_2_4_20_8smp
linux_i686
linux_i686_2_4_20_8smp
linux_i686_2_4_20_8smp__1_SMP_Thu_Mar_13_17_45_54_EST_2003
localhost
localhost_localdomain
net_iface_eth0
net_iface_eth0_0
net_iface_lo
redhat
redhat_9
server1
undefined_domain
 
rpm安装以后,自动安装了三个服务,并且是开机启动的,执行chkconfig --list|grep cf
cfenvd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
cfexecd         0:off   1:off   2:on    3:on    4:on    5:on    6:off
cfservd         0:off   1:off   2:on    3:on    4:on    5:on    6:off
其功能如下
cfservd  文件共享和远程激活
A file server and remote activation service (optional).
cfexecd  定时执行
A scheduling and report service (recommended).
cfenvd
An anomaly detection service (strongly recommended).
查看当前的进程
[root@dbpi inputs]# ps -ef|grep cf
root      1115     1  0 08:25 ?        00:00:00 cfservd
root      1127     1  0 08:25 ?        00:00:00 cfenvd
root      1146     1  0 08:26 ?        00:00:00 cfexecd
 
默认是每个小时整点执行一次,可以在日志中看到运行的情况less cfengine.server1.runlog
Mon Oct 22 10:00:33 2007:Lock removed normally :pid=4003:lock..server1.cfd.exec_2967:
Mon Oct 22 10:00:34 2007:Lock removed normally :pid=4207:lock.cfagent_conf.server1.shellcommand._bin_echo_Danger__Will_Robison__4206:
 

本文转自yahoon 51CTO博客,原文链接:http://blog.51cto.com/yahoon/48744,如需转载请自行联系原作者
相关文章
|
11月前
|
运维 关系型数据库 MySQL
os-copilot安装_配置_功能测试全集
我是一位中级运维工程师,我平时工作会涉及到 各类服务器的 数据库 与 java环境配置 操作。 我顺利使用了OS Copilot的 -t -f | 功能,我的疑惑是不能在自动操作过程中直接给与脚本运行权限,必须需要自己运行一下 chmod 这个既然有了最高的权限,为什么就不能直接给与运行权限呢。 我认为 -t 功能有用,能解决后台运行基础命令操作。 我认为 -f 功能有用,可以通过task文件中撰写连续任务操作。 我认为 | 对文件理解上有很直接的解读,可以在理解新程序上有很大帮助。
330 86
|
10月前
|
存储 人工智能 编译器
【03】鸿蒙实战应用开发-华为鸿蒙纯血操作系统Harmony OS NEXT-测试hello word效果-虚拟华为手机真机环境调试-为DevEco Studio编译器安装中文插件-测试写一个滑动块效果-介绍诸如ohos.ui等依赖库-全过程实战项目分享-从零开发到上线-优雅草卓伊凡
【03】鸿蒙实战应用开发-华为鸿蒙纯血操作系统Harmony OS NEXT-测试hello word效果-虚拟华为手机真机环境调试-为DevEco Studio编译器安装中文插件-测试写一个滑动块效果-介绍诸如ohos.ui等依赖库-全过程实战项目分享-从零开发到上线-优雅草卓伊凡
580 10
【03】鸿蒙实战应用开发-华为鸿蒙纯血操作系统Harmony OS NEXT-测试hello word效果-虚拟华为手机真机环境调试-为DevEco Studio编译器安装中文插件-测试写一个滑动块效果-介绍诸如ohos.ui等依赖库-全过程实战项目分享-从零开发到上线-优雅草卓伊凡
|
8月前
|
SQL 缓存 关系型数据库
MySQL8.4 Enterprise安装Firewall及测试
MySQL8.4 Enterprise安装Firewall及测试
240 0
|
9月前
|
人工智能 测试技术 API
Windows用户必备:Postman v11详细安装指南与API测试入门教程(附官网下载
Postman是全球领先的API开发与测试工具,支持REST、SOAP、GraphQL等协议调试。2025年最新版v11新增AI智能生成测试用例、多环境变量同步等功能,适用于前后端分离开发、自动化测试、接口文档自动生成及团队协作共享API资源。本文详细介绍Postman的软件定位、核心功能、安装步骤、首次配置、基础使用及常见问题解答,帮助用户快速上手并高效利用该工具进行API开发与测试。
|
11月前
|
弹性计算 Ubuntu Java
OS-Copilot-ubuntu镜像版本的具体测试使用(安装方式有单独注明)
作为一名个人开发者,我主要负责云资源的运维和管理。在使用OS Copilot的过程中,我遇到了一些配置问题,特别是在ECS实例中设置AccessKey时,但最终成功解决了。通过使用OS Copilot的-t/-f/管道功能,我大大提升了效率,减少了命令编写的工作量,特别是在搭建Java运行环境时效果显著。此外,| 功能帮助我快速理解文档,整体体验非常流畅,推荐给其他开发者使用。
257 6
|
11月前
|
弹性计算 运维 Ubuntu
os-copilot在Alibaba Cloud Linux镜像下的安装与功能测试
我顺利使用了OS Copilot的 -t -f 功能,我的疑惑是在换行的时候就直接进行提问了,每次只能写一个问题,没法连续换行更有逻辑的输入问题。 我认为 -t 管道 功能有用 ,能解决环境问题的连续性操作。 我认为 -f 管道 功能有用 ,可以单独创建可连续性提问的task问题。 我认为 | 对文件直接理解在新的服务器理解有很大的帮助。 此外,我还有建议 可以在非 co 的环境下也能进行连续性的提问。
240 7
|
自然语言处理 机器人 Python
ChatGPT使用学习:ChatPaper安装到测试详细教程(一文包会)
ChatPaper是一个基于文本生成技术的智能研究论文工具,能够根据用户输入进行智能回复和互动。它支持快速下载、阅读论文,并通过分析论文的关键信息帮助用户判断是否需要深入了解。用户可以通过命令行或网页界面操作,进行论文搜索、下载、总结等。
339 1
ChatGPT使用学习:ChatPaper安装到测试详细教程(一文包会)
|
前端开发 JavaScript 应用服务中间件
linux安装nginx和前端部署vue项目(实际测试react项目也可以)
本文是一篇详细的教程,介绍了如何在Linux系统上安装和配置nginx,以及如何将打包好的前端项目(如Vue或React)上传和部署到服务器上,包括了常见的错误处理方法。
3687 0
linux安装nginx和前端部署vue项目(实际测试react项目也可以)
|
安全 测试技术 Linux
CentOS7 安装vulhub漏洞测试环境
CentOS7 安装vulhub漏洞测试环境
511 0
|
测试技术 PHP 开发工具
php性能监测模块XHProf安装与测试
【10月更文挑战第13天】php性能监测模块XHProf安装与测试
143 0