MySQLにcacti用のデータベースを作成mysqladmin -u root -p create cacti mysql -u root -p cacti < /var/www/cacti/cacti.sql mysql -u root -p mysql GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘cactiuser’; flush privileges;
他PCからの閲覧を許可する場合には、以下を変更vi /etc/httpd/conf.d/cacti.conf Alias /cacti/ /var/www/cacti/ <Directory /var/www/cacti/> DirectoryIndex index.php Options -Indexes AllowOverride all order deny,allow deny from all allow from 127.0.0.1 allow from XXX.XXX.XXX.XXX 許可したいIP追加 AddType application/x-httpd-php .php php_flag magic_quotes_gpc on php_flag track_vars on </Directory>
http://(インストールしたサーバアドレス)/cacti/ にブラウザアクセス NEXT >>を選択 NEW Install >>を選択 SNMP Utility Version NET-SNMP 5.x RRDTool Utility Version RRDTool 1.2.x を選択 FINISHをクリック
ファイルの中身はこんな感じです。 # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing – SELinux security policy is enforced. # permissive – SELinux prints warnings instead of enforcing. # disabled – SELinux is fully disabled. SELINUX=enforcing # SELINUXTYPE= type of policy in use. Possible values are: # targeted – Only targeted network daemons are protected. # strict – Full SELinux protection. SELINUXTYPE=targeted
6行目をSELINUX=disabledと変更します。
変更後はこんな感じになります。 # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing – SELinux security policy is enforced. # permissive – SELinux prints warnings instead of enforcing. # disabled – SELinux is fully disabled. SELINUX=disabled #ここを変更しました # SELINUXTYPE= type of policy in use. Possible values are: # targeted – Only targeted network daemons are protected. # strict – Full SELinux protection. SELINUXTYPE=targeted
a = $*[0].split(‘ ‘).map{|i|i.to_i}+[nil] i = a[0] p a.inject([a[0].to_s]){|r, v| if i != v r << r.pop + “-#{i-1}” if 2 <= i – r.last.to_i break r unless v i = v r << i.to_s end i +=1 r }.join(‘, ‘)+’.’
# cd mybench-1.0 # ls META.yml Makefile.PL MyBench.pm bench_example # perl Makefile.PL Writing Makefile for mybench # ls META.yml Makefile Makefile.PL MyBench.pm bench_example
Makefileができました。
とりあえず、bench_exampleを実行してみる
# bench_example forking: ++++++++++ sleeping for 2 seconds while kids get ready waiting: DBD::mysql::st execute failed: called with 1 bind variables when 0 are needed at /usr/local/bin/bench_example line 42. DBD::mysql::st execute failed: called with 1 bind variables when 0 are needed at /usr/local/bin/bench_example line 42. (省略) Use of uninitialized value in numeric gt (>) at /usr/local/share/perl/5.8.8/MyBench.pm line 134. Illegal division by zero at /usr/local/share/perl/5.8.8/MyBench.pm line 115.
エラーが出ました・・・。
というか、実行方法がすでに違います。 実は、perlをさわるのは初めてで、よくわかっていません。
あらためて、
perl bench_exampleとして実行してみます
# perl bench_example forking: ++++++++++ sleeping for 2 seconds while kids get ready waiting: ———- Use of uninitialized value in scalar chomp at /usr/local/share/perl/5.8.8/MyBench.pm line 98. Use of uninitialized value in split at /usr/local/share/perl/5.8.8/MyBench.pm line 99. Use of uninitialized value in addition (+) at /usr/local/share/perl/5.8.8/MyBench.pm line 101. (省略) Use of uninitialized value in numeric gt (>) at /usr/local/share/perl/5.8.8/MyBench.pm line 134. Use of uninitialized value in numeric gt (>) at /usr/local/share/perl/5.8.8/MyBench.pm line 134. Illegal division by zero at /usr/local/share/perl/5.8.8/MyBench.pm line 115.
・・・bench_exampleの設定何一つ替えていないので、エラーが出るのも当たり前ですよ。
ということで、
bench_exampleの編集
# cp bench_example bench_example.org # vi bench_example
bench_exampleファイル
#!/usr/local/bin/perl -w
use strict; use MyBench; use Getopt::Std; use Time::HiRes qw(gettimeofday tv_interval); use DBI;
my %opt; Getopt::Std::getopt(‘n:r:h:’, \%opt);
my opt{n} || 10; my opt{r} || 100; my user = “test”; my port = 3306; my opt{h} || “192.168.0.1”; my db:port”;
my $callback = sub { my dbh = DBI->connect(user, sth = cnt = 0; my @times = ();
(以下略)
このファイルを以下のように編集
#!/usr/local/bin/perl -w
use strict; use MyBench; use Getopt::Std; use Time::HiRes qw(gettimeofday tv_interval); use DBI;
my %opt; Getopt::Std::getopt(‘n:r:h:’, \%opt);
my opt{n} || 10; my opt{r} || 100; my ここ(ベンチマークテストしたい名)user = “root”; <=ここ (上に記載したDBのユーザー) my port = 3306; my opt{h} || “localhost”; <=ここ(上に記載したDBがあるホスト) my db:port”;
my $callback = sub { my dbh = DBI->connect(user, sth = ここ(ベンチマークテストしたい文。)cnt = 0; my @times = ();
(以下略)
ちなみに、 36行目あたりにある
my のvが
my dbh->prepare(“SELECT * FROM users WHERE ID = ?”);
の?に入ります。
いざ実行!
# perl bench_example forking: ++++++++++ sleeping for 2 seconds while kids get ready waiting: ———- test: 1000 0.000173 0.367284 0.001990417 1.990417 5024.07284503699 clients : 10 queries : 1000 fastest : 0.000173 slowest : 0.367284 average : 0.001990417 serial : 1.990417 q/sec : 5024.07284503699
forking: ++++++++++ sleeping for 2 seconds while kids get ready waiting: ———- Use of uninitialized value in scalar chomp at /usr/local/share/perl/5.8.8/MyBench.pm line 98. Use of uninitialized value in split at /usr/local/share/perl/5.8.8/MyBench.pm line 99. Use of uninitialized value in addition (+) at /usr/local/share/perl/5.8.8/MyBench.pm line 101. (省略) Use of uninitialized value in numeric gt (>) at /usr/local/share/perl/5.8.8/MyBench.pm line 134. Use of uninitialized value in numeric gt (>) at /usr/local/share/perl/5.8.8/MyBench.pm line 134. Illegal division by zero at /usr/local/share/perl/5.8.8/MyBench.pm line 115.