System Engineering

When Nagios send alert mails with attachement…

Posted on

When Nagios send alert mails with attachement… Perhaps this problem is that if a device name or warning message include non-Latin characters.   1. Add new command to nagios configuration Original commands # ‘notify-host-by-email’ command definition define command{ command_name notify-host-by-email command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” | /usr/bin/mail -s “** $NOTIFICATIONTYPE$ Host […]

Developments

Using request of JSON Payload in Slim framework

Posted on
Slim Framework

How to enable JSON-Payload input in Slim Framework… SlimMiddlewareContentTypes.php <?php /** * Middleware SlimMiddlewareContentTypes (for JSON Payload requests) * 2015/03/12 * Aiden Kim */ class SlimMiddlewareContentTypes extends \Slim\Middleware\ContentTypes { public function call() { $mediaType = $this->app->request->getMediaType(); if ( isset($this->contentTypes[$mediaType]) && !$this->app->request->isGet() && !$this->app->request->isHead() ) { $env = $this->app->environment(); // Parse request data $form_hash = $this->parse($env[‘slim.input’], […]

System Engineering

Install nginx + php-fpm on openSUSE

Posted on

1. Download and install packages zypper install nginx php5-fpm chmod 1733 /var/lib/php5 2. Configure php-fpm cp -p /etc/php5/fpm/php-fpm.conf.default /etc/php5/fpm/php-fpm.conf vi /etc/php5/fpm/php-fpm.conf include=/etc/php5/fpm/vhosts.d/*.conf pm.max_children = 30 rlimit_files = 102400 catch_workers_output = yes emergency_restart_threshold 10 emergency_restart_interval 30s process_control_timeout 10s ;listen = 127.0.0.1:9000 listen = /var/run/php5-fpm.sock listen.owner = nginx error_log = /var/log/php-fpm/php-fpm.log security.limit_extensions = .php .do .json .soap 3. […]

Developments

Install PHP-Screw 1.5 on openSUSE

Posted on

1. Download & Prepare cd /usr/local/src wget -O php_screw-1.5.tar.gz http://downloads.sourceforge.net/project/php-screw/php-screw/1.5/php_screw-1.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fphp-screw%2F tar -zxvf php_screw-1.5.tar.gz cd php_screw-1.5 /usr/bin/phpize 2. Change encryption seed vi my_screw.h # change seed to your random value 3. Compile module ./configure –with-php-config=/usr/bin/php-config make If you get error with below message… Comment out 124 & 133 lines those include CG(extended_info) = 1;  in php_screw.c Then try compile again.  php_screw-1.5/php_screw.c:133: error: ‘struct _zend_compiler_globals’ has no […]

Developments

[PHP5] Thumbnail Class

Posted on

원래 십여년전(?)부터 뜯어고쳐 오며 사용하던 소스를 좀 정리했다. 이전에 GD를 직접 컨트롤 했었는데 조금 찾아보니 WideImage 란 라리브러리가 있기에, 그걸로 바꾸다보니 워낙 기능이 막강해서 정작 내가 만든 클래스는 Wrapping Class가 되어 버렸다 ;; 어쨋든, 밤하늘의 별처럼 널려있는 썸네일 라이브러리들을 마다하고 만든 이유는 단 두가지 이다. 썸네일의 종횡비율에 따라 중앙부분을 기준으로 Crop해서 썸네일을 만들어 주는 기능 PNG포맷에서 Resizing시 […]