cacti一键安装脚本V1.1

01.#!/bin/bash 02.#function +++++++++++++cacti auto install scripts+++++++++++++++++++ 03.#author itnihao  04.#version 1.1  05.#date 2012-08-17  v1.006.#date 2012-08-18  v1.1更新增加syslog-ng等内容07.#mail itnihao@qq.com  08.#www.bianceng.cn 09.#source http://code.google.com/p/auto-task-pe/ 10. 11.green='\e[0;32m'  12.red='\e[0;31m'  13.blue='\e[0;36m'  14.blue1='\e[5;31m'  15.NC='\e[0m'  16.path_soft=$(pwd) 17. 18.function base { 19.   #rpm -e lrzsz&& yum -y install lrzsz* 20.   #[ "$?" != "0" ] && echo "yum is badly,please check" && exit 1 21.   for i in  $(rpm -q gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel bison bison-devel readline readline-devel libmcrypt libmcrypt-devel net-snmp-devel gcc  gcc-c++ apr apr-util postgresql-libs  openssl openssl-devel autoconf automake fiex* libxml* ncurses*  libtool* libxslt libxslt-devel curl* bzip2*  gd gd-devel freetype freetype-devel libpng*|grep 'not installed' | awk '{print $2}')   22.   do  23.        yum -y  install $i;  24.   done  25.} 26. 27. 28.function lamp { 29.yum -y install httpd mysql-server mysql php* net-snmp*  rrdtool* 30.sed -i "s/;date.timezone =/date.timezone = Asia\/Chongqing/g" /etc/php.ini 31.#start lamp services 32.for  name  in  httpd  mysqld snmpd 33.   do 34.        service  ${name}  restart 35.        chkconfig --add ${name} 36.        chkconfig --level 345 ${name} on 37.   done 38.for name1 in nfslock rpcbind 39.   do 40.        service  ${name1}  stop 41.        chkconfig --del ${name1} 42.   done 43.   echo  -e "<?php\nphpinfo();\n?>">/var/www/html/test.php 44.} 45. 46.#add php_type 47.#echo "AddType application/x-httpd-php .php" >>/etc/httpd/conf/httpd.conf 48.#sed -i "s/AddType\ application\/x-gzip\ \.gz\ \.tgz/AddType\ application\/x-gzip\ \.gz\ \.tgz\ AddType\ application\/x-httpd-php\ .php/g" /etc/httpd/conf/httpd.conf 49.#sed -i "s/DirectoryIndex\ index.html\ index.html.var/DirectoryIndex\ index.php\ index.html\ index.html.var/g"  /etc/httpd/conf/httpd.conf 50. 51.#install cacti 52.function install_cacti { 53.cd  ${path_soft} 54.[ ! -e cacti*.tar.gz ]; stats=$?  55.[ "$stats" == 0 ] && echo -e "${red} there is not cacti*.tar.gz file${NC}" && wget --no-check-certificate http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz 56.tar zxvf cacti*.tar.gz 57.cp -rf cacti-0.8.8a  /var/www/html/cacti 58.restorecon -R -v '/var/www/html/cacti' 59.chown  apache.apache  -R  /var/www/html/cacti/ 60.sed -i "s/\$database_username\ =\ \"cactiuser\"/\$database_username\ =\ \"cacti\"/g" /var/www/html/cacti/include/config.php   61.sed -i "s/\$database_password\ =\ \"cactiuser\"/\$database_password\ =\ \"cacti123\"/g" /var/www/html/cacti/include/config.php62.63.#database password setting64.mysqladmin  -uroot password 'itnihao'65.mysqladmin  -uroot  -pitnihao  flush-privileges66.mysqladmin  -uroot  -pitnihao  create cacti67.mysql -uroot  -pitnihao  cacti </var/www/html/cacti/cacti.sql68.mysql -uroot  -pitnihao  -e "grant all on cacti.* to cacti@localhost identified by 'cacti123'"69.mysql -uroot  -pitnihao  -e "FLUSH PRIVILEGES"70.71.#add crontab72.chmod 777 -R  /var/www/html/cacti/rra73.chmod 777 -R  /var/www/html/cacti/log74.echo "*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2&1" >/tmp/cron.cacti75.crontab -l|sort|uniq >>  /tmp/cron.cacti76.crontab -uroot /tmp/cron.cacti && rm -rf /tmp/cron.cacti77.#setsebool -P httpd_unified=178.#chcon -t httpd_sys_content_t /usr/local/rrdtool -R79.echo -e "${green}++++++++++++++++++++++++cacti installed OK,path is http://ip/cacti++++++++++++++++++++${NC}" 80. 81.} 82.83.function plugin { 84.cd     ${path_soft}/plugin 85.[ ! -e cacti-spine-0.8.8a.tar.gz ]; stats=$? 86.[ "$stats" == 0 ] && echo -e "${red} there is not cacti-spine*.tar.gz file${NC}" && wget --no-check-certificate  http://www.cacti.net/downloads/spine/cacti-spine-0.8.8a.tar.gz 87.tar zxvf  cacti-spine-0.8.8a.tar.gz 88.cd cacti-spine-0.8.8a 89../configure 90.make && make install 91.cd ../92.mv /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf 93.#wget http://docs.cacti.net/_media/plugin:docs-v0.4-1.tgz 94.#wget http://docs.cacti.net/_media/plugin:boost-v5.0-1.tgz 95.#wget http://docs.cacti.net/_media/plugin:discovery-v1.5-1.tgz 96.#wget http://docs.cacti.net/_media/plugin:monitor-v1.2-1.tgz 97.#wget http://docs.cacti.net/_media/plugin:monitor-v1.3-1.tgz 98.#wget http://docs.cacti.net/_media/plugin:mobile-latest.tgz 99.#wget http://docs.cacti.net/_media/plugin:settings-v0.7-1.tgz 100.#wget http://docs.cacti.net/_media/plugin:syslog-v1.22-2.tgz 101.#wget http://docs.cacti.net/_media/plugin:thold-v0.4.9-3.tgz 102.#wget http://docs.cacti.net/_media/plugin:clog-v1.7-1.tgz103.#wget http://docs.cacti.net/_media/plugin:ntop-v0.2-1.tgz 104.#wget http://docs.cacti.net/_media/plugin:domains-v0.1-1.tgz 105.#wget http://docs.cacti.net/_media/userplugin:manage-0.6.2.zip 106.#wget http://wotsit.thingy.com/haj/cacti/quicktree-0.2.zip 107.#wget http://www.network-weathermap.com/files/php-weathermap-0.97a.zip 108.#wget http://docs.cacti.net/_media/plugin:timeshift-latest.zip109.#wget http://docs.cacti.net/_media/plugin:loginmod-latest.tgz 110.#wget http://docs.cacti.net/_media/plugin:realtime-v0.5-2.tgz 111.  112.  for name in `ls|sed -e "s/plugin://g" -e "s/.tgz//g"` 113.  do 114.      mv plugin:${name}.tgz ${name}.tar.gz 115.  done 116. 117.  for name1 in boost discovery docs domains loginmod-latest manage monitor quicktree realtime settings syslog thold timeshift weathermap 118.  do 119.     tar zxvf ${name1}*.tar.gz120.     mv ${name1} /var/www/html/cacti/plugins/ 121.  done 122.  chown apache.apache -R /var/www/html/cacti/plugins 123.} 124.125.function config_apache { 126.cat >> /etc/httpd/conf/httpd.conf << EOF 127.Alias /cacti "/var/www/html/cacti" 128.<Directory "/var/www/html/cacti"> 129.   Options -Indexes MultiViews -FollowSymLinks 130.   DirectoryIndex index.php 131.   AllowOverride None 132.   Order allow,deny 133.   Allow from all 134.</Directory> 135.<Directory /var/www/html/cacti/plugin/weathermap> 136.   <Files editor.php> 137.            Order Deny,Allow 138.            Deny from all 139.            Allow from 127.0.0.1 140.        </Files> 141.</Directory>  142.EOF 143.} 144. 145.function syslog { 146.#syslog_mysql 147.yum install -y rsyslog rsyslog-mysql  148.cat >> /etc/rsyslog.conf << EOF 149.$ModLoad imudp.so 150.$UDPServerRun 514 151.$ModLoad ommysql 152.$template cacti_syslog,"INSERT INTO syslog_incoming(facility, priority, date, time, host, message) values (%syslogfacility%,  153.%syslogpriority%,  '%timereported:::date-mysql%', '%timereported:::date-mysql%', '%HOSTNAME%', '%msg%')", SQL 154.*.*             >localhost,syslog,cacti_log,cacti_log_pass;cacti_syslog 155.EOF 156.sed -i "s/SYSLOGD_OPTIONS=\"-c 4\"/SYSLOGD_OPTIONS=\"-c 4 -r -m 1\"/g"  /etc/sysconfig/rsyslog  157.chkconfig rsyslog on 158.service rsyslog restart 159. 160.#syslog_database  161.mysqladmin  -uroot  -pitnihao  create syslog 162.mysql -uroot  -pitnihao  syslog </var/www/html/cacti/plugins/syslog/syslog.sql 163.mysql -uroot  -pitnihao  -e "grant all on syslog.* to cacti_log@localhost identified by 'cacti_log_pass'"164.mysql -uroot  -pitnihao  -e "FLUSH PRIVILEGES" 165. 166.#cacti_syslog 167.sed -i "s/use_cacti_db = true;/use_cacti_db = false;/g" /var/www/html/cacti/plugins/syslog/config.php 168.sed -i "s/syslogdb_username = 'cactiuser'/syslogdb_username = 'cacti_log'/g" /var/www/html/cacti/plugins/syslog/config.php 169.sed -i "s/syslogdb_password = 'cactiuser'/syslogdb_password = 'cacti_log_pass'/g" /var/www/html/cacti/plugins/syslog/config.php 170.#client_syslog or rsyslog 171.#echo "*.* @192.168.16.200"  >> /etc/syslog.conf 172.#echo "*.* @192.168.16.200"  >> /etc/rsyslog.conf 173.} 174. 175.function syslog_ng { 176.service rsyslog stop 177.chkconfig --del rsyslog 178.service syslog stop 179.chkconfig --del syslog 180.cd ${path_soft}/syslog 181.182.#############################download#################################### 183.#wget wget http://dl.fedoraproject.org/pub/epel/6/x86_64/libnet-1.1.5-1.el6.x86_64.rpm 184.#wget http://dl.fedoraproject.org/pub/epel/6/x86_64/eventlog-0.2.12-1.el6.x86_64.rpm 185.#wget ftp://fr2.rpmfind.net/linux/epel/6/x86_64/syslog-ng-3.2.5-3.el6.x86_64.rpm 186.#wget http://dl.fedoraproject.org/pub/epel/6/x86_64/syslog-ng-libdbi-3.2.5-3.el6.x86_64.rpm 187.######################################################################## 188.rpm -ivh libnet-1.1.5-1.el6.x86_64.rpm 189.rpm -ivh eventlog-0.2.12-1.el6.x86_64.rpm  190.rpm -ivh syslog-ng-3.2.5-3.el6.x86_64.rpm 191.rpm -ivh libdbi-0.8.3-3.1.el6.x86_64.rpm 192.rpm -ivh syslog-ng-libdbi-3.2.5-3.el6.x86_64.rpm 193. 194.cat >> /etc/syslog-ng/syslog-ng.conf  << EOF 195.source s_rsc { 196.               unix-stream("/dev/log"); 197.               udp(ip("192.168.16.200") port(514)); 198.}; 199.200.#destination r_mesg  { file("/var/log/warn");}; 201. 202.destination d_mysql { 203.                    program("mysql -ucacti_log -pcacti_log_pass syslog < /var/log/mysql.pipe");204.                    pipe("/var/log/mysql.pipe" 205.                    template("INSERT INTO syslog_incoming (host, facility, priority, status, date, time, seq, message) VALUES( '\$FULLHOST', '\$FACILITY', '\$PRIORITY', '\$STATUS', '\$YEAR-\$MONTH-\$DAY', '\$HOUR:\$MIN:\$SEC','\$SEQ', '\$MESSAGE' );\n") 206.                    template-escape(yes)); 207.}; 208. 209.log { source(s_rsc); destination(d_mysql); }; 210.log { source(s_sys); destination(d_mysql); }; 211.EOF212.} 213. 214.function client_config { 215.#client syslog-ng,you should install syslog-ng  216.cat >> /etc/syslog-ng/syslog-ng.conf  << EOF 217.destination d_udp {udp("192.168.16.200" port(514));}; 218.log { source(s_sys); destination(d_udp);}; 219.EOF 220. 221.#client_syslog or rsyslog 222.#rhel5.X use syslog 223.echo "*.* @192.168.16.200"  >> /etc/syslog.conf 224.#rhel6.X use rsyslog 225.echo "*.* @192.168.16.200"  >> /etc/rsyslog.conf 226. 227.#clietn snmpd configuration 228.sed -i s"/^/#/g" /etc/snmp/snmpd.conf 229.cat >> /etc/snmp/snmpd.conf << EOF 230.com2sec mynetwork 192.168.16.200 public 231.com2sec mynetwork 127.0.0.1 public  232.group MyROGroup v2c mynetwork 233.access MyROGroup "" any noauth prefix all none none   234.view all included .1 80 235.EOF 236.} 237. 238.function main { 239.base 240.lamp 241.install_cacti 242.plugin 243.config_apache 244.syslog 245.#syslog_ng 246.#client_config 247.} 248. 249.main

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索http
, conf
, media
, wget
, cacti
, plugin
ng1.3+
cacti一键安装中文版、cacti一键安装、nagios cacti一键安装、openvpn一键安装脚本、ss一键安装脚本,以便于您获取更多的相关知识。

