老早就下载了backtrack5的iso文件,今天终于刻盘在公司的台式机上安装了一下。具体怎么装我也不赘述,官方的安装文档在这里,我这里只说问题,按照文档第一步,我
的时候就出问题了。系统提示:
Warning: Type "ONE_LEVEL" has 1 levels, but has 2 symbols
,然后google了一下,原来这是64位版本的问题,官方早有解决方法,看这里。我再简单描述一下,解决起来很简单:
rm /root/.kde/cache-root/icon-cache.kcache
rm /root/.kde/cache-root/plasma_theme_Volatile.kcache
rm /root/.kde/cache-bt/icon-cache.kcache
rm /root/.kde/cache-bt/plasma_theme_Volatile.kcache
然后再startx,就没有问题了。
前面提到tracks for android在修改了内容或者提交一个新的action的时候,中文内容会乱码。最新消息,现在已经解决了。因为tracks for android的作者开放了源码,我直接取了一份,在会java的同事的提点下,最终找到了编码的地方,小改两行代码,问题解决。
编辑文件src/ca/xvx/tracks/util/HttpConnection.java,将其105行和118行的内容:
StringEntity ent = new StringEntity(content);
改成
StringEntity ent = new StringEntity(content, "UTF-8");
即可。
/tmp目录缺省用来保存php的session文件,某台机器这个目录下文件数过多,rm -rf *都会报“参数太长”的错误。用命令:
find . -type f -name "sess_*" -cmin +30 |xargs rm -f
删除之。注意:这里的sess_*要用引号引起来,否则,也会出“参数太长”的错误。
首先,说明一下:题目是摘抄的。但是问题是通的,用过nagios的都知道,nagios是用程序mail来发报警邮件的,而mail命令不支持命令行直接指定发件人的邮件地址,而且缺省的发件人地址是调用mail的用户@服务器的主机名,所以基本上用nagios的人都有需求修改发件人的邮件地址,解决方法也五花八门。
网上大都是改mailrc文件来修改发件人地址的,我不推荐这样做主要是因为如果有别的程序再调mail发邮件,发件人也会是这个修改后的邮件地址,我这里用的算是一种比较简便的方法:使用nail替代nagios原来用的mail来发邮件。因为nail命令直接就支持”-r”参数来设置发件人的邮件地址。在centos5下,直接
即可,如果在centos6下,nail和mail是一个软件包,所以有mail的话,都不用安装,nail就有了,直接用就好了。
在服务器上布了个tracks,并在HTC desire HD上装上了tracks for android,发现有个问题,在手机上编的action,如果有中文的话,同步到服务器上后再同步回来,到手机上就变成了乱码。先挖个坑,以后看有没有办法解决。
升级完毕,发现激活不了。我晕,一google,发现碰到这个问题的人还真不少!人大多说换个sim卡再试,于是换了张联通的sim卡,再试,终于搞定了。
这个,不是apache官方的建议,而是php官方的建议,原文请看这里:http://php.net/manual/en/install.unix.apache2.php,至于为什么,还是请看php官网的faq:http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2
Why shouldn’t I use Apache2 with a threaded MPM in a production environment?
PHP is glue. It is the glue used to build cool web applications by sticking dozens of 3rd-party libraries together and making it all appear as one coherent entity through an intuitive and easy to learn language interface. The flexibility and power of PHP relies on the stability and robustness of the underlying platform. It needs a working OS, a working web server and working 3rd-party libraries to glue together. When any of these stop working PHP needs ways to identify the problems and fix them quickly. When you make the underlying framework more complex by not having completely separate execution threads, completely separate memory segments and a strong sandbox for each request to play in, further weaknesses are introduced into PHP’s system.
If you want to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space.
前面这里有做cacti的ldap认证,今天又要在一台centos6的机器上配cacti的ldap认证。于是照葫芦画瓢,本以为非常简单,没想到,做完后登录时报错:“Group DN could not be found to compare”。又查apache的error_log,发现log里报:
PHP Notice: Undefined variable: ldap_group_member_type in /xxx/cacti-0.8.7g/lib/ldap.php on line 253, referer: http://xxx.xxx.xxx.xxx/cacti/index.php
google了一下,发现官方论坛已有解决方案,其实解决很简单:
vim /xxx/cacti-0.8.7g/lib/ldap.php
,将第253行
if ($ldap_group_member_type == 1) {
改成
if ($this->group_member_type == 1) {
即可。
php报错的问题解决后,再重新ldap登录,居然OK了。看来这是php5.3的问题(原来那台centos5+php5.2的没问题)。
系统版本:
php5.3
前面有个例子也是讲这个问题,只不过那里面的过程比较复杂,sql语句很多,一直想把步骤搞简单点,sql语句可以搞复杂一点。接着这次又批量往cacti里导机器的机会,把这方面的东西整理了一下。详情如下:
首先,假设我们这次添加的机器是”10.0.0.1“和”10.0.0.2“,联系人都是”张三“(用户名是”zhangsan“),cacti系统所用数据库名为”cacti“。敲入命令
进入mysql客户端。
进入cacti系统所用的数据库。
打开新服务器的阀值报警联系人定制开关:
UPDATE thold_data \
SET template_enabled = 'off' \
WHERE \
host_id IN \
(SELECT host.id FROM host, plugin_thold_contacts, user_auth \
WHERE \
plugin_thold_contacts.user_id = user_auth.id \
AND user_auth.username ='zhangsan' \
AND (host.hostname = '10.0.0.1' OR host.hostname = '10.0.0.2'));
再接着,
SELECT concat( \
"INSERT INTO plugin_thold_threshold_contact (thold_id, contact_id) \
VALUES (", thold_data.id, ", ", plugin_thold_contacts.id, ");") \
FROM thold_data, host, user_auth, plugin_thold_contacts \
WHERE plugin_thold_contacts.user_id = user_auth.id \
AND thold_data.host_id = host.id \
AND user_auth.username = 'zhangsan' \
AND (host.hostname = '10.0.0.1' \
OR host.hostname = '10.0.0.2') \
INTO OUTFILE '/tmp/zhangsan';
,这里是生成待执行的sql语句的文件,这里是/tmp/zhangsan。
最后,再把/tmp/zhangsan里的内容拷贝出来,粘贴上,执行。
公司要搭一个报警监控系统,感觉到zabbix能干全活儿,不变用再nagios+cacti了,况且zabbix也支持snmp agent……
好啦,zabbix 1.8.x搭好了
却发现……模板templates_linux里的所有items里的type都是Zabbix agent!倒是可以点进去将其改成snmp agent,可tnd谁记得其对应的oid呀!!
nnd,浪费我的时间跟感情。
特此忠告想用zabbix通过snmp来监控linux服务器的同学们请注意:别浪费你的时间了。
近期评论