Database Monitoring with PRTG Monitoring your databases enables you to ensure that queries are processed in time.

Monitoring your databases enables you to ensure that, on the one hand, database queries are processed in time, and, on the other hand, that the database itself performs within the defined parameters. Furthermore, database monitoring with PRTG makes it possible to be alerted via a corresponding sensor status if database queries return an unexpected result value.

PRTG comes with built-in native sensors for the most common databases:

  • Microsoft SQL servers
  • MySQL servers
  • PostgreSQL servers
  • Oracle SQL servers

It is also possible to monitor many other database servers. For this concern, PRTG uses the ActiveX Data Objects (ADO) interface.

There are two types of database sensors:

Sensors monitoring databases directly: Monitor databases from the user perspective. These sensors send a request to the database server and receive corresponding values. You can optionally process data tables and show values in individual channels or monitor transactions.
Sensors monitoring database performance: Monitor databases with a more abstract view on the servers. Usually, these sensors monitor performance counters via Windows Management Instrumentation (WMI).
SENSORS MONITORING DATABASES DIRECTLY

PRTG provides several sensors that can “look into” the content of databases. Sensors of this type connect to the database server, execute a defined query, and show the execution time of the whole request and the query. You can use these sensors to process the data table and show requested values in individual channels.

The following sensor types are available for this kind of monitoring:

  • Microsoft SQL v2 Sensor: Monitor your Microsoft SQL server 2005 or later.
  • MySQL v2 Sensor: Monitor your MySQL server version 5.0 or later.
  • Oracle SQL v2 Sensor: Monitor your Oracle database server version 10.2 or later.
  • PostgreSQL Sensor: Monitor your PostgreSQL database version 7.x or later.

For these sensor types, you can define valid SQL statements that the sensors send to the database server. Define the queries in an SQL script file and store it into the respective \Custom Sensors\sql\ subfolder of your PRTG installation (see section Data Storage for details).

You can select this SQL script when you add the sensor to PRTG. With every scanning interval, the sensor executes this script with the defined query against the database and the database returns corresponding values in individual channels (see the example below for sample channel value selections). Use the Sensor Channels Settings to define limits for specific values.

icon-i-round-redThese sensor types need .NET 4.5 or later installed on the computer running the PRTG probe.

Alternatively, you can monitor almost all available database servers with the ADO SQL v2 Sensor via an ActiveX Data Objects (ADO) connection.

 

Related Article: PRTG MANUAL: MONITORING DATABASES

How To Extend Datastore Capacity in the vSphere Client When your Datastore require more space, you can dynamically increase the capacity

Use one of the following methods to increase a VMFS datastore:

  • Add a new extent. An extent is a partition on a storage device. You can add up to 32 extents of the same storage type to an existing VMFS datastore. The spanned VMFS datastore can use any or all of its extents at any time. It does not need to fill up a particular extent before using the next one.
  • Grow an extent in an existing VMFS datastore, so that it fills the available adjacent capacity. Only extents with free space immediately after them are expandable.

Note
If a shared datastore has powered on virtual machines and becomes 100% full, you can increase the datastore’s capacity only from the host with which the powered on virtual machines are registered.

Prerequisites

Required privilege: Host.Configuration. Storage Partition Configuration

Procedure

Log in to the vSphere Client and select a host from the Inventory panel.

Click the Configuration tab and click Storage.

From the Datastores view, select the datastore to increase and click Properties.

Extend Datastore ESXi
Extend Datastore ESXi
Click Increase.

Select a device from the list of storage devices and click Next.

Extend Datastore ESXi
Extend Datastore ESXi
Extend Datastore ESXi
Extend Datastore ESXi

Option

To add a new extent – Select the device for which the Expandable column reads NO.

To expand an existing extent – Select the device for which the Expandable column reads YES

Review the Current Disk Layout to see the available configurations and click Next.

Select a configuration option from the bottom panel.

Depending on the current layout of the disk and on your previous selections, the options you see might vary.

Option

Use free space to add new extent – Adds the free space on this disk as a new extent.

Use free space to expand existing extent – Expands an existing extent to a required capacity.

Use free space – Deploys an extent in the remaining free space of the disk. This option is available only when you are adding an extent.

Use all available partitions – Dedicates the entire disk to a single extent. This option is available only when you are adding an extent and when the disk you are formatting is not blank. The disk is reformatted, and the datastores and any data that it contains are erased.

Extend Datastore ESXi
Extend Datastore ESXi

Set the capacity for the extent.

The minimum extent size is 1.3GB. By default, the entire free space on the storage device is available.

Click Next.

Extend Datastore ESXi
Extend Datastore ESXi

Review the proposed layout and the new configuration of your datastore, and click Finish.

Extend Datastore ESXi
Extend Datastore ESXi

What to do next

After you grow an extent in a shared VMFS datastore, refresh the datastore on each host that can access this datastore, so that the vSphere Client can display the correct datastore capacity for all hosts.

Related Article: Increase VMFS Datastore Capacity in the vSphere Client

List for troubleshooting Process and threads on Linux

To the get the sum of all threads running in the system:

ps -eo nlwp | tail -n +2 | awk '{ num_threads += $1 } END { print num_threads }'

