Technology Blog


check_mk qmail-stat not working with plesk

by on Jan.26, 2015, under Linux, Plesk

I saw the check_mk added the ability to monitor the qmail mail queue, so I wanted to get that setup on a few plesk servers. The auto inventory wasn’t seeing the qmail and therefore wasn’t adding the check. It turns out that two things were wrong:

  • I updated the check_mk agent on the plesk server, but didn’t update the check_mk software on the nagios host. I needed to install the latest version in BOTH places to get it working.
  • Plesk uses its own paths, so we had to symlink /var/qmail/bin/qmail-qstat to /bin/qmail-qstat

ln -s /var/qmail/bin/qmail-qstat /bin/qmail-qstat

I spent way too much time figuring that out. Hopefully this post will help the next poor soul!

Leave a Comment more...

Find Databases created outside of Plesk

by on Sep.10, 2014, under MySQL, Plesk

So today I needed a quick script to list all of the mysql databases on the system and compare that to the databases that were created inside of plesk. I wanted to print any databases that were created outside of plesk.

Why you might ask? It came to my attention that some of our system admins were creating databases manually through command line and setting up users that way when doing code deployments onto our shared plesk servers.

Whats wrong with that? Well if the database is outside of plesk, then plesk backup system, and plesk migration manager won’t know about the databases, nor the db users/passwords. This means if you are relying on plesk backup xml, or plesk migration manager for your server upgrades or disaster recovery, you’re going to have an issue with missing databases at some point!

The code is simple and is below. From memory it should work on plesk 8-11 and I have tested it on v10/11 myself.

Next to add to the list, is to set this up as a cron and email our general support queue if a new db is created outside of the plesk system.

To install / run, copy the below into a file called db_checker.php, then at a command line run “php db_checker.php”. You will need to be the root user to run this script.

Leave a Comment more...

List All Email Accounts for a Domain

by on Apr.18, 2009, under Plesk

Yes you can do this via plesk! But sometimes I need to automate it for a script or API. The following will print out all mail names for domains on your plesk server:

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e "SELECT mail.mail_name, from mail LEFT OUTER JOIN domains ON = mail.dom_id where name='DOMAIN NAME.EXT HERE';

Leave a Comment more...

Recover Email Password on Plesk

by on Apr.18, 2009, under Plesk

Once in a while I need to do some email debugging on client accounts. They believe for whatever reason they are not receiving messages or vice versa and I need to do some header checking. Or a client is adding an email account on a second or third computer and they want me to tell them their existing password rather than reset it. Well in plesk it’s rather easy to do so and all it requires is running the following from the command line:

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e "SELECT, mail.mail_name, accounts.password, FROM domains LEFT JOIN mail ON = mail.dom_id LEFT JOIN accounts ON mail.account_id = where mail_name='ENTER MAIL NAME HERE' "


As root run: /usr/local/psa/admin/sbin/mail_auth_view

Leave a Comment more...

Port 25 Blocking Work Around for Your Customers

by on Apr.18, 2009, under Plesk

Ok, so nowadays most ISP’s block port 25, the port for sending email through the internet. This leaves most hosting providers telling their customers to use their ISP’s outgoing mail server. I.E. Well this sucks! Here’s why:

I carry a laptop around, and I take it everywhere. When I boot it up it connects to any number of wifi signals that are pre-saved. I could be on a Verizon connection, a comcast connection, or even optimum online. So am I suppose to reconfigure my outgoing mailserver several times a day based on the wifi signal of the office I mobilized into? Well many host would have you believe so!

My work around on Redhat based linux servers is to set up the official alternative email port to listen and forward traffic to port 25. I do this via iptables and the command is:

/sbin/iptables -t nat -A PREROUTING -p tcp --dport 587 -i eth0 -j REDIRECT --to-ports 25

This command assumes your main interface is eth0. You may need to adjust it accordingly. Instead of just running this command from the shell prompt I recommend you append it to the /etc/rc.local file. This way when your server is ever rebooted the command is automatically reissued when the server reboots. Otherwise you may be wondering why your email stopped working out of the blue!

Plesk offers an alternative option to this which involves editing the /etc/xinetd.d/smtp_psa but it did not work well for me and was not as simple and clean as this solution.

Leave a Comment more...

External Mail Server on Plesk

by on Apr.18, 2009, under Plesk

Ok, so you have a plesk server and your hosting a site for a client who wants to use thier own mail server.  So you go ahead and change the mx record to point to thier mail server and email the client back to let him know everything is completed.  A day later you realize that your client isn’t receiving emails from you.  In fact he’s not receiving emails from his friend Jim (also a client of yours hosted on the same physical server).  But he is receiving email from just about everyone else in the world.  What the heck is going on you ask yourself!

Well, normally when someone sends an email, the mx record is looked up and followed accordingly.  However, plesk uses qmail as it’s MTA (Mail Transit/transport Agent).  Since Jim and you are using the same server that host your clients site, qmail assumes it is handling the email for that domain as well.  It’s an easy fix though:

Just open in vi or pico or whatever your using these days the following two files and comment out the clients domain who is using an external mail server.

vi /var/qmail/control/virtualdomains
vi /var/qmail/control/rcpthosts

Then restart qmail so it reloads the new configuration.

/sbin/service qmail restart

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...