The HTTP response test get a false http status (401).ちょっと調べるとサイトにBASIC認証がかかっていると発生してしまうらしい。
認証解除すればOK、とのことだけど、認証する必要があるから認証かけてるわけで。
もうちょっと調べてみると、SettingsのNetworkにユーザIDとパスワード入れればいいらしい。
ちゃんと動いた!やったね!
The HTTP response test get a false http status (401).ちょっと調べるとサイトにBASIC認証がかかっていると発生してしまうらしい。
use File::Tail;
$file = File::Tail->new(name => "test.txt");
while( defined($line = $file->read)) {
print "$line";
}
ちょっと調べてみると、マニュアルにmaxintervalなるものがある。
maxinterval The maximum number of seconds (real number) that will be spent sleeping. Default is 60, meaning File::Tailwill never spend more than sixty seconds without checking the file.
$file->tail(-1);すれば出来ますよ、みたいなのを見つけてやってみたけど、動かない。
use File::Tail;
$file = File::Tail->new(name => "test.txt", maxinterval => 1, tail => -1) or die("cannot tail test.txt");
while( defined($line = $file->read)) {
print "$line";
}
ちゃんと動くようになった。
In December 2012, this issue occurred for many people when Microsoft messed up update KB931125 on December 11th 2012 by accidentally applying the root cert update to clients and servers, when it should've only been applied on clients. This added hundreds of 3rd-party root certificates to the trusted root certs list on servers, causing problems like you showed.どうやらMicrosoftがルート認証局の更新を間違って、サーバにも当ててしまったらしい。
Took me long enough to find it, but MS has an article and fix available at KB2801679 "SSL/TLS communication problems after you install KB 931125".The faulty update has since been expired on Windows Update and WSUS, but if you've already applied it, you can clean up the root cert list by running the Fix-it provided in the article on all affected servers.
use Net::Google::PicasaWeb; my $service = Net::Google::PicasaWeb->new; $service->login('YOUR USER ID','YOUR PASSWORD'); my @albums = $service->list_albums(user_id => 'YOUR USER ID'); foreach my $album (@albums) { print "Album ID: ", $album->entry_id, "\n"; mkdir $album->entry_id; my @photos = $album->list_media_entries; foreach my $photo (@photos) { my $media_info = $photo->photo; my $main_photo = $media_info->content; print "Image URL: ", $main_photo->url, "\n"; my $photo_data = $main_photo->fetch; $main_photo->fetch( file => $album->entry_id . "/" . $media_info->title ); } }
require 'rubygems'
version = '1.0.8'
gem 'coderay', version
print Gem.bin_path('coderay', 'coderay', version)
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
./getconfig.pl -h <ホスト名> -p <パスワード> -e <特権モードパスワード> で、sh run 結果を返してくれる。 まぁ、最初と最後に若干情報が出るけど…。#!/usr/bin/perl # オプション解析モジュールのロード use Getopt::Long; # Ciscoコマンド操作モジュールのロード use Net::Telnet::Cisco; # IPアドレス my $host = ''; # ユーザ名 my $username = ''; # vtyログインパスワード my $password = ''; # ENABLEモード パスワード my $epassword = ''; GetOptions( 'host=s' => \$host, 'username=s' => \$username, 'password=s' => \$password, 'epassword=s' => \$epassword ); # Cisco.pm用オブジェクトの作成 -> ルータに接続 my $obj_Session= Net::Telnet::Cisco->new( Host => $host ); # vtyパスワードを用いてログイン $obj_Session->login($username, $password, ); # enable $obj_Session->enable( $epassword ); # コマンドの実行 @cmd_output = $obj_Session->cmd('show running-config'); # コマンド実行結果のアウトプット print "Last command: <", $obj_Session->last_cmd, ">\n"; print "Last error: <", $obj_Session->errmsg, ">\n"; print "Cmd output: <", @cmd_output, ">\n"; exit 0;
$ ./get_config.pl -h 172.xxx.xxx.xxx -p password -e enable_passwordここからシェルスクリプトの出番。 最初3行と最後1行は不要なので、続くシェルスクリプトで削る。 あと、やってみると分かるけどntp clock-periodはよく変わるので、有用な情報とは言えないので削る。 Ciscoデバイスの名前、IPアドレス、ログインパスワード、特権モードパスワードをスペース区切りでテキストファイルに保存。 cisco_file.txtとしよう。 こんな感じ。
Last command:
Last error: <> Cmd output: Current configuration : 18623 bytes ! ! Last configuration change at 11:58:40 JST Fri Aug 17 2012 ! NVRAM config last updated at 11:05:37 JST Sat Aug 11 2012 ! ~(省略)~ end
>
SVNのワークディレクトリを作っておく とりあえずcisco_router1 172.xxx.xxx.xxx password1 enable_password1cisco_router2 172.yyy.yyy.yyy password2 enable_password2
#!/bin/bash
# Cisco機器のstartup-configファイルを取得し、リポジトリと違っていればコミットしておく
REPO=http://<リポジトリ>/networks/trunk
WORK_DIR=/home/foo/networks/trunk
PNAME=$( basename $0 )
# Cisco機器の名前、IPアドレス、ログインパスワード、Enableパスワードをスペース区切りで
CISCO_FILE=/home/foo/cisco_file.txt
get_config()
{
typeset HOSTNAME=$1
typeset HOST=$2
typeset PASSWD=$3
typeset ENABLE_PASSWD=$4
./get_config.pl -h $HOST -p $PASSWD -e $ENABLE_PASSWD | sed '/^ntp clock-period/d' | sed -e '1,3d' | sed -e '$d' > $WORK_DIR/${HOSTNAME}.config
}
while read LINE
do
get_config $LINE
done < $CISCO_FILE
if [ "$1" != "" ]
then
echo "You can commit by $ svn commit -m \"comments\" $WORK_DIR"
else
svn commit --username --password -m "Change detected. Automatically commited by $PNAME" $WORK_DIR
fi
これをcheckciscoconfig.shと命名して、crontabで毎晩23:30とかに仕込んでおけば、その日の変更は必ずコミットされる。30 23 * * * /home/foo/checkciscoconfig.sh > /dev/nullコメントは実態を反映していないけど、「忘れた!」よりマシという考え。
3. 上記スクリプトにエクスポートした*.regファイルを与えると、標準出力に吐き出すので、リダイレクトさせてttpmenu.iniを作成#!/bin/bash while read LINE do echo $LINE | sed s/\"//g | sed s/://g | sed "s/,/ /g" | sed s/dword//g | sed s/hex//g done < <( nkf --utf8 $1 | sed -e '1,2d' | sed "s/HKEY_CURRENT_USER\\\Software\\\ShinpeiTools\\\//g" | sed "s/TTermMenu\\\//g" )
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\n$LONGSERVICEOUTPUT" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
# /opt/redmine-<バージョン>/ctlscript.sh startでOK。
# cp /opt/redmine-<バージョン>/ctlscript.sh /etc/init.d/bitnami-redmineとしただけではダメで、ちょっと編集しないといけないらしい。
#!/bin/shrunラベルが2345のときは起動して、起動の優先度を80、停止の優先度を30にしてくれるはず。
#
# chkconfig: 2345 80 30
# description: BitNami Service
# chkconfig --add bitnami-redmine
# chkconfig --list bitnami-redmine
bitnami-redmine 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# ll /etc/rc.d/rc3.d/*bitnami*さらにrc0.dを見るとK30となってました
lrwxrwxrwx 1 root root 25 2月 17 16:33 /etc/rc.d/rc3.d/S80bitnami-redmine -> ../init.d/bitnami-redmine
# ll /etc/rc.d/rc0.d/*bitnami*
lrwxrwxrwx 1 root root 25 2月 17 16:33 /etc/rc.d/rc0.d/K30bitnami-redmine -> ../init.d/bitnami-redmine
#!/bin/sh PID=$$ PPID=$( UNIX95="" ps -o ppid -p $PID | tail -1 ) PCOMM=$( UNIX95="" ps -o comm -p $PPID | tail -1 ) echo PID: $PID echo PPID: $PPID echo PPCOM: $PCOMM
% sh ./test.sh
PID: 27324
PPID: 25107
PPCOM: -zsh
PPID=$( UNIX95="" ps -o ppid -p $PID | tail -1 )
ps -o pidとしても
ps: オプションが正しくありません。-- oとか出てくる。
% UNIX95="dummy" ps -o pid
PID
26857
25107
# wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bashコマンドだけあればいいので、srvadmin-baseとsrvadmin-storageservicesをyumでインストール
# yum install srvadmin-base srvadmin-storageservicesインストール完了後、勇んでコマンドを打ってみる
# omreport「あれ?」と思い、ログを見たら
-bash: omreport: command not found
**********************************************************としっかり書いてありました。
After the install process completes, you may need
to log out and then log in again to reset the PATH
variable to access the Dell OpenManage CLI utilities
**********************************************************
# omreport chassis memoryえ、メモリが見えないって…。
Memory Information
Error : Memory object not found
# /opt/dell/srvadmin/sbin/srvadmin-services.sh startあら、何かエラーだ。
Starting Systems Management Device Drivers:
Starting dcdbas: [ OK ]
Starting dell_rbu: [ OK ]
Starting Systems Management Data Engine:
Starting dsm_sa_datamgrd: [ OK ]
Starting dsm_sa_eventmgrd: [ OK ]
Starting DSM SA Shared Services: [ OK ]
libstdc++.so.5 is required to run the Inventory Collector.
# yum install compat-libstdc++-33サービスの再起動
# /opt/dell/srvadmin/sbin/srvadmin-services.sh restartエラーもなし。毎回ここで起動するのも面倒。
Shutting down DSM SA Shared Services: [ OK ]
Stopping Systems Management Data Engine:
Stopping dsm_sa_eventmgrd: [ OK ]
Stopping dsm_sa_datamgrd: [ OK ]
Stopping Systems Management Device Drivers:
Stopping dcdbas: [ OK ]
Stopping dell_rbu: [ OK ]
Starting Systems Management Device Drivers:
Starting dcdbas: [ OK ]
Starting dell_rbu: [ OK ]
Starting Systems Management Data Engine:
Starting dsm_sa_datamgrd: [ OK ]
Starting dsm_sa_eventmgrd: [ OK ]
Starting DSM SA Shared Services: [ OK ]
# /opt/dell/srvadmin/sbin/srvadmin-services.sh enable
instsvcdrv 0:on 1:off 2:off 3:on 4:on 5:on 6:on
dataeng 0:off 1:off 2:off 3:on 4:on 5:on 6:off
dsm_om_shrsvc 0:off 1:off 2:off 3:on 4:on 5:on 6:off
# omreport storage pdisk controller=0
List of Physical Disks on Controller SAS 6/iR Adapter (Slot 2)
Controller SAS 6/iR Adapter (Slot 2)
ID : 0:0
Status : Ok
Name : Physical Disk 0:0
State : Online
~(略)~
ID : 0:1
Status : Ok
Name : Physical Disk 0:1
State : Online
~(略)~
function pg_query_test( $conn )
{
$sql = "INSERT INTO NO_EXIST_TABLE VALUES ( 1 );";
// エラー終了させないようエラーハンドラをセット
set_error_handler( "my_error_handler" );
$result = pg_query( $conn, $sql );
restore_error_handler();if ( $result )
{
return true;
}
else
{
return false;
}
}
function my_error_handler( $errno, $errstr, $errfile, $errline )
{
echo "[errno]: $errno\n";
echo "[errstr]: $errstr\n";
echo "[errfile]: $errfile\n";
echo "[errline]: $errline\n";
}
?>
error_reporting = E_ALLとなっているのを発見。
SELECT 'hoge ' || field1::char(20) FROM table1;というように書いた。
hoge AAA↵(改行コード)というように勝手にトリム(trim)されている。
SELECT 'hoge ' || rpad( field1, 20 ) FROM table1;というようにしたら大丈夫になりました。