To get the number of threads for a given pid:

ps -o nlwp <pid>

Locate a Process

top

or

ps

To display all process names, use the following command –

$ ps -e

List the process associated with  a service/program

ps aux | grep my_service /  PID

To Kill a Process

kill PID

To see the thread count of process, use the following command-

$ cat /proc/<pid>/status

Configure IPTABLES to Allow Access to Common Services This article gives the steps to open firewall ports on CentOS in Iptables IPv4

Basics

  • Iptables rules can be changed on the fly by using the iptables binary.
  • The rules that are set using iptables command are in memory only and will vanish when the daemon is restarted.
  • The firewall rules added on the fly can be saved to the configuration file easily in CentOS/RHEL with the command service iptables save
    • This is no need to edit the configuration file unless you really want to.
  • The following examples are aimed at hardening the inbound traffic, but allowing all outbound traffic.
    • You can completely lock down all inbound, outbound and forwarded traffic if needed. It generally just causes a lot more administration and usually isn’t necessary.

Basic Commands

iptables –flush delete all firewall rules from memory.
iptables –list List current firewall policies
service iptables save (CentOS/RHEL) save current rules in memory to configuration file (/etc/sysconfig/iptables)
service iptables restart restart iptables daemon and load firewall rules from configuration file.
iptables-save > /root/firwallrules.fw save firewall rules in memory to a specific configuration file.
iptables-restore > /root/firwallrules.fw restore firewall rules from a specific configuration file to memory.

Basic iptables Command Parameters

  • -A append to policy chain
  • INPUT | OUTPUT | FORWARD policy chain identifiers
  • -p protocol
  • -m match
  • -s source
  • –dport destination port
  • –state connection state
  • -j jump target ACCEPT | DROP

Backup Current Iptables Configuration to File

Before you begin, it is recommended to backup your current firewall rules.

iptables-save > /path/to/somewhere/filename

Example:

iptables-save > /home/user1/iptable-rules-20130308.fw

Remove All Current Rules

iptables --flush

Set Policy Chains Default Rule

iptables -P INPUT DROP
 iptables -P OUTPUT ACCEPT
 iptables -P FORWARD ACCEPT

Allow Loopback

iptables -A INPUT -i lo -j ACCEPT

Allow All Established and Related Connections

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

Allow ICMP “ping” from LAN (TCP Port 22)

iptables -A INPUT -p icmp -m icmp -s 192.168.0.0/24 --icmp-type echo-request -j ACCEPT

Allow SSH from LAN (TCP Port 22)

iptables -A INPUT -p tcp -m tcp -s 192.168.0.0/24 --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT

Allow RSYNC from LAN (TCP Port 873)

iptables -A INPUT -p tcp -m tcp -s 192.168.0.0/24 --dport 873 -m state --state NEW,ESTABLISHED -j ACCEPT

Allow HTTP (TCP Port 80)

iptables -A INPUT -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

Allow HTTPS (TCP Port 443)

iptables -A INPUT -p tcp -m tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT

Allow MySQL Server Access from LAN (TCP Port 3306)

iptables -A INPUT -p tcp -m tcp -s 192.168.0.0/24 --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT

Allow Nagios NRPE Client Access from Nagios Server (TCP Port 5666)

iptables -A INPUT -s 192.168.0.100 -p tcp -m tcp --dport 5666 -m state --state NEW,ESTABLISHED -j ACCEPT

Save Current Rules in Memory to Configuration File

service iptables save

Restart Service

service iptables restart

iptables: insert a rule at a specific line number

# list the rules with line numbers

iptables -nL --line-numbers

# insert a rule at line 5

iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 4000 -j ACCEPT

Related Articles: Configure iptablesiptables: insert a rule at a specific line number

How To Prevent Yum Upgrade Kernel On CentOS / Red Hat How do I exclude kernel or other packages from getting updated via yum?

You can prevent yum command from updating the Kernel permanently by following the simple steps.

Option #1: Edit /etc/yum.conf file

Use a text editor such as vi to edit /etc/yum.conf:

# vi /etc/yum.conf

Append/modify exclude directive line under [main] section, enter:

exclude=kernel*

Save and close the file. Try, updating the system without updating the Linux kernel:

# yum -y update

This is a permanent option, so you don’t need pass the -x option to yum command.

Option #2: Pass the -x option to prevent yum from updating kernel
The syntax is as follows to skip update on command line itself:

# yum -x 'kernel*' update

On Red Hat Enterprise Linux

The up2date command in Red Hat Enterprise Linux 4 excludes kernel updates by default. The yum in Red Hat Enterprise Linux 5 includes kernel updates by default.
To skip installing or updating kernel or other packages while using the yum update utility in Red Hat Enterprise Linux 5 and 6, use following options
Temporary solution via Command line:

# yum update --exclude=PACKAGENAME

For example, to exclude all kernel related packages:

# yum update --exclude=kernel*

To make permanent changes, edit the /etc/yum.conf file and following entries to it:

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exclude=kernel* redhat-release*

Related Article: Prevent Yum From Upgrading The Kernel | Exclude kernel or other packages from getting updated in Red Hat Enterprise