时间: 2024-11-05 14:48:10

cacti一键安装脚本V1.1的相关文章

memcached一键安装脚本V1.0

#!/bin/bash #author itnihao #version 1.0 #date 2012-08-04 #mail itnihao@qq.com # www.bianceng.cn #source http://code.google.com/p/auto-task-pe/ green='\e[0;32m' red='\e[0;31m' blue='\e[0;36m' blue1='\e[5;31m' NC='\e[0m' soft_PATH=$(pwd) libevent_vers

ONOS一键安装脚本

工欲善其事,必先利其器.在部署SDN实践时,通常需要安装OVS和控制器等软件,经历过的同学都知道,很多时候会被一些细节卡住,影响生产效率.有时由于实验需要还需要多次部署同样的内容,重复进行多遍同样的命令,浪费时间.所以很有必要将安装过程转化为一键安装脚本.本文总结的一键安装脚本就是在部署ONOS集群时,为提高安装ONOS效率而整理的,希望能帮助到同样需要多次安装ONOS的其他人. 安装脚本 安装脚本将安装ONOS及其依赖软件的所有命令都写到了shell文件,并加一些必要判断语句,使得安装脚本使用

linux中dante socks5 一键安装脚本介绍

Danted Socks5 一键安装脚本 ******功能特点 1. 采用最新稳定版本 1.4.0 编译安装. 2. 自动识别系统IP(默认排除192.168.0.*, 10.0.0.*,127.0.0.*),检测多Ip时,进行交互式选择Ip配置(直接回车则全部配置). 3. 采用Pam用户认证,认证不需要添加系统用户(默认添加进程用户sock),删除.添加用户方便,安全. 4. sock5 运行状态查看. 5. 系统启动后自动加载. 6. 认证方式可选: 无用户名密码,系统用户名密码,Pam用

