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,如需转载请自行联系原作者
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值