给Linux监控软件Monitorix 3.5添加登录认证密钥

   monitorix是一个不错的Linux系统监控软件。很多可能不懂E文的朋友不知道怎么给Monitorix添加登录密钥。

    下面就来简单介绍下吧(Monitorix 安装的很简单,不懂可以留言):

    相关配置文件部分:

   

<httpd_builtin>
	enabled = y
	host =
	port = 8080
	user = nobody
	group = nogroup
	log_file = /var/log/monitorix-httpd
	hosts_deny =
	hosts_allow =
	<auth>
		enabled = y  # 这里要改为y
		msg = Monitorix: Restricted access
		htpasswd = /var/lib/monitorix/htpasswd
	</auth>
</httpd_builtin>

老外的英文密钥相关在这:

   htpasswd This option sets the path to the password file that was created with the help of the htpasswd.pl script. That script encrypts and validates passwords using the system’s crypt() routine. If your Monitorix package doesn’t come with that script, you may use the similar htpasswd(1) program provided with the Apache web server.

    The format of the password file consist of one or more lines with a username and password separated by a colon.

    The following is an example of a password file:

    paul:oGkEsQK6RYIII
peter:HF1r7qRL4Kg6E

    Since the script uses the crypt() algorithm, only the first 8 characters of the password are used to form the password. If the supplied password is longer, the extra characters will be silently discarded.

Default value: /var/lib/monitorix/htpasswd

    其实很多人卡壳就在怎么生成密钥,下面本人提供一个简单的Perl小脚本,用来生成密钥,添加到

   /var/lib/monitorix/htpasswd

    即可。

#!/usr/bin/perl
use strict;
my $pw=$ARGV[0];
print crypt($pw,$pw)."\n";

用法:./passwd.pl 密码

    OK,这样就可以了。

    原文转载本人自:http://www.jincon.com/archives/194/

    本人还搞了,#monitorix# 的中文翻译页面(还没翻译完,精力有限,慢慢翻译中):http://monitorix.jincon.com/

你可能感兴趣的:(monitorix​)