Crmgo Blog

Blog

Blog

Zabbix-agent + monitoring of MySQL, Nginx, php-fpm on CentOS

Zabbix-agent + monitoring of MySQL, Nginx, php-fpm on CentOS

· Zabbix

chkconfig zabbix-agent on vim /etc/zabbix/zabbix_agentd.conf #Server=zabbix.domain.ua #ServerActive=zabbix.domain.ua #Hostname=MyServer #Include=/usr/local/etc/zabbix2/zabbix_agentd.d/ mkdir /etc/zabbix/zabbix_agentd.d/ service zabbix-agent start MYSQL mysql> GRANT USAGE ON *.* TO 'zabbix'@'%' IDENTIFIED BY 'mypass'; FLUSH PRIVILEGES; vim /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N |…

Bash script for call transfer

Bash script for call transfer

· Asterisk

#!/bin/bash context="from-internal" # set the context to which we will transfer the call exten=$1 # get the operator's number num=$2 # get the external or internal number to which the transfer will be made bridge=$(asterisk -rx 'core show channels concise' | grep SIP/$exten -…

KVM, USB Device Passthrough

KVM, USB Device Passthrough

· KVM

Find out which bus the USB device is on: # lsusb Bus 007 Device 002: ID 058f:6387 Alcor Micro Corp. Transcend JetFlash Flash Drive Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0001 Linux…

Deleting files older than X days

Deleting files older than X days

· bash

find /home/ -type f -mtime +7 -exec rm '{}' \; delete files smaller than 5KB find ./ -size -5k -delete delete files larger than 10MB find ./ -size +10m -delete

Installing TrueCrypt

Installing TrueCrypt

· Linux

Installing additional packages: For CentOS 6: yum install libfuse2 fuse-utils dmsetup For CentOS 7: yum install fuse fuse-devel device-mapper Installing TrueCrypt: Warning! Version 7.2 does not support encryption, so download version 7.1a: tar -xzvf truecrypt-7.1a-linux-console-x64.tar.gz sh truecrypt-7.1a-setup-console-x64 Create folders where we will...

Installing Owncloud 9 + Nginx + MariaDB on CentOS 7

Installing Owncloud 9 + Nginx + MariaDB on CentOS 7

· Linux

If the repository is not connected: sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm Install packages: yum -y install nginx mariadb mariadb-server php-fpm php-cli php-gd php-mcrypt php-mysql php-pear php-xml bzip2 wget Start MariaDB: systemctl start mariadb systemctl enable mariadb.service mysql_secure_installation php-fpm: vim /etc/php-fpm.d/www.conf mkdir -p /var/lib/php/session…

Configuring Encryption

Configuring Encryption

· Postfix

Information from Google: vim /etc/postfix/main.cf smtp_use_tls = yes smtp_tls_mandatory_ciphers = high smtp_tls_mandatory_protocols=!SSLv2,!SSLv3 tls_high_cipherlist = ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK smtpd_tls_mandatory_ciphers = high smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3 smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache service postfix restart

DKIM + Postfix + CentOS 7 (digital signature for email)

DKIM + Postfix + CentOS 7 (digital signature for email)

· Linux

server:/ # apt-get install opendkim opendkim-tools Create a separate folder for OpenDKIM and move the configuration file to this folder. For compatibility, leave a link in the previous location. 1 2 3 4 server:/ # mkdir /etc/opendkim server:/ # chown opendkim:opendkim /etc/opendkim server:/ #…

Checking the file system and disk for bad sectors

Checking the file system and disk for bad sectors

· Linux

sudo fsck -y -f -c /dev/sda1 If you see an error, you most likely need to unmount this partition: sudo umount /dev/sda1 Keys and parameters of the fsck command: y — always answer yes to all questions (there is an alternative: key p — starts the check in…

MySQL: Identifying Long-Running Queries

MySQL: Identifying Long-Running Queries

· MYSQL

[mysqld] long_query_time=1 log-slow-queries=/var/log/mysql/log-slow-queries.log long_query_time = 10 mkdir /var/log/mysql touch /var/log/mysql/log-slow-queries.log chown mysql.mysql -R /var/log/mysql

CentOS 7, Installing Jira

CentOS 7, Installing Jira

· Jira

Create the database and user: mysql -p Download the binary from https://www.atlassian.com/software/jira/download chmod a+x atlassian-jira-software-7.2.2-x64.bin ./atlassian-jira-software-7.2.2-x64.bin Answer the prompts. After installation, you can access Jira on port 8080. To connect to MySQL, we need the MySQL connector; download it from: http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.39.tar.gz tar…

Configuring Squid with NCSA Authentication

Configuring Squid with NCSA Authentication

· SQUID

yum install squid vim /etc/squid/squid.conf Attention! In version 3.3, the line needs to be replaced with If you have x64: Create a user: if apache is not installed: yum install httpd-tools # htpasswd -c /etc/squid/internet_users admin 1234567 To add another user, use: # htpasswd…

Variables in Asterisk

Variables in Asterisk

· Asterisk

Asterisk can use global and channel variables in command arguments. To reference a variable in the dialplan (extensions.conf), use the following syntax: ${foo}, where foo is the variable name. The variable name can consist of any sequence of digits and letters, and must start with...

Reading Lines from Files

Reading Lines from Files

· sed

Example 1: Output specific lines by their line numbers using the sed command. The command allows viewing only the desired lines with explicitly specified line numbers. Syntax: $ sed -n -e Xp -e Yp FILENAME sed: command,…