Showing posts with label Administrative Tools. Show all posts
Showing posts with label Administrative Tools. Show all posts

Sunday, May 4, 2014

How to enable remote connections in SQL Server 2008?

How to enable remote connections in SQL Server 2008?


You experience the following error message:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
SQL Server 2008: The server was not found or was not accessible.
How to solve this issue?
There are a couple of things that might be going on here… (All of the following configurations are made on the computer running your SQL Server 2008 instance)
Allow remote connections to this server
The first thing you want to check is if Remote Connections are enabled on your SQL Server database. In SQL Server 2008 you do this by opening SQL Server 2008 Management Studio, connect to the server in question, right click the server…
SQL Server 2008: Server Properties
… and open the Server Properties.
SQL Server 2008: Server Properties - Connections
Navigate to Connections and ensure that Allow remote connections to this server is checked. Check if this solves the problem. If it does, here you go, continue with whatever you were doing and have a nice day.
Protocols for MSSQLServer
If you’re still running in issues let’s dig a bit deeper. The next good thing to check is the SQL Server Network Configuration. Open the SQL Server Configuration Manager, unfold the node SQL Server Network Configuration and select Protocols for MSSQLServer (or whatever the name of your SQL Server instance is).
SQL Server 2008: Protocols for MSSQLServer
Make sure that TCP/IP is enabled and try again. Even though I hope that this resolved your problems there might still be an issue with…
The Firewall
If there is still no communication happening between your computer and the remote SQL Server you most likely need to configure your firewall settings. A good first step is to figure out which port is being used by TCP/IP (and which you need to open in your firewall). You can do this by right clicking TCP/IP and selecting Properties.
SQL Server 2008: TCP/IP Properties
Click on the tab IP Addresses and voilĂ  – Port 1433 it is :-) That was easy enough and all there is left to do is to allow inbound TCP/IP traffic on Port 1433 in your firewall. In Windows 7 this works something like this. Open the Control Panel and navigate to Windows Firewall.
Microsoft Windows 7 Firewall settings
Click on Advanced Settings on the left hand side and you should see the Windows Firewall with Advanced Security. Select the Inboud Rules on the left hand side and click on New Rule… on the right hand side.
Microsoft Windows 7 Firewall with Advanced Security
This opens the New Inbound Rule Wizard which you can use to allow inbound traffic on Port 1433 for TCP/IP (and which is exactly how you configured your SQL Server in the steps above). Just follow the steps outlined below and you should be good :-)
New Inbound Rule Wizard - Protocols and Ports
New Inbound Rule Wizard - Protocols and Ports
New Inbound Rule Wizard - Action
New Inbound Rule Wizard - Profile
New Inbound Rule Wizard - Name
That’s it, success! From here you should be able to access your SQL Server remotely. Enjoy!

Monday, April 14, 2014

Minor Upgrade of SmarterStats

Minor Upgrade of SmarterStats


The steps for upgrading from an older version of the application vary depending on which version you are upgrading from.

Applies to SmarterStats 8.x
Follow these steps to upgrade to the latest version of SmarterStats if you are upgrading from a previous 8.x release (for example from SmarterStats 8.0 to SmarterStats 8.1):

  1. Back up your SmarterStats installation and data.
  2. Download the latest automated installer from the SmarterStats Download page.
  3. If you are running SmarterStats as an IIS site, stop IIS.
  4. Run the SmarterStats installer.
  5. During the installation process you will be prompted for the installation path. Installation along the existing file path to keep data and settings. (The default installation location is C:\Program Files\SmarterTools\SmarterStats.)
  6. If you are running SmarterStats as an IIS site, restart IIS.
Note: All configuration data and sites are preserved when upgrading from a previous 8.x release.
 
Backwards Compatibility

When downgrading from SmarterStats 8.x (for example, to SmarterStats 6.x or 7.x), some settings will be lost or changed. For this reason, it is very important to create a backup of your SmarterStats installation prior to upgrading to SmarterStats 8.x. (For instructions on backing up SmarterStats, please search for article "How To – Back Up and Restore SmarterStats".)

