Tuesday, February 27, 2018

How to tune the NIC Ring Buffers (RX,TX) on network interface ?


Modern and performance/server grade network interface have the capability of using transmit and receive buffer description ring into the main memory. They use direct memory access (DMA) to transfer packets from the main memory to carry packets independently from the CPU.
The usual default buffering values for regular desktop NICs are 256 or 512 bytes. High performances NICs can achieve up to 4096 and/or 8192 bytes.
To view the capability and the current values of your interface, you’ll need “ethtool”. Simply do the following command :
ethtool -g interfacename
           g  --show-ring
ethtool -g eth0

This will output something like this :

ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096
Current hardware settings:
RX: 256
RX Mini: 0
RX Jumbo: 0
TX: 256

Here we have two sections in our output. The first section is “Pre-set maximums” which tells us the maximum values that could be set for each available parameter. The second section shows us to what each parameter is currently set. We are most interested in the top most parameter labeled simply “RX” which is our receive ring buffer.
Buffers are generally tuned small for latency reasons. The smaller the buffer the lower the latency. But low latency comes at a price and that price is maximum throughput. For greater throughput we need a larger buffer. Factory defaults are good, generally, for most systems but don’t be afraid to tune this for your own scenario.


We can see here that both RX and TX values are set to 256 but the interface have the capability of 4096 bytes.
To increase the buffers, do the following :
ethtool -G|--set-ring devname [rx N] [rx-mini N] [rx-jumbo N] [tx N]
ethtool -G eth0 rx 4096 tx 4096

This will output something like this :

ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096
Current hardware settings:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096





Thursday, February 22, 2018

what is the difference between zabbix passive checks & active checks ?

Zabbix agents support both passive (polling) and active checks (trapping). Zabbix may perform checks based on an interval, however, it is also possible to schedule specific times for item polling.

Passive checks (polling):

  • Zabbix server (or proxy) requests a value from Zabbix agent
  • Agent processes the request and returns the value to Zabbix server (or proxy)
Zabbix server or proxy asks for some data (for example, CPU load) and Zabbix agent sends back the result to the server.
Example: agent ping
  1. Server opens a TCP connection
  2. Server sends agent.ping\n
  3. Agent reads the request and response with <HEADER><DATALEN>1
  4. Server processes data to get the value, ‘1’ in our case
  5. TCP connection is closed
Active checks (trapping):
  • Zabbix agent requests from Zabbix server (or proxy) a list of active checks
  • Agent sends the results in periodically

Active checks require more complex processing. The agent must first retrieve from the server(s) a list of items for independent processing.

For example:
  1. Agent opens a TCP connection
  2. Agent asks for the list of checks
  3. Server responds with a list of items (item key, delay)
  4. Agent parses the response
  5. TCP connection is closed
  6. Agent starts periodical collection of data

Zabbix Trapper

Trapper items accept incoming data instead of querying for it.It is useful for any data you might want to “push” into Zabbix.

To use a trapper item you must:

  1. have a trapper item set up in Zabbix
  2. send in the data into Zabbix(with zabbix_sender)

How to install zabbix agent on windows ?


Zabbix Agent is installed on remote systems needs to monitor through Zabbix server. The Zabbix agent collects resource utilization and applications data on client system and provide such information to zabbix server on their requests.
install Zabbix agent service on windows system
Step 1 – Download Agent Source Code

Download latest windows zabbix agent source code from zabbix official site or use below link to download zabbix agent 3.0.0.
After downloading the zipped archive of zabbix client, extract its content under c:\zabbix directory.
Step 2 – Create Agent Configuration File
Now make of copy of sample configuration file c:\zabbix\conf\zabbix_agentd.win.conf to create zabbix agent configuration file at c:\zabbix\zabbix_agentd.conf. Now edit configuration and update following values.
#Server=[zabbix server ip]
#Hostname=[Hostname of client system ]

Server=192.168.1.26
Serveractive=192.168.1.26
Hostname=linuxforfreshers.com
Step 3: Install Zabbix Agent as Windows Service
Lets install zabbix agent as windows server by executing following command from command line.
c:\zabbix\bin\win64> zabbix_agentd.exe -c c:\zabbix\zabbix_agentd.conf --install

zabbix_agentd.exe [9084]: service [Zabbix Agent] installed successfully
zabbix_agentd.exe [9084]: event source [Zabbix Agent] installed successfully
Step 4 – Start/Stop Agent Service
Use following command to start zabbix agent service from command line
c:\zabbix\bin\win64> zabbix_agentd.exe --start

zabbix_agentd.exe [7048]: service [Zabbix Agent] started successfully
c:\zabbix\bin\win64> zabbix_agentd.exe --stop

zabbix_agentd.exe [9608]: service [Zabbix Agent] stopped successfully
Uninstalling agent
c:\zabbix\bin\win64> zabbix_agentd.exe -c c:\zabbix\zabbix_agentd.conf --uninstall

Wednesday, February 14, 2018

what is the difference between apt-get remove and purge and autoremove in ubuntu?

apt-get remove vs  purge vs autoremove

Let's explain this by taking wget package as the one to be removed.
remove

apt-get remove wget
This removes the wget binaries, but it's configuration files and installed dependencies will remain in the system.
purge

