About 4Aiur

Posts by 4Aiur:

zabbix简易安装手册

Posted by 4Aiur on 10/15/2010 in SysAdmin |

zabbix简易安装手册

1) 安装zabbix依赖包

# yum install gcc MySQL-python mysql mysql-server mysql-devel mysql-bench php php-mysql php-bcmath php-mbstring freetype php-gd php-xml curl-devel libpurple yum install net-snmp net-snmp-devel

# mkdir package
# cd package/
# wget http://packages.sw.be/iksemel/iksemel-devel-1.4-1.el5.rf.x86_64.rpm
# wget http://packages.sw.be/iksemel/iksemel-1.4-1.el5.rf.x86_64.rpm
# rpm -ivh iksemel-1.4-1.el5.rf.x86_64.rpm iksemel-devel-1.4-1.el5.rf.x86_64.rpm
# wget http://fping.sourceforge.net/download/fping.tar.gz
# tar zxf fping.tar.gz
# cd fping-2.4b2_to/
# ./configure && make && make install

2) 配置zabbix依赖环境

# service httpd restart
# chkconfig httpd on
# chkconfig mysqld on
# service mysqld restart

3) 在mysql中增加zabbix库并配置zabbix库访问权限

# mysql
mysql> create database zabbix character set utf8;
mysql> GRANT ALL ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'zabbix';
mysql> quit;

4) 下载并安装zabbix

# wget "http://prdownloads.sourceforge.net/zabbix/zabbix-1.8.3.tar.gz?download"
# tar zxf zabbix-1.8.3.tar.gz 
# cd zabbix-1.8.3
# cd create/schema
# cat mysql.sql | mysql -uroot zabbix
# cd ../data
# cat data.sql | mysql -uroot zabbix
# cat images_mysql.sql | mysql -uroot zabbix
# cd ../../
# ./configure  --enable-server --enable-agent --with-mysql --with-net-snmp --with-jabber --with-libcurl
# enable Jabber 即时通讯功能。Jabber 是著名的Linux即时通讯服务服务器,它是一个自由开源软件,能让用户自己架即时通讯服务器,可以在Internet上应用,也可以在局域网中应用。 Jabber最有优势的就是其通信协议,可以和多种即时通讯对接。比如有第三方插件,能让jabber用户和MSN 、Yahoo、ICQ等IM用户相互通讯。 
# make install

5) 简单配置zabbix

# vim /etc/services
    zabbix-agent    10050/tcp  Zabbix Agent
    zabbix-agent    10050/udp  Zabbix Agent
    zabbix-trapper  10051/tcp  Zabbix Trapper
    zabbix-trapper  10051/udp  Zabbix Trapper 
# mkdir /etc/zabbix/
# cp /root/package/zabbix-1.8.3/misc/conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf
# vim /etc/zabbix/zabbix_server.conf
    LogFile=/var/log/zabbix/zabbix_server.log
    LogFileSize=100
    DebugLevel=3
    PidFile=/tmp/zabbix_server.pid
    DBHost=localhost
    DBName=zabbix
    DBPassword=zabbix
    DBSocket=/var/lib/mysql/mysql.sock
    DBPort=3306
    ListenIP=0.0.0.0
    StartPingers=30
    FpingLocation=/usr/local/sbin/fping

# cp /root/package/zabbix-1.8.3/misc/conf/zabbix_agent.conf /etc/zabbix/
# cp /root/package/zabbix-1.8.3/misc/conf/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf
# mv frontends/php /var/www/html/zabbix

# vim /etc/php.ini
    max_execution_time = 600     ; Maximum execution time of each script, in seconds
    max_input_time = 600    ; Maximum amount of time each script may spend parsing request data
    memory_limit = 256M      ; Maximum amount of memory a script may consume
    post_max_size = 32M
    upload_max_filesize = 16M
    date.timezone = Asia/Shanghai
# service httpd restart
# useradd -s /sbin/nologin zabbix

6) 启动zabbix

# su zabbix -c /usr/local/sbin/zabbix_server
# su zabbix -c /usr/local/sbin/zabbix_agentd

使用http://IP/zabbix登录zabbix,首次登录时按照网页提示进行操作。
默认登录帐户与密码:
admin/zabbix

Tags:

MacOSX使用opensnoop跟踪进程使用情况

Posted by 4Aiur on 09/28/2010 in MacOSX |

MacOSX使用opensnoop跟踪进程使用情况 opensnoop参数如下: $ opensnoop -hUSAGE: opensnoop [-a|-A|-ceghsvxZ] [-f pathname] [-n name] [-p PID] opensnoop # default output -a # print most data -A # dump all data, space delimited -c # print cwd of process -e # print errno value -g # print command arguments -s # print start time, us -v # print start […]

Tags:

在OpenSolais上的安装与配置awstats

Posted by 4Aiur on 09/17/2010 in OpenSolaris |