Major Upgrade of SmarterStats

Major Upgrade of SmarterStats


The steps for upgrading to SmarterStats 8.x from an older version of the application vary depending on which version you are upgrading from. For more information on upgrading from a previous 8.x release refer to the knowledge base article -- Minor Upgrade of SmarterStats.
 
NOTE: When upgrading SmarterStats you may notice a difference in statistics. Please refer to this knowledge base article for more information -- Differences in Reported Numbers Between SmarterStats Versions.

Applies to SmarterStats 8.x

Follow these steps to upgrade to the latest version of SmarterStats if you are upgrading from a previous version (such as 6.x or 7.x):
  1. Install the Microsoft .NET 4.0 Framework.
  2. Back up your SmarterStats installation and data.
  3. Alter the IIS configuration by making a new application pool:
    • In IIS, view the Application Pools listing. Then right-click and select Add Application Pool.
    • In the Name field, type the name of the application pool.
    • In the .NET Version field, select .NET Framework v4.0.30319 from the list.
    • Click OK.
    • Select the SmarterStats website.
    • In the Actions panel, click Basic Settings.
    • Click Select. A list of available application pools will display.
    • Select the application pool that was just created and click OK.
  4. Uninstall SmarterStats. All configuration data and sites will be preserved.
  5. Download the latest automated installer from the SmarterStats Download page.
  6. If you are running SmarterStats as an IIS site, stop IIS.
  7. Run the SmarterStats installer.
  8. During the installation process you will be prompted for the installation path. Installation along the existing path. (The default installation location is C:\Program Files\SmarterTools\SmarterStats.)
  9. If you are running SmarterStats as an IIS site, restart IIS.
  10. The Setup Wizard will automatically run. You will need to provide the new license key.
Backwards Compatibility

When downgrading from SmarterStats 8.x (for example, to SmarterStats 6.x or 7.x), some settings will be lost or changed. For this reason, it is very important to create a backup of your SmarterStats installation prior to upgrading to SmarterStats 8.x. (For instructions on backing up SmarterStats, please search thes KB for "How To – Back Up and Restore SmarterStats".)

Set up SmarterStats as an IIS Site (IIS 7.0/7.5)

Set up SmarterStats as an IIS Site (IIS 7.0/7.5)


By default, SmarterStats installs a basic Web server that allows administrators to start using the application immediately after installation. However, SmarterTools recommends moving to a more robust and secure Web server, such as Microsoft IIS.
The instructions for setting up SmarterStats as an IIS site differ slightly depending on whether you are using IIS 6.0 or IIS 7.0.
NOTE: This topic assumes that you are familiar with IIS and how it works. SmarterTools recommends that you use the Web server included with SmarterStats if you are unfamiliar with or uncomfortable using Microsoft IIS.

Applies to All Versions of SmarterStats

This article covers the following:
  • Disabling the SmarterStats Web server
  • Adding a new application pool for SmarterStats
  • Adding SmarterStats to IIS
  • Verifying IIS Settings
  • Updating DNS
  • Testing the site
Disabling the SmarterStats Web Server
These steps will stop and disable the default web server that is included with SmarterStats. This will also have the side-effect of disabling any shortcut for SmarterStats that may be placed on your desktop until you update it with the new URL for the SmarterStats site created in IIS.
  1. Click on Start -> Programs -> SmarterTools -> SmarterStats -> Configure SmarterStats Web Server
  2. Click on the Stop butto
  3. Change the Startup Mode to Disabled
  4. Click on the Apply button
  5. Click the Close button