CentOS下IPSEC/L2TP VPN一键安装脚本(openswan+xl2tpd)

概念性的东西这里不再赘述,网上有太多,一键安装脚本也有很多,但是很多不能用,能用的也仅仅只是在CentOS6下使用,CentOS7基本没看到这些安装脚本.于是花了一些时间来折腾测试,写这个脚本方便以后VPN的一键安装搭建.其中用的开源软件包是openswan和xl2tpd,,中间碰到过很多很多问题,如openswan和xl2tpd之间的兼容性问题. 请容许我这样做,脚本依赖<lnmp一键安装包>,可以在安装完lnmp后,执行这个脚本(vpn_centos.sh)来一键搭建你的个人vpn Cen

Centos7搭建pptp VPN一键安装脚本

Centos7搭建pptp一键安装脚本 废话不多说,先上脚本地址:Centos7一键pptp 使用: wget https://raw.githubusercontent.com/DanylZhang/VPS/master/CentOS7-pptp-host1plus.sh chmod +x ./CentOS7-pptp-host1plus.sh ./CentOS7-pptp-host1plus.sh -u your_username -p your_password 1 2 3 可在-u.-p

Caddy Web服务器一键安装脚本

老左晚上有在浏览海外的资源网站时候有看到一键快速安装Caddy Web服务器的脚本以及简单的应用,所以准备也在博客中整理出来.Caddy这款工具是利用GO语言写的WEB Service服务器,支持HTTP/2静态网页服务器,当然老左也没有深入的研究其功能,因为我在简单的快速安装之后看到是支持HTML等静态文件的,对于PHP等我们常用在Nginx.Apache等动态交互环境有些不同. 在记录这篇文章的时候,老左大概浏览关于Caddy 的相关信息,在国内的信息还是比较少的,也许后面会有所关注或者后面

