• 欢迎访问极客公园网站,WordPress信息,WordPress教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入极客公园 QQ群
  • Git主题现已支持滚动公告栏功能,兼容其他浏览器,看到的就是咯,在后台最新消息那里用li标签添加即可。
  • 最新版Git主题已支持说说碎语功能,可像添加文章一样直接添加说说,新建说说页面即可,最后重新保存固定连接,演示地址
  • 百度口碑求点赞啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊http://koubei.baidu.com/s/gitcafe.net
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏极客公园吧

自动化运维工具Func模块笔记

未分类 博客教主 13年前 (2011-12-12) 681次浏览 0个评论

* BridgeModule — Allows for simple network bridge management
————————————————————-
功能:操作网桥
方法:
list() Returns a dictionary containing the bridges and their connected interfaces.
add_bridge(brname) Creates a new bridge named brname.
add_interface(brname, ifname) Adds interface ifname to bridge brname.
delete_bridge(brname) Deletes bridge brname.
delete_interface(brname, ifname) Removes interface ifname from bridge brname.
add_promisc_bridge(brname, ifname) Creates a new bridge brname, attaches interface ifname to it and sets the MAC address of the connected interface to FE:FF:FF:FF:FF:FF, so traffic can flow freely through the bridge. This is required for use with Xen.
up_bridge(brname) Marks bridge brname and all it’s connected interfaces as up.
down_bridge(brname) Marks bridge brname and all it’s connected interfaces as down
————————————————————-

* CertMasterModule — For power users out there, allows manipulating the certmaster from Func’s API.
————————————————————-
功能:Certmaster Module
方法:
添加/删除Certmaster客户端
get_hosts_to_sign(list_of_hosts)
sign_hosts(list_of_hosts)
cleanup_hosts(list_of_hosts)
————————————————————-

* CommandModule — Running Arbitrary Commands Like SSH Does
————————————————————-
功能:命令行模板,在客户端运行命令行。
方法:
#exists方法:检测/bin/foo文件是否存在
func target.example.org call command exists /bin/foo

#运行该命令
func target.example.org call command run “/bin/foo arg1 arg2 arg3”
————————————————————-

* CopyFileModule — Copyfile File Copying and Checksumming
————————————————————-
功能:文件同步模板,同步指定文件到客户端
方法:
func target.example.org copyfile -f localfile –remotepath /remotepath/filename

返回值说明:
# -1 = problem file was not copied
# 1 = file was copied
# 0 = file was not copied b/c file is unchanged
————————————————————-

* FileTrackerModule — tracks file changes, for use with FuncInventory
————————————————————-
功能:跟踪模块,为了安全考虑,跟踪一些重要的文件的情况。
方法:
第一步,添加跟踪的文件或目录
# func “*” call filetracker track /etc/passwd 1
# func “dbservers*” call filetracker track /etc/foo
# func “webservers*” call filetracker track /tmp/bar
# func “*” call filetrack untrack /etc/bar
# func “*” call filetrack track “/etc/*” 1
1代表跟踪文件的更新变化。

第二步,查看跟踪结果
func “target.example.org” call filetracker inventory
————————————————————-

* JBossModule — monitoring and control jboss instances
————————————————————-
功能:监控与操作JBOSS实例
方法:(略)
————————————————————-

* IPtablesModule — iptables management
————————————————————-
功能:IPtables管理模板
方法:(略)
————————————————————-

* HardwareModule — Hardware Profilling
————————————————————-
功能:硬件信息模板,显示CPU、驱动等等。
方法:
func target.example.org call hardware info
————————————————————-

* MountModule — mount, unmount, and query mounted resources
————————————————————-
功能:挂载模板,挂载/unmount分区模板
方法:
func target.example.org call mount /dev/device /path/to/dir
————————————————————-

* NagiosCheck — be able to call Nagios plugins and get their results, without needing to install nagios. Works with any plugin
————————————————————-
功能:Nagios检查模块
方法:(略)
————————————————————-

* NetappModule — Administer Netapp filers
————————————————————-
功能:NetApp模块
方法:(略)
————————————————————-

* NetworkTest — Test out network stuff.
————————————————————-
功能:网络测试模块
方法:
PING
#数字2为ping的次数
func tachikoman call networktest ping redhat.com -c 2

NETSTAT
func tachikoman call networktest netstat

traceroute
func tachikoman call networktest traceroute redhat.com -m 10

dig
func tachikoman call networktest dig redhat.com
————————————————————-

* ProcessModule — Process Info, memory usage, and Killing
————————————————————-
功能:进程管理模块
方法:
#ps -aux等价
func target.example.org call process info “aux”

#显示全部进程使用内存情况,返回格式:[[Private, Shared, Total RAM used, Program], … ]
func target.example.org call process mem

#pkill thunderbird进程,返回整形
func “*” call process pkill thunderbird -9

#kill firefox-bin进程,返回整形
func “*” call process kill firefox-bin SIGHUP

————————————————————-

* ServiceModule — Service Status and Control
————————————————————-
功能:服务管理模块
方法:
func target.example.org call service start httpd
————————————————————-

* SysctlModule — Configure kernel parameters at runtime
————————————————————-
功能:配置内核参数模块
方法:
func “*” call sysctl list
func “*” call sysctl get
func “*” call sysctl set

参数可以是:
‘kernel.sched_latency_ns = 20000000’,
‘kernel.sched_wakeup_granularity_ns = 1000000’,
‘kernel.sched_batch_wakeup_granularity_ns = 25000000’,
‘kernel.sched_stat_granularity_ns = 0’,
‘kernel.sched_runtime_limit_ns = 20000000’,
‘kernel.sched_child_runs_first = 1’,
‘kernel.sched_features = 21’,
‘kernel.sched_compat_yield = 0’,
‘kernel.panic = 0’,
‘kernel.exec-shield = 1’,
————————————————————-

* RebootModule — Reboot your system
————————————————————-
功能:重启服务器模块
方法:
func target.example.org reboot.reboot
func target.example.org reboot.reboot now “Going down for a reboot”
返回值:
Integer. 0 == success.
————————————————————-

* RpmModule — for any distro that supports RPM, lists installed packages
————————————————————-
功能:RPM管理模板
方法:
#返回一个已安装包的一个列表
func target.example.org call rpms inventory
————————————————————-

* SmartModule — Disk Smart (Hard Drive) Status
————————————————————-
功能:Smart管理模板
方法:
#返回smart信息
func target.example.org call smart info
————————————————————-

* UserModule — we still need to implement this :)
————————————————————-
功能:用户管理模板
方法:(略)
————————————————————-

* VirtModule — works with koan, KVM, Xen, etc
————————————————————-
功能:Virt管理模板
方法:(略)
————————————————————-

* VlanModule — Simple VLAN management
————————————————————-
功能:Vlan管理模板
方法:(略)
————————————————————-

* YumModule — for any distro that is yum based, installs packages
————————————————————-
功能:yum管理模板
方法:
func target.example.org call yumcmd update

来源:http://blog.liuts.com/post/121/


极客公园 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:自动化运维工具Func模块笔记
喜欢 (0)

您必须 登录 才能发表评论!