NOTE: You can also stop and disable the SmarterStats Web server from within the Services administrative tool if you are more comfortable using the Windows Server admin tool set.
Add an Application Pool
Follow these steps to add an application pool specifically for SmarterStats:
  1. Open Internet Information Services (IIS) Manager
  2. Right click on Application Pools from the tree view and choose Add Application Pool
  3. Name the new application pool SmarterStats, or something similarly easy to identify
  4. Set the .Net Framework Version to v4.0.x
  5. Set the Application Pools Managed Pipeline to 'Integrated'
  6. Make sure "Start application pool immediately" is checked
  7. Click OK
Add SmarterStats to IIS
Follow these steps to add SmarterStats to IIS:
  1. Open Internet Information Services (IIS) Manager
  2. Click on your ServerName, and on the right side, under IIS, double-click ISAPI and CGI Restrictions
  3. Verify that ASP.NET v4.0 is allowed (If not, right click on ASP.NET v4.0.x and select Allowed)
  4. On the left side of the page, right click on Sites in the tree view and choose Add Website
  5. Name the site SmarterStats
  6. If you created an Application Pool name other than SmarterStats, click Select and choose the correct Application Pool
  7. For the physical path, browse to the SmarterStats -> MRS folder. The default location is C:\Program Files (x86)\SmarterTools\SmarterStats\MRS
  8. For Binding, choose an IP address to use for Webmail. If this IP address is shared with another Web site, you will need to use a different port or Host Headers. For more information about using Host headers, refer to the IIS documentation
  9. Make sure "Start Web site immediately" is checked
  10. Click OK
Verify IIS Settings
Follow these steps to verify the IIS settings. Please read each item carefully.
  1. In IIS Manager, click on your ServerName
  2. Under IIS, double click ISAPI and CGI Restrictions
  3. Verify that ASP .NET v4.0 is allowed. If it is not, right-click on ASP .NET v4.0 and select Allowed
  4. In the tree view, click Sites
  5. Expand (or double click) the SmarterStats site
  6. Click on the App_Themes folder
  7. Under IIS, double click HTTP Response Headers
  8. Under the Action menus, click Set Common Headers
  9. Enable the Expire Web content setting
    • Click After
    • Add 7 for the number of days
  10. Click OK
  11. Click on Application Pools in the tree view
  12. Right click on the SmarterStats application pool and select Advanced Settings
  13. Under the Process Model heading, ensure the the Identity is set to the NetworkService account
  14. From the Start menu, open Administrative Tools and select Services, then verify that the World Wide Publishing Service is running
For more information, refer to the SmarterStats Online Help.

Set up SmarterStats as an IIS 6.0 Site

Set up SmarterStats as an IIS 6.0 Site


By default, SmarterStats installs a basic Web server that allows companies to start using the application immediately after installation. However, SmarterTools recommends moving to a more robust and secure Web server, such as Microsoft IIS.
The instructions for setting up SmarterStats as an IIS site differ slightly depending on whether you are using IIS 6.0 or IIS 7.0. Only the instructions for IIS 6.0 are described below.
NOTE: This topic assumes that you are familiar with IIS and how it works. SmarterTools recommends that you use the Web server included with SmarterStats if you are unfamiliar with or uncomfortable using Microsoft IIS.

Applies to All Versions of SmarterStats

An overview of the instructions are:
  1. Disable the SmarerStats Web server
  2. Add Application pool
  3. Add SmarterStats to IIS
  4. Verify IIS Settings
  5. Update DNS
  6. Test the site
Disable the SmarterStats Web Server
These steps will stop and disable the web server included with SmarterStats. They will also have the side-effect of disabling the shortcut on SmarterStats on your desktop until you update it with the new URL for SmarterStats.
  1. Click on Start -> Program Files -> SmarterStats -> Web Server Config.
  2. Click on the Stop button.
  3. Change the Startup Mode to Disabled.
  4. Click on the Apply button.
  5. Click the Close button.
Add an Application Pool
Follow these steps to add an application pool:
  1. Click on Start -> Control Panel -> Administrative Tools -> Internet Information Services (IIS)Manager.
  2. Right click on Application Pools and choose New -> Application Pool.
  3. Name the pool SmarterStats (or something equivalent) and click OK.
  4. Right click on the application pool that was just created and click Properties.
  5. Select the Identity tab.
  6. Select Network Service from the drop down list, and click OK.
