Search This Blog

Showing posts with label Nagios. Show all posts
Showing posts with label Nagios. Show all posts

Monday, July 13, 2015

Centos 7 check_mk agent quick install


  1. First Install the package:


  2. yum install check-mk-agent

  3. Then Change the /etc/xinetd.d/check-mk-agent:

  4. # configure the IP address(es) of your Nagios server here:
    only_from      = 127.0.0.1 192.168.1.31

  5. Start xinetd service:

  6. systemctl start  xinetd.service
    systemctl enable xinetd.service

  7. Allow firewalld on port 6556:

  8. firewall-cmd --add-port=6556/tcp --permanent
    firewall-cmd --reload

Friday, November 14, 2014

Magento on HHVM 3.3 Nginx 1.6 on Ubuntu 14.04 trusty

No more Varnish! Love HHVM!

1.First this VPS box running Ubuntu 14.04 trusty 64 bit with 2 GB Memory and 2 Core CPU.
Please follow HHVM, Nginx and MariaDB 's offical installation guide to install:





After installation I have these files under /etc/apt/sources.list.d/:
nginx.list
deb http://nginx.org/packages/ubuntu/ trusty nginx


mariadb.list
deb http://mariadb.mirror.iweb.com//repo/10.0/ubuntu trusty main


hhvm.list
deb http://dl.hhvm.com/ubuntu trusty main


At this moment I have the version:

root@mds-magento:/var/www/magento/includes# dpkg -l|grep hhvm
ii hhvm 3.3.0~trusty amd64 HHVM virtual machine, runtime, and JIT for the PHP language
root@mds-magento:/var/www/magento/includes# dpkg -l|grep nginx
ii nginx 1.6.2-1~trusty amd64 high performance web server
root@mds-magento:/etc/apt/sources.list.d# dpkg -l|grep mariadb
ii libmariadbclient18 10.0.14+maria-1~trusty amd64 MariaDB database client library
ii mariadb-client-10.0 10.0.14+maria-1~trusty amd64 MariaDB database client binaries
ii mariadb-client-core-10.0 10.0.14+maria-1~trusty amd64 MariaDB database core client binaries
ii mariadb-common 10.0.14+maria-1~trusty all MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
ii mariadb-server 10.0.14+maria-1~trusty all MariaDB database server (metapackage depending on the latest version)
ii mariadb-server-10.0 10.0.14+maria-1~trusty amd64 MariaDB database server binaries
ii mariadb-server-core-10.0 10.0.14+maria-1~trusty amd64 MariaDB database core server files


2.Share my Nginx config file:
/etc/nginx/nginx.conf


user www-data;
worker_processes 2;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
autoindex off;
#tcp_nopush on;

map $scheme $fastcgi_https { ## Detect when HTTPS is used
default off;
https on;
}

keepalive_timeout 10;

gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript application/xml application/xml+rss text/javascript;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}


/etc/nginx/hhvm.conf

location ~ .(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


/etc/nginx/fastcgi_params


fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;


/etc/nginx/sites-enabled/magento

server {
listen 80;
server_name localhost;
rewrite / $scheme://www.$host$request_uri permanent; ## Forcibly prepend a www
}

server {
listen 80 default;

#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;

root /var/www/magento;

location / {
index index index.html index.htm index.php;
try_files $uri $uri/ @handler;
}

## These locations would be hidden by .htaccess normally
location ^~ /app/ { deny all; }
location ^~ /includes/ { deny all; }
location ^~ /lib/ { deny all; }
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/ { deny all; }
location ^~ /report/config.xml { deny all; }
location ^~ /var/ { deny all; }

location /. { ## Disable .htaccess and other hidden files
return 404;
}

location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}

location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}

location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss

expires off; ## Do not cache dynamic content
fastcgi_keep_conn on;
fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
}


3.My HHVM config file:

/etc/hhvm/server.ini

; php options

pid = /var/run/hhvm/pid

; hhvm specific

;hhvm.server.port = 9000
hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc


/etc/hhvm/php.ini

; php options

; hhvm specific
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false


Thank you for the kind sharing from:

http://bryanapperson.com/blog/intro-hhvm-mariadb-nginx-wordpress/
http://bryanapperson.com/blog/install-hhvm-nginx-ubuntu-14-04-make-wordpress-fly/
http://wiki.nginx.org/Install#Official_Debian.2FUbuntu_packages
https://udinra.com/blog/hhvm-fastcgi-nginx-speedup-php
http://stackoverflow.com/questions/23872439/nginx-rewrite-with-laravel-and-hhvm

Monday, April 21, 2014

Nagios 4.0.5 CentOS RHEL 6 SElinux issue

I always turn on the SELinux on my CentOS RHEL build.

After install the latest Nagios 4.0.5 from source, it shows internal server error.

It’s a permission issue of SELinux, run these two below commands to fix the error.


chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

Saturday, April 19, 2014

Nagios – Check Host without Ping

As my previous post about Firewall(iptables) on servers, I like to disable PING(ICMP) on my server.

But Nagios will mark them as [Down] when you using Nagios to monitor the server.

Solution:

If it is web hosting server, means HTTP is public accessible.

I do this on my Nagios 4.0.5 build:

/usr/local/nagios/etc/objects/templates.cfg

# NO PING web host
define host{
name generic-noping-webhost ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
check_command check_http ;
max_check_attempts 10 ; Check each server 10 times (max)
notification_interval 30 ; Resend notifications every 30 minutes
notification_period 24x7 ; Send host notifications at any time
notification_options d,u,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}


Then in the hosts.cfg define add:
define host{
use generic-noping-webhost
host_name bpt-milliondollarserver
alias bpt-milliondollarserver
address
}


Just in case your server doesn't event have HTTP service.
Try:

check_command                   check_dummy      ;

And define check_dump in commands.cfg

check_command                   check_tcp_port_1234;

Add define check_tcp -p 80 in commands.cfg

Replace:
check_command                   check_http      ;

Monday, January 28, 2013

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden Solved

After installing nagios monitoring tool. everything seem to be fine on local host.
Except HTTP deamon with warning HTTP/1.1 403 Forbidden.

To solve this..

simply create index.html file under http root directory.

#cd /var/www/html
#touch index.html


Restart web services.

#service httpd restart

Now restart you nagios services.

#/etc/init.d/nagios restart