apt-get purge wget
This removes the package as well as its configuration files. But the dependencies will remain in the system. However, configuration files in the home directory won't get removed.
This command is same as using --purge option with the above remove command.
autoremove

apt-get autoremove wget
This will remove the package as well as its dependencies, if those dependencies aren't used by other packages.
apt-get autoremove
If the package name is not specified with autoremove, it will remove all the unused dependencies in the system.

Tuesday, February 13, 2018

how to install and configure zabbix agent on linux ?

Zabbix Agent is required to install on all remote systems needs to monitor through Zabbix server. The Zabbix Agent collects resource utilization and applications data on the client system and provides such information to Zabbix server on their requests.
There are two types of checks can be configured between Zabbix Server and Client.
  • Passive check Zabbix Agent only sent data to server on their request.
  • Active check – Zabbix Agent sends data periodically to Server.
After installing zabbix server on your server, this article will help you to install zabbix agent on Ubuntu 16.04 LTS, 14.04 LTS, and Debian 9/8 systems. After completing this below steps go to next article add host in zabbix server.
Step 1 – Enable Apt Repository
Zabbix apt repositories are available on Zabbix official website. Add the repository to install required packages for Zabbix agent using the following command. For the older version of Ubuntu 12.04 LTS can download and install Zabbix agent version 2.2.
On Ubuntu systems & Debian
In RHEL system
wget
Step 2 – Install Zabbix Agent
As you have successfully added Zabbix apt repositories in your system let’s use the following command to install Zabbix agent using the following command
On Ubuntu & Debian based systems
sudo apt-get update
sudo apt-get install zabbix-agent
In RHEL Based Systems.
rpm -Uvh  zabbix-agent-3.4.0-1.el7.x86_64.rpm
Step 3 – Edit Zabbix Agent Configuration
After installing completed of Zabbix aget. Edit zabbix agent configuration file /etc/zabbix/zabbix_agentd.conf and update Zabbix server ip
#Server=[zabbix server ip]
#Hostname=[Hostname of client system ]

Server=
192.168.101.25
ServerActive=192.168.101.25
Hostname=linuxforfreshers.com
Where
Server=IP of Zabbix Server
ServerActive=IP of Zabbix Server
Hostname=use the hostname of the node where the agent runs
Step 4 – Adding port 10050 to firewall
If your system is behind a firewall then you need to open 10050/tcp port on the system in order to reach through Zabbix server.
For Debian based systems, including Ubuntu, you can use ufw tool to open the port and on RHEL 7 you can use Firewalld utility to manage the firewall rules as the below examples:
On Debian based systems
sudo ufw allow 10050/tcp
On RHEL/CENTOS 7 systems
sudo firewall-cmd --add-port=10050/tcp --permanent
For older distributions such as centOS/Rhel 6 or unmanaged firewalls through specific utilities use the powerful iptables command to open ports:
iptables -A INPUT -p tcp -m tcp --dport 10050 -j ACCEPT
Step 5 – Restarting Zabbix Agent
After adding Zabbix server IP in the configuration file, now restart agent service using below command.
sudo service zabbix-agent restart
Troubleshooting
Finally, in order to test if you can reach Zabbix Agent from Zabbix Server, use Telnet command from Zabbix server machine to the IP addresses of the machines that run the agents, as illustrated below (don’t worry about the thrown error from agents):
telnet zabbix_agent_IP 10050
[ram@zabbixserver]$ telnet 192.168.101.26 10050
Trying 192.168.101.26...
Connected to 192.168.101.26 (192.168.101.26).
Escape character is '^]'.
ZBXD)ZBX_NOTSUPPORTEDInvalid item key format.Connection closed by foreign host







Saturday, February 10, 2018

How to test if your zabbix server receive data from zabbix client or not?



you have installed zabbix agent on your server. Process zabbix client is up and running but does zabbix server start to receive data from it?

Simplest way to this is to connect to your zabbix server and initiate zabbix_get command! With this command can get to see data from zabbix client.

 zabbix_get - Zabbix get utility.

Syntax:

ram@zabbixserver:~$  zabbix_get -s IP_ZABBIX_CLIENT -k ZABBIX_ITEM


Where  -s, --host <host name or IP>
              Specify host name or IP address of a host.

             -k, --key <item key>
              Specify key of item to retrieve value for.

Test the connection between zabbix_server to client.

ram@zabbixserver:~$ zabbix_get -s 192.168.101.26 -k agent.ping
1

If u get output 1 means connection is ok and data is received from 192.168.101.26

ram@zabbixserver:~$ zabbix_get -s 192.168.101.26 -k agent.ping

zabbix_get [31561]: Get value error: cannot connect to [[192.168.101.26 ]:10050]: [111] Connection refused

server 192.168.101.26 but zabbix agent is not installed, not running or firewall is blocking or network problem !!

How to check agent version from zabbix server ?

Using zabbix_get command u can easily get agent version.


ram@zabbixserver:~$zabbix_get -s 192.168.101.26 -k agent.version
3.0.6

Get any information from client host without login to host server using zabbix_get command for example load average.

ram@zabbixserver:~$zabbix_get -s 192.168.101.26 -k "system.cpu.load[all,avg5]"
0.410000