Change Your File Permissions
These steps will walk you through how to change your file permissions for your SmarterStats website to ensure IIS can read and write to the appropriate files.
  1. Navigate to your SmarterStats directory. By default, this is at C:\Program Files\SmarterTools\SmarterStats\. On 64-bit machines, it will be under C:\Program Files (x86)\SmarterTools\SmarterStats\.
  2. Right click on the MRS folder and select Properties.
  3. Click the Security tab.
  4. Click Edit.
  5. Click Add.
  6. In the textbox, type Network Service and click OK. Note that if your server is connected to a domain, you will need to click the Locations button, and select your server as the location. Windows selects a default location of the domain to add users.
  7. Highlight the Network Service user and select Read & execute, List folder contents, and Read, under the Allow column. Ensure no check boxes are selected under the Deny column.
  8. Click OK and you will be brought back to the MRS Properties window. Click OK here as well.
  9. Open the MRS folder.
  10. Right click on the App_Data folder and select Properties.
  11. Click the Security tab.
  12. Click Edit.
  13. Highlight the NETWORK SERVICE user and select Full Control under the Allow column. Ensure no check boxes are selected under the Deny column.
  14. Click OK and you will be brought back to the App_Data Properties window. Click OK here as well.
Add SmarterStats to IIS
Follow these steps to add SmarterStats to IIS:
  1. Click on Start -> Control Panel -> Administrative Tools -> Internet Information Services (IIS)Manager.
  2. Right-click on the web sites tree on the left of the page and choose New -> Web Site.
  3. When asked for a description, type SmarterStats.
  4. Choose the IP address to use for SmarterStats. If this IP address is shared with another web site, you will need to use a different port or Host Headers. For more information about using Host Headers, refer to the IIS documentation.
  5. For the physical path, browse to the SmarterStats\MRS folder. The default location is: C:\Program Files\SmarterTools\SmarterStats\MRS.
  6. Leave the "Allow anonymous access to this web site" box checked.
  7. When asked what permissions to grant, choose only Read and Run Scripts.
  8. Finish the Wizard.
Verify IIS Settings
Follow these steps to verify the IIS settings:
  1. If you are using Windows 2003, verify that ASP .NET v4.0.30319 Web Service Extension is set to Allowed in IIS. If you do not see ASP .NET under Web Service Extensions, ensure that ASP .NET is enabled in the Application Server. You can do ths by going to: Control Panel -> Add/Remove Programs -> Windows Components -> Application Server -> Details.
  2. Ensure that the default document for the site is Default.aspx (under the Documents tab).
  3. For better performance, set HTTP content expiration for 7 days on the App_Themes folder unless you are actively creating a new skin.
  4. In Windows 2003, alter application pool’s performance tab to disable the “Shutdown worker process after being idle for,” or change it to a high value, like 240.
Update DNS
If any sites are already set up with SmarterStats, make sure to update their DNS records to point to the new IP address.
Test the site
Open up your browser and type the IP address of the site you just added.
For more information, refer to the Running as an IIS Site section of the SmarterStats Online Help.

Minor Upgrade of SmarterMail

Minor Upgrade of SmarterMail


NOTE: Before following the instructions in this article, make sure the Microsoft .NET 4.0 Framework is installed.
The steps for upgrading SmarterMail from an older version of the application vary depending on which version you are upgrading from. For instructions on how to perform a major version upgrade (such as SmarterMail 10.x or 9.x and earlier versions) refer to the knowledge base article -- Major Upgrade of SmarterMail.

Applies to all versions of SmarterMail

