分类: 计算机

  • ntopng 安装

    网上以讹传讹的太多

    参考

    http://www.ntop.org/ntop/mini-tutorial-fresh-install-of-ntopng-on-centos-7/

    yum install -y subversion autoconf automake make gcc libpcap-devel libxml2-devel sqlite-devel libtool glib2-devel gcc-c++ libcurl-devel.x86_64 redis

    git clone https://github.com/ntop/ntopng.git
    git clone https://github.com/ntop/nDPI.git

    cd ntopng

    $ ./autogen.sh
    $ ./configure
    $ make

    service redis start

    ntopng -i eth1 –local-networks “1.100.0.0/8,192.168.0.0/16”

    其中eth1 是你的镜像数据口  后面是local-network,有更高要求的自己看help吧,这个只是说一下简单安装

    然后打开你http://ip:3000  用户密码 admin

    ntopng cli

    update:2016年12月28日14:57:31
    一直在发现会提示一个ntop的认证还觉得见鬼了呢,完全没有添加官方的资源,经过仔细检查,添加了链接,wp会自动引用预览,真是坑的没谁了,改掉就好了

  • awk/sed字符替换测试

    不一定严谨,不一定准确,纯粹记录而已,1w是一个10000行的文本,把其中的%40替换为@

    #time awk ‘{ sub(/%40/,”@”); print }’ 1w.txt>1w1.txt

    real 0m0.009s
    user 0m0.004s
    sys 0m0.000s

    # time sed “s/\%40/@/g” 1w.txt >1w2.txt
    real 0m0.015s
    user 0m0.012s
    sys 0m0.004s

  • ESXi 5.1 upto ESXi 5.5

    进入维护模式,然后

    esxcli software profile update -d /vmfs/volumes/5202248c-d9013b48-40e4-ac162d848400/ESXi-5.5.0-1331820-standard.zip -p ESXi-5.5.0-1331820-standard

    ok,然后重启就行了

  • chengd-ossim

    chengd-ossim

    http://lymrg.blog.51cto.com/1551327/385386
    log文件
    /var/log/localmessage

    plugin文件
    /etc/ossim/agent/plugins/zabbix.cfg

    /etc/ossim/agent/config.cfg

    [zabbix]

    zabbix=/etc/ossim/agent/plugins/zabbix.cfg

    www
    /usr/share/www/ossim/

    数据库 ossim 的plugin表 创建
    zabbix
    INSERT INTO `ossim`.`plugin` (

    `id` ,
    `type` ,
    `name` ,
    `description` ,
    `source_type` ,
    `vendor`

    )
    VALUES (

    ‘4500’, ‘1’, ‘zabbix’, ‘zabbix server message’, NULL , NULL

    );

    在plugin-sid里面添加
    INSERT INTO `ossim`.`plugin_sid` (`plugin_id`, `sid`, `category_id`, `class_id`, `reliability`, `priority`, `name`, `aro`, `subcategory_id`) VALUES (‘4500’, ‘1’, NULL, NULL, ‘5’, ‘5’, ‘zabbix warm’, ‘0.0000’, NULL);
  • centos net

    centos net
    http://www.wtobase.com/centos-6-basic-configuration.html
    #route add default gw 192.168.0.1 dev eth0

    /etc/sysconfig/network-scripts/ifcfg-eth0

    DEVICE=eth0
    BOOTPROTO=static(dhcp)   +++++++++++++++++++++++++++
    BROADCAST=192.168.1.255 ++++++++++++++++++++++++++
    IPADDR=192.168.1.101  +++++++++++++++++++++++
    NETMASK=255.255.255.0++++++++++++++++++++++
    GATEWAY=192.168.1.1 ++++++++++++++++++++++
    HWADDR=00:0C:29:69:76:CA
    ONBOOT=yes          ————————————————
    TYPE=Ethernet

    /etc/sysconfig/network-scripts/route-eth0

    za

    /etc/resolv.conf

    nameserver 8.8.8.8
    ————————————————————————————–

    vim /etc/sysconifg/network-scripts/route-eth0
    127.16.6.0/24 via 172.16.2.25

  • ntp-server

    yum insatll ntp

    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    conf 在
    etc/ntp.conf
    一般只修改server
    server  1.cn.pool.ntp.org prefer
    server  1.asia.pool.ntp.org
    server  2.asia.pool.ntp.org
    chkconfig ntpd on
    查看状态
    ntpstat
    将上面的命令放到cron里每天早上3点定期执行,crontab –e 然后输入
     0 3 * * * /usr/sbin/ntpdate ntp_server_ip
  • zabbix install

    zabbix install

    dohttp://blog.csdn.net/lx_9986/article/details/6763163
    download
    wget http://prdownloads.sourceforge.net/zabbix/zabbix-1.8.9.tar.gz?download
    iptables -F
    yum install httpd.x86_64  httpd-manual.x86_64
    启动Apache:
    apachectl start
    启动会有一定情况提示
    Could not reliably determine the server’s fully qualified domain name, using localhost.localdomain for ServerName
    /etc/httpd/conf/httpd.conf 中設定 ServerName
    将 Apache 设置为开机自动启动
    chkconfig –add httpd
    chkconfig –level 345 httpd on
    nano /etc/httpd/conf/httpd.conf
    yum install php.i686 php-bcmath.i686 php-gd.i686 php-mbstring  php-xml
    yum install mysql-server.i686 mysql.i686 php-mysql.i686
    启动 MySQL
    service mysqld start
    设置 MySQL root 密码
    mysqladmin -uroot -p password 123456
    Enter password: 输入旧密码(如果是第一次设置,root 默认密码为空,直接回车)
    设置MySQL开机自动启动
    chkconfig –add mysqld
    chkconfig –level 345 mysqld on
    yum install mysql-devel.i686
    yum install net-snmp.i686 net-snmp-devel.i686 net-snmp-utils.i686
    yum install curl.i686 curl-devel
    yum install gcc.i686 libgcc.i386 libgcc.i686
    yum install make wget nano
    下载安装
    ./configure –enable-server –enable-agent –with-mysql –with-net-snmp –with-libcurlll
    ./configure –enable-server  –enable-agent –with-mysql –with-net-snmp   –with-libcurl –prefix=/usr/local/zabbix
    make install
    useradd -d /home/zabbix -p zabbix zabbix
    创建 zabbix 用户
    进入 zabbix 解压缩后的目录,创建 zabbix 数据库
    mysql -uroot -p123456
    create database zabbix;
    quit;
    cat create/schema/mysql.sql | mysql -uroot -p123456 zabbix
    cat create/data/data.sql | mysql -uroot -p123456 zabbix
    cat create/data/images_mysql.sql | mysql -uroot -p123456 zabbix
    修改 /etc/services,加入以下行
    echo “zabbix-agent    10050/tcp  Zabbix Agent” >>/etc/services
    echo “zabbix-agent    10050/udp  Zabbix Agent” >>/etc/services
    echo “zabbix-trapper  10051/tcp  Zabbix Trapper” >>/etc/services
    echo “zabbix-trapper  10051/udp  Zabbix Trapper ” >>/etc/services
    修改 zabbix 的配置文件
    创建配置文件目录,并将源代码中的配置文件模板拷贝到新创建的配置文件目录中。
    mkdir /etc/zabbix
    cp misc/conf/* /etc/zabbix
    根据实际情况修改 zabbix_server.conf  zabbix_agentd.conf zabbix_agent zabbix_trapper.conf  一般都取默认值,除了
    改agentd的ip地址
    mysql 的数据库用户名和密码,如:
    DBUser=root
    DBPassword=123456
    拷贝zabbix服务器的frontend php 程序到 http server 的主目录下
    cp -r frontends/php/* /var/www/html
    修改php参数
    /etc/php.ini
    date.timezone =Asia/Chongqing
    post_max_size = 32M
    max_execution_time = 600
    max_input_time = 600
    /etc/httpd/conf/httpd.conf
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    chkconfig –level 35 iptables off
    给权限
    setenforce 0
    service httpd restart
    cp /root/zabbix-1.8.10/misc/init.d/redhat/8.0/zabb* /etc/init.d/
    修改  zabbix  agentd 和server
    /usr/local/zabbix/bin/zabbix_agentd改为实际的,centos中为sbin
    /usr/local/zabbix/sbin/zabbix_agentd
    runlevel
    /etc/rc3.d/xxx
    可能apache 不解析php重启
    ——————————————————————————————————————————————————————
    download
    php
    wget http://www.php.net/get/php-5.3.8.tar.gz
    phpmyadmin
    wget http://sourceforge.net/projects/phpmyadmin/files%2FphpMyAdmin%2F3.4.9%2FphpMyAdmin-3.4.9-all-languages.tar.gz
  • zabbix-mail

    zabbix  邮件 时间

    配置,安装 邮件 输出 log

    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    ntpdate us.pool.ntp.org

     zabbix系统的时区只与/etc/localtime有关。如果用/usr/share/zoneinfo/下面的某个时区文件(比如我用的Aisa/Shanghai)覆盖/etc/localtime,那么zabbix的系统时区就是相应的localtime(我的就是CST了)。如果不覆盖/etc/localtime,则zabbix就是采用UTC时间。这个可以通过敲入date命令看出来。

    (网上也查了很多资料,关于linux系统时区的设置。比较多的是说与/etc/sysconfig/clock文件里的“UTC=true、false”有关。但zabbix的clock文件里边没有“UTC=true、false”,而且自己给加上这么一行也没用。而且与clock文件里的hwclock=–localtime无关系。即便=–localtime,如果不覆盖/etc/localtime,用date命令显示的仍是UTC。)

     

    zypper install ncurses-devel gcc make

    wget ftp://ftp.mutt.org/mutt/mutt-1.4.2.3.tar.gz

    tar zxvf mutt-1.4.2.3.tar.gz

    ./configure –prefix=/usr/local/msmtp

    make

    make install

     

    Muttrc

    /usr/local/msmtp/etc/Muttrc

     

     

    set sendmail=”/usr/local/msmtp/bin/mutt”

     


    正常的发送邮件应该是

    ./usr/local/msmtp/bin/mutt [email protected]

    fin

    配置文件在

    /usr/local/msmtp/etc/Muttrc


    配置文件为止

    /usr/local/msmtp/etc/Muttrc



     

    echo “neirong” |./mutt -s “tt” [email protected]

  • mutt

    mutt

    先msmtp
    yum 安装时候的配置文件
    nano /usr/local/etc/Muttrc
    echo $3 |mutt -s $2 $1