Brandon Yap

Graphing Postfix with Cacti

[Updated 2015-03-09] There are a bunch of articles and information on this topic out there, but most of them either don’t work, are outdated, or are scattered across multiple pages on the Cacti forums. I’ve worked out the kinks for you, so here’s what you need to do to graph Postfix with Cacti.This was performed on Debian 6 with Cacti 0.8.7g from the apt repository but should work on other distros too.Note that this article tackles graphing the sent, received, rejected, bounced, spam, and virus statistics. It does not graph mail queues. You need two files, the first is mailgraph.pl which you’ll […]

Graphing Postfix with Cacti Read More »

Fixing and removing corrupted Apache configs in Plesk

Today I ran into an interesting problem with Plesk. It had gotten it’s Apache configuration so messed up that when you ran httpdmng reconfigure for any domain, it would throw errors about not being able to find include files. For example: apache2: Syntax error on line 227 of /etc/apache2/apache2.conf: Syntax error on line 7 of /etc/apache2/conf.d/zz010_psa_httpd.conf: Syntax error on line 15 of /opt/psa/admin/conf/generated/14099869670.15839100_horde.include: Syntax error on line 56 of /opt/psa/admin/conf/webmail_horde_bootstrap.conf: Could not open configuration file /opt/psa/admin/conf/generated/14099802590.70236400_domain_com_webmail.include: No such file or directory The fix for this involves some MySQL work. Go into the “psa” database in MySQL. You’ll see a “Configuration”

Fixing and removing corrupted Apache configs in Plesk Read More »

Iterators iterators iterators!

Managing lots of CloudFormation stacks can be a pain through the AWS Console. Stacks are paginated so you’ll need to keep clicking that “View more stacks” button until you get to the stack you want. Performing tasks through the AWS PHP SDK makes it a little easier, but you’ll still need to deal with tokens. Take the following code snippet for example: [code lang=php] $client = \Aws\CloudFormation\CloudFormationClient::factory($config); $stackstatus = array('CREATE_COMPLETE'); // First run $result = $client->listStacks(array( 'StackStatusFilter' => $stackstatus, )); $stacks = $result['StackSummaries']; $token = $result['NextToken']; foreach ($stacks as $stack) { echo "$stack[StackName] – $stack[StackStatus]\n"; } // Subsequent runs while ($token !=

Iterators iterators iterators! Read More »

Apache, Akamai, and True-Client-IP

You’re running a site behind Akamai, but can’t see the real client’s IP address, only that of your load balancer and/or Akamai’s IP addresses. Therefore you can’t act on it, ban IP’s….etc. Akamai does pass the true IP address of clients, but not through the standard X-Forwarded-For header. It uses one named True-Client-IP. Apache doesn’t understand True-Client-IP so it doesn’t pass this along internally to logging and other modules like PHP. There exists an Apache module named mod_remoteip which was introduced in Apache 2.4. A lot of sites don’t run Apache 2.4 yet as of the time of this article,

Apache, Akamai, and True-Client-IP Read More »

The one thing that will save the most battery

There are a lot of ways to get more battery time out of your iPhone. Turn off Airdrop, Bluetooth, Location services, Background App Refresh, so on and so on. While they do work, they don’t make a significant difference. The single most thing that will make a dramatic impact to your iPhone’s battery life i’ve found …… is the brightness setting. With it set at the lower 1/3rd end of the brightness bar in a brightly lit room, I can end a 16 hour day on around 44% battery life with my iPhone 5 (iOS 7). That’s with Bluetooth on,

The one thing that will save the most battery Read More »

Scroll to Top