Follow these steps to upgrade to the latest version of SmarterMail if you are upgrading from a previous release (for example from SmarterMail 11.0 to SmarterMail 11.1). NOTE: All configuration data and emails are preserved when performing a minor version upgrade.
  1. Back up your SmarterMail installation and data.
  2. Download the latest automated installer from the SmarterMail Download page.
  3. If you are running SmarterMail as an IIS site, stop IIS.
  4. Run the SmarterMail installer.
  5. During the installation process, you will be prompted for the installation path. In order to keep existing data and settings, install to the same path used in previous installs. For reference, the default installation location is C:\Program Files\SmarterTools\SmarterMail.
  6. If you are running SmarterMail as an IIS site, restart IIS.
For more information, please refer to the SmarterMail Online Help.

Major Upgrade of SmarterMail

Major Upgrade of SmarterMail


NOTE: Before following the instructions in this article, make sure the Microsoft .NET 4.0 Framework is installed. Also, upgrading from older versions (up to SmarterMail 6.x) can take up to several hours based on the amount of data. This is due to file structure changes that are in SmarterMail 7.x. In addition, you will not be able to roll back to the older major version because of the file structure change. To go back to an older version, you will need to restore from a backup.
The steps for upgrading to SmarterMail 11.x from an older version of the application vary depending on which version you are upgrading from. For instructions on how to upgrade from a previous 11.x release refer to the knowledge base article -- Minor Upgrade of SmarterMail.
Follow these steps to upgrade to the latest version of SmarterMail if you are upgrading from a previous version (such as 10.x or 9.x). NOTE: All configuration data and emails are preserved when upgrading from a previous major release.

Applies to SmarterMail 8.x - 12.x

  1. Back up your SmarterMail installation and data.
  2. Download the latest automated installer from the SmarterMail Download page.
  3. If you are running SmarterMail as an IIS site, stop IIS.
  4. Uninstall SmarterMail. All configuration data and email will be preserved.
  5. Run the SmarterMail installer.
  6. During the installation process, you will be prompted for the installation path. In order to keep existing data and settings, install to the same path used in previous installs. For reference, the default installation location is C:\Program Files\SmarterTools\SmarterMail.
  7. If you have made any custom configuration changes in the MailService.exe.config, replace those changes to the appropriate location.
  8. If you are running SmarterMail as an IIS site, make sure the default web server is stopped.
  9. If you are running SmarterMail as an IIS site, change the .NET version of the Application Pool to .NET 4.0 and restart IIS.
  10. The Setup Wizard will automatically run.
  11. If you were running with an activated license key, you will need to reactivate using a license key for the new version. For more information regarding activation refer to: Activate SmarterMail. In some cases you may need to reconfigure your spam settings, as those can change from version to version.
For more information, please refer to the SmarterMail Online Help.

SmarterMail Settings

Set up SmarterMail as an IIS Site (IIS 7.0/7.5)

Set up SmarterMail as an IIS Site (IIS 7.0/7.5)

SmarterMail > Server Configuration and Management
By default, SmarterMail installs a basic Web server that allows administrators to start using the application immediately after installation. However, SmarterTools recommends moving to a more robust and secure Web server, such as Microsoft IIS.
The instructions for setting up SmarterMail as an IIS site differ slightly depending on whether you are using IIS 6.0 or IIS 7.0. If you are using IIS 6.0, please refer to the KB article How To Set up SmarterMail as an IIS Site in IIS 6.0.
NOTE: This topic assumes that you are familiar with IIS and how it works. SmarterTools recommends that you use the Web server included with SmarterMail if you are unfamiliar with or uncomfortable using Microsoft IIS.

Applies to SmarterMail 8.x - 12.x

This article covers the following:
  • Disabling the SmarterMail Web server
  • Adding a new application pool for SmarterMail
  • Adding SmarterMail to IIS
  • Verifying IIS Settings
  • Updating DNS
  • Testing the site
Disabling the SmarterMail Web Server
These steps will stop and disable the default web server that is included with SmarterMail. This will also have the side-effect of disabling any shortcut for SmarterMail that may be placed on your desktop until you update it with the new URL for the SmarterMail site created in IIS.
  1. Click on Start -> Programs -> SmarterTools -> SmarterMail -> Configure SmarterMail Web Server
  2. Click on the Stop button
  3. Change the Startup Mode to Disabled
  4. Click on the Apply button
  5. Click the Close button