在OpenSolais上的安装与配置awstats 安装awstats # pkgin in awstats 安装GeoIP # pkgin in GeoIP 安装perl的GeoIP模块 # Geo::IP::PurePerl # wget http://geolite.maxmind.com/download/geoip/api/pureperl/Geo-IP-PurePerl-1.25.tar.gz # gtar zxf Geo-IP-PurePerl-1.25.tar.gz # cd Geo-IP-PurePerl-1.25 # perl Makefile.PL # make # make test # make install 下载GeoCity库 # wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz # gzip -d GeoLiteCity.dat.gz # mv GeoLiteCity.dat /opt/local/share/GeoIP/ 配置apache的虚拟主机 # cd /opt/local/etc/httpd/virtualhosts/ # vi blog.4aiur.net.conf ServerName […]

Tags: ,

在OpenSolaris上安装与配置proftpd

Posted by 4Aiur on 06/17/2010 in OpenSolaris |

在OpenSolaris上安装与配置proftpd Install proftpd # pkgin in proftpd Setup proftpd proftpd configuration examples /opt/local/share/examples/proftpd modify /opt/local/etc/proftpd.conf TimeoutLogin 120 TimeoutIdle 600 TimeoutNoTransfer 900 TimeoutStalled 3600 RootLogin off DefaultRoot ~ UseReverseDNS off IdentLookups off #VALID LOGINS AllowUser ftpuser DenyALL Setup openSolaris SMF # vi /var/svc/manifest/network/proftpd.xml ProFTPD Server # svccfg import /var/svc/manifest/network/proftpd.xml # svcadm enable proftpd # svcs proftpd

Tags: ,

在不浪费磁盘空间的情况下测试网络

Posted by 4Aiur on 06/09/2010 in SysAdmin |

在不浪费磁盘空间的情况下测试网络 time dd if=/dev/zero bs=1024 count=1048576 | ssh user@remotehost ‘cat > /dev/null’ 在数据传输过程中可以使用iptraf进行观察

不需要反引号的运行ssh复杂远程命令方式

Posted by 4Aiur on 06/07/2010 in Shell |

不需要反引号的运行ssh复杂远程命令方式 之前当我需要执行复杂的运程命令时,总是要先处理好引号、变量等问题,之后再执行命令写起来太麻烦,今天在commandlinefu上学了一招非常棒的方法,记录一下。 举个例子,之前需要用\反引$符号 [root@localhost ~]# ssh 127.0.0.1 -l root “echo a b c | awk ‘{print \$2}'” b 现在我们可以把复杂的命令写到文件中执行。 [root@localhost ~]# cat cmd echo a b c | awk ‘{print $2}’ 方法1: [root@localhost ~]# ssh 127.0.0.1 -l root “$( 方法2: [root@localhost ~]# ssh 127.0.0.1 -l root “cat cmd” b 方法3,使用标准输入执行,输入完毕后使用ctrl-D提交命令: [root@localhost ~]# ssh 127.0.0.1 -l […]

Tags: ,

unix时间戳转换

Posted by 4Aiur on 05/14/2010 in SysAdmin |

unix时间戳转换, Convert unix timestamp utime(){ date -d @$1; } utime(){ date -d “1970-01-01 GMT $1 seconds”; } utime(){ awk -v d=$1 ‘BEGIN{print strftime(“%a %b %d %H:%M:%S %Y”, d)}’; } utime(){ perl -e “print localtime($1).\”\n\””; } utime(){ python -c “import time; print(time.strftime(‘%a %b %d %H:%M:%S %Y’, time.localtime($1)))”; } [root@test test]# utime(){ date -d @$1; } [root@test test]# […]

Tags:

查找使用中的文件与目录相关信息

Posted by 4Aiur on 05/10/2010 in SysAdmin |

查找使用中的文件与目录相关信息 以tmp目录为例,使用下面得方法获得使用tmp目录进程的相关信息。 [root@4aiur ~]# inode=stat -c %i tmp [root@4aiur ~]# cd tmp [root@4aiur ~]# lsof -n | awk -v a=$inode ‘a==$(NF-1) || a==$(NF-2)’ bash 1963 root cwd DIR 253,0 4096 23805953 /root/tmp lsof 2033 root cwd DIR 253,0 4096 23805953 /root/tmp awk 2034 root cwd DIR 253,0 4096 23805953 /root/tmp lsof 2035 root cwd DIR […]

Tags:

python的ftp应用举例

Posted by 4Aiur on 05/04/2010 in Python |

python的ftp应用举例 使用python可以很方便的进行ftp操作,下面这个小程序的作用是成功下载远程服务器文件后,删除远程服务器上面的文件。 #!/usr/bin/env python2 # -*- coding: utf-8 -*- from ftplib import FTP import logging import os import socket logger = logging.getLogger(“download”) logger.setLevel(logging.DEBUG) fh = logging.FileHandler(“download.log”) formatter = logging.Formatter(“%(asctime)s – %(name)s – %(levelname)s – %(message)s”) fh.setFormatter(formatter) logger.addHandler(fh) def get_del(): ip = ‘127.0.0.1’ user_name = ‘foo’ passwd = ‘bar’ source_path = ‘/test_sour_dir/’ try: ftp = FTP(ip) […]

Tags:

禁用ConfigParser配置选项转化小写

Posted by 4Aiur on 04/20/2010 in Python |

禁用ConfigParser配置选项转化小写 ConfigParser在读取配置文件后默认会把配置项目转换为小写,调用下面的方法可以关闭转换功能。 cfgparser.optionxform = str

Tags:

Copyright © 2010-2024 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.