分类目录归档:linux

powerdns踩坑记

Published / by whosb / Leave a Comment

先说总结性文章,可用,再说各种注意事项

1、网上很多文章,属于以讹传讹,很多东西已经不一样了,新版按照官方教程走会靠谱很多
2、官网教程也有问题,yum可以安装,但是版本比较老,这个不知道算明坑还是暗坑
3、powerdns-admin和poweradmin是两个东西,看教程的时候需要注意,我这次用的是前者,但是也误入歧途把后者安装了一遍。。。。。。

其他自求多福外带摸索吧,帮不了多少了。。。

ntopng 安装

Published / by whosb / Leave a Comment

网上以讹传讹的太多

参考

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会自动引用预览,真是坑的没谁了,改掉就好了

chengd-ossim

Published / by whosb / Leave a Comment

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

Published / by whosb / Leave a Comment

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

Published / by whosb / Leave a Comment

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

Published / by whosb / Leave a Comment

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

Published / by whosb / Leave a Comment

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 xxx@xxx.com

fin

配置文件在

/usr/local/msmtp/etc/Muttrc


配置文件为止

/usr/local/msmtp/etc/Muttrc



 

echo “neirong” |./mutt -s “tt” user@gmail.com

zabbix fping

Published / by whosb / zabbix fping有1条评论

zabbix fping

shell> chown root:zabbix /usr/sbin/fping
shell> chmod 710 /usr/sbin/fping
shell> chmod ug+s /usr/sbin/fping
CentOS 5 centos.karan.org/el5/extras/testing/x86_64/RPMS/fping-2.4b2-7.el5.kb.x86_64.rpm
CentOS 5 centos.karan.org/el5/extras/testing/i386/RPMS/fping-2.4b2-7.el5.kb.i386.rpm
Checks if server is accessible by ICMP ping. 0 – ICMP ping fails. 1 – ICMP ping successful. One of zabbix_server processes performs ICMP pings once per PingerFrequency seconds
zabbix fping

web03# wget http://fping.sourceforge.net/download/fping.tar.gz
web03# tar zxf fping.tar.gz
web03# cd fping-2.4b2_to
web03# ./configure
web03# make && make install

安装完毕后,一起就2个文件:

/usr/local/sbin/fping #执行文件

/usr/local/man/man8/fping.8 #man文件

设置fping权限:

web03# chown root:zabbix /usr/local/sbin/fping
web03# chmod 710 /usr/local/sbin/fping
web03# chmod ug+s /usr/local/sbin/fping

zabbix_get

Published / by whosb / Leave a Comment

zabbix_get

zabbix_get -s 172.16.188.50 -p10050 -k”cpu[*]”

这个是测试的命令

UserParameter=key[*],command
这个是格式

UserParameter=httpd[cpu],ps auxw|grep httpd|grep -v grep| awk ‘{s+=$3} END {print s}’

这个是我们测试CPU的条目当然了,没成功

UserParameter=httpd[cpu],ps auxw|grep httpd|grep -v grep| awk ‘{s+=$3} END {print s}’//放在zabbix_agent.conf里面