NOTE: You can also stop and disable the SmarterMail Web server from within the Services administrative tool if you are more comfortable using the Windows Server admin tool set.
Add an Application Pool
Follow these steps to add an application pool specifically for SmarterMail:
  1. Open Internet Information Services (IIS) Manager
  2. Right click on Application Pools from the tree view and choose Add Application Pool
  3. Name the new application pool SmarterMail, or something similarly easy to identify
  4. Set the .Net Framework Version to v4.0.x
  5. Set the Application Pools Managed Pipeline to 'Integrated'
  6. Make sure "Start application pool immediately" is checked
  7. Click OK
Add SmarterMail to IIS
Follow these steps to add SmarterMail to IIS:
  1. Open Internet Information Services (IIS) Manager
  2. Click on your ServerName, and on the right side, under IIS, double-click ISAPI and CGI Restrictions
  3. Verify that ASP.NET v4.0 is allowed (If not, right click on ASP.NET v4.0.x and select Allowed)
  4. On the left side of the page, right click on Sites in the tree view and choose Add Website
  5. Name the site SmarterMail
  6. If you created an Application Pool name other than SmarterMail, click Select and choose the correct Application Pool
  7. For the physical path, browse to the SmarterMail -> MRS folder. The default location is C:\Program Files (x86)\SmarterTools\SmarterMail\MRS
  8. For Binding, choose an IP address to use for Webmail. If this IP address is shared with another Web site, you will need to use a different port or Host Headers. For more information about using Host headers, refer to the IIS documentation
  9. Make sure "Start Web site immediately" is checked
  10. Click OK
Verify IIS Settings
Follow these steps to verify the IIS settings. Please read each item carefully.
  1. In IIS Manager, click on your ServerName
  2. Under IIS, double click ISAPI and CGI Restrictions
  3. Verify that ASP .NET v4.0 is allowed. If it is not, right-click on ASP .NET v4.0 and select Allowed
  4. In the tree view, click Sites
  5. Expand (or double click) the SmarterMail site
  6. Click on the App_Themes folder
  7. Under IIS, double click HTTP Response Headers
  8. Under the Action menus, click Set Common Headers
  9. Enable the Expire Web content setting
    • Click After
    • Add 7 for the number of days
  10. Click OK
  11. Click on Application Pools in the tree view
  12. Right click on the SmarterMail application pool and select Advanced Settings
  13. Under the Process Model heading, ensure the the Identity is set to the NetworkService account
  14. From the Start menu, open Administrative Tools and select Services, then verify that the World Wide Publishing Service is running     

For more information, refer to the SmarterMail Online Help.

How to find and Kill all ‘Zombie processes’ running on server

How to find and Kill all ‘Zombie processes’ running on server



While checking the process list, you might have noticed something like this : sh
These are zombie processes. On Unix operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table, allowing the process that started it to read its exit status. It almost always means that the parent is still around. If the parent exited, the child would be orphaned and re-parented to init, which would immediately perform the wait(). In other words, they should go away once the parent process is done.
A zombie process doesn’t react to signals.
1. How can I get the Zombie from process list…?
Its very simple. You can find out Zombie process with the following way:
# ps aux |grep "defunct"