CentOS下shadowsocks-nodejs一键安装脚本

本脚本适用环境: 系统支持:CentOS/Redhat/Fedora 内存要求:≥128M 日期:2014年05月05日 关于本脚本: 一键安装 Nodejs 版的 shadowsocks 最新版本,同时会安装 Nodejs. 备注:因为需要编译安装 Nodejs 的最新版,如果内存太小的话会安装失败,因此本人只在最低 128MB 的 VPS 上测试过该脚本. 默认配置: 服务器端口:8989 客户端端口:1080 密码:自己设定(如不设定,默认为teddysun.com) 客户端下载: htt

CentOS下shadowsocks一键安装脚本

本脚本适用环境: 系统支持:CentOS/Redhat/Fedora 内存要求:≥64M 日期:2014年2月16日 关于本脚本: 一键安装shadowsocks的Python版本,同时安装了Python包工具pip. 默认配置: 服务器端口:8989 客户端端口:1080 密码:自己设定(如不设定,默认为teddysun.com) 客户端下载: http://sourceforge.net/projects/shadowsocksgui/files/dist/ 使用方法: 使用root用户登录

PHP 7.0.0 一键安装脚本

OSCM (Operation System Configure Management) 是我创建的一个自动化运维脚本的项目,旨在提供敏捷运维.传统自动化运维工具例如  ansible, saltstack,puppet  不够灵活,配置繁琐,很多限制等等.这些工具更适合没有软件开发基础的运维人员.对于从软件工程师转到运维领域的人,这些工具就是鸡肋.  https://github.com/oscm/shell/ 我将常用的运维写成 Shell 片段,根据环境的不同,加以组合使用.由于是shel