arun      3366  0.0  0.0      0     0 ?        Z    07:34   0:00 [chromium-browse] defunct
arun      3435  0.0  0.0      0     0 ?        Z    07:44   0:19 [chromium-browse] defunct
arun      3722  0.0  0.0      0     0 ?        Z    08:21   0:00 [pidgin] defunct
arun      4287  0.1  0.0      0     0 ?        Z    09:26   0:38 [chromium-browse] defunct
arun      5378  0.1  0.0      0     0 ?        Z    11:24   0:15 [chromium-browse] defunct
# ps aux |grep Z

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
arun      3366  0.0  0.0      0     0 ?        Z    07:34   0:00 [chromium-browse] 
arun      3435  0.0  0.0      0     0 ?        Z    07:44   0:19 [chromium-browse] 
arun      3722  0.0  0.0      0     0 ?        Z    08:21   0:00 [pidgin] 
arun      4287  0.1  0.0      0     0 ?        Z    09:26   0:38 [chromium-browse] 
arun      5378  0.1  0.0      0     0 ?        Z    11:24   0:15 [chromium-browse]
2. How many Zombie process running on your server…?
# ps aux | awk {'print $8'}|grep -c Z
5
# ps aux | awk '{ print $8 " " $2 }' | grep -wc Z
5
# ps aux | awk {'print $8'}|grep Z|wc -l
5
3. List the PID of Zombie…?
# ps aux | awk '{ print $8 " " $2 }' | grep -w Z
Z 3366
Z 3435
Z 3722
Z 4287
Z 5378
In order to kill these processes, you need to find the parent process first.
# pstree -paul
This will show the pid of the of the parent of the zombie process. Now you need to kill the parent process.
[root@server]# kill -9
That’s it! :-)

How/Command to find out the resource(cpu, memory) usages of users – Unix/Linux

How/Command to find out the resource(cpu, memory) usages of users – Unix/Linux


In some high load situations, we need to find out the resource consumption of each user in the server to figure out the exact issue. There are a lot of options/commands to find the same. Normally, we are using the “ps” and “top” command for performing this.
“ps command” and “top command” have a lot of options, here I am explaining some useful command combinations to find the resource(cpu, memory…) usages of users in the server.
Static View
You can use the grep command to separate users. :-)
To list top 10 CPU usage processes with user
# ps -e -o pcpu,pid,user,args|sort -k1 -nr|head -10
Find out top 10 CPU consuming process
# ps -auxf|sort -nr -k3|head -10
To list top 10 Memory consuming processes with user
# ps -e -o pmem,pid,user,args|sort -k1 -nr|head -10
Find out the top 10 memory consuming process
# ps -auxf|sort -nr -k4|head -10
Find out every process running under a user
# ps -U user-name -u user-name u
Or
# ps -e -o pid,user,args|grep $username
Dynamic View
To get a dynamic result you must use the ‘top‘ command instead of ‘ps’ or use the ‘watch‘ command along with the ‘ps’.
To show the process usage of a user with ‘top’
# top -u $username
You can refer this “How to show process usage for single user with TOP command” for more details.
To list top 10 CPU usage processes with user
# watch "ps -e -o pcpu,pid,user,args|sort -k1 -nr|head -10"
To list top 10 Memory consuming processes with user
# watch "ps -e -o pmem,pid,user,args|sort -k1 -nr|head -10"
You can use the grep command to separate users. :-)

Exim - Scripts to find the Origin of Spam mails in cPanel Server

Exim - Scripts to find the Origin of Spam mails in cPanel Server



SCRIPTS TO CHECK SPAMMER AND SPAM MAILS IN CPANEL SERVER - EXIM:


To get a sorted list of email sender in exim mail queue. It will show the number of mails send by each one.

# exim -bpr | grep "<" | awk {'print $4'} | cut -d "<" -f 2 | cut -d ">" -f 1 | sort -n | uniq -c | sort -n

You will get a result as like follows,

      1  arun@testdomain.com
      2  sales@test1domain.com
      3  sandy@test123.com
      4  root@testdomain.co.in
    29  admin@testdomain.in
  124  arun@test123domain.com

=============================================================================================

The following scripts will check the script that will originate spam mails:

# grep "cwd=/home" /var/log/exim_mainlog | awk '{for(i=1;i<=10;i++){print $i}}' | sort | uniq -c | grep cwd | sort -n

# awk '{ if ($0 ~ "cwd" && $0 ~ "home") {print $3} }' /var/log/exim_mainlog | sort | uniq -c | sort -nk 1

# grep 'cwd=/home' /var/log/exim_mainlog | awk '{print $3}' | cut -d / -f 3 | sort -bg | uniq -c | sort -bg

You will get a result as like follows for the first two scripts. The third script is just a sub of the first two scripts.

      9      cwd=/home/test1/public_html
     10     cwd=/home/test2/public_html/a1/www
     15     cwd=/home/test3/public_html
     91     cwd=/home/test4/public_html
    178    cwd=/home/test5/public_html/web
    770    cwd=/home/test6/public_html/foro
    803    cwd=/home/test7/public_html/web
 124348 cwd=/home/test8/public_html/wp/wp-content/themes/twentyeleven

=============================================================================================

If we need to find out exact spamming script. The following script will shows the current spamming script running now. The following script will help you in all time of mail servers. It will help you to find the exact script which sending mails.

# ps auxwwwe | grep <user> | grep --color=always "<location of script>" | head

The usage of the above script is as shown below.

# ps auxwwwe | grep test8 | grep --color=always "/home/test8/public_html/wp/wp-content/themes/twentyeleven" | head

Once you find the exact script, the following script will help you to find the IP address which is responsible for spamming. You will get a list of IPs from the following script. The IPs address which has high number of access is most probably causing spamming. You can block the IP address in csf or apf firewall.

# grep "<script_name>" /home/user/access-logs/testdomain.com | awk '{print $1}' | sort -n | uniq -c | sort -n


=============================================================================================

Following command that will show you the script which is using script to send the email. If it is from php then use


# egrep -R "X-PHP-Script"  /var/spool/exim/input/*

=============================================================================================

It shows top 50 domains using mail server with options.

# eximstats -ne -nr /var/log/exim_mainlog

=============================================================================================

It shows from which user’s home the mail is going, so that you can easily trace it and block it if needed.it shows the mails going from the server.

# ps -C exim -fH ewww | grep home
=============================================================================================

It shows the IPs which are connected to server through port number 25. It one particular Ip is using more than 10 connection you can block it in the server firewall.

# netstat -plan | grep :25 | awk {'print $5'} | cut -d: -f 1 | sort | uniq -c | sort -nk 1
==============================================================================================

In order to find “nobody” spamming, issue the following command

# ps -C exim -fH ewww | awk '{for(i=1;i<=40;i++){print $i}}' | sort | uniq -c | grep PWD | sort -n

 It will give some result like:
Example :
6 PWD=/
347 PWD=/home/sample/public_html/test
Count the PWD and if it is a large value check the files in the directory listed in PWD
(Ignore if it is / or /var/spool/mail /var/spool/exim)

The above command is valid only if the spamming is currently in progress. If the spamming has happened some hours before, use the following command.


# grep "cwd=" /var/log/exim_mainlog | awk '{for(i=1;i<=10;i++){print $i}}' | sort | uniq -c | grep cwd | sort -n

==============================================================================================

The following script will give the summary of mails in the mail queue.

exim -bpr | exiqsumm -c | head


You will get a result as like follows,


Count  Volume  Oldest  Newest  Domain
 -----      ------      ------     ------       ------

  114   171KB     24h     28m  testdomain.com
   15    28KB       36h     7m    gmail.com
    5     10KB       34h     10h   test2domain.com
    4     8192        27h     4h     yourdomain.com
    4     75KB       7m      7m    server.domain.com
    3     6041        23h     42m  test123.com


==============================================================================================


You can find useful commands/scripts used in exim in the following link,
http://linuxadmintips4u.blogspot.in/2012/11/most-frequently-used-commands-in-exim.html


More Reference:

https://github.com/Exim/exim/wiki

http://www.exim.org/exim-html-current/doc/html/spec_html/ch-log_files.html

http://www.exim.org/exim-html-4.20/doc/html/spec_13.html#IX1148


http://www.grscripts.com/tweaking.html   ---> Tweakings for ASSP