Skip to main content

Files not showing up in cpanel file manager

When opening the file manager from cpanel the files were not showing up under public_html directory.
The issue in this case was caused because of a wrong group established in public_html directory. I had the directory owner like user:user and I had to change it to user:nobody. After changing the group to nobody the files were showed up again.

UPDATE:

You also should check cpanel error log (/usr/local/cpanel/logs/error_log). In other of my clients I checked the error log and I found this message:

Out of memory!

It seems a cpanel bug, because the server had free memory and after restarting the cpanel service the error was gone.

snmpd[3916]: error on subcontainer ‘ia_addr’ insert (-1)

This message is flooding my syslog on each snmp query.

snmpd[3916]: error on subcontainer 'ia_addr' insert (-1)
snmpd[3916]: error on subcontainer 'ia_addr' insert (-1)
snmpd[3916]: error on subcontainer 'ia_addr' insert (-1)

To avoid it you have to change the log level of the services. In debian squeeze edit /etc/default/snmpd and change these lines:

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'

to:

SNMPDOPTS='-LS6d -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
TRAPDOPTS='-LS6d -p /var/run/snmptrapd.pid'

Upgrading Dell PowerConnect 54xx switch firmware

This is the procedure I’ve used to upgrade the firmware of my PowerConnect 5448 and 5424 switches. You should have set up a tftp server in same network as switch admin ip is. There are plenty of howtos to do this in the web like this, so I assume that you have already running the tftp server.

First, connect to to your switch via ssh or serial cable and enable privileged commands:

> enable

Copy new firmware from your tftp server:

# copy  tftp://tftp_server_ip/switch/powerconnect_54xx-20046.ros image
# copy tftp://tftp_server_ip/switch/powerconnect_54xx_boot-2000.rfb boot

Now, you should view the new firmware image ready, but not active:

# show bootvar
Image  Filename   Version     Date                    Status
-----  ---------  ---------   ---------------------   -----------
1      image-1    1.0.0.31    31-Oct-2007  10:32:13   Active* 
2      image-2    2.0.0.46    14-Apr-2011  13:10:53   Not active

"*" designates that the image was selected for the next boot

Select image-2 as active for the next boot:

# boot system image-2

The image is selected as active for the next system boot

# show bootvar
Image  Filename   Version     Date                    Status
-----  ---------  ---------   ---------------------   -----------
1      image-1    1.0.0.31    31-Oct-2007  10:32:13   Active  
2      image-2    2.0.0.46    14-Apr-2011  13:10:53   Not active*

Now, we only have to reload the switch to boot with updgraded image.

# reload

I’ve upgraded several switches and in all of them the switch configuration has been preserved.

Accessing local directory content from wordpress

Sometimes you want to upload some files into a local directory in your wordpress installation directory and link these files in your posts. To achieve this you have to modify your .htaccess file in your wordpress installation directory and put this directives before WordPress directives. Assuming you want to store some files in “files” directory:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/files/(.*)$
RewriteRule ^.*$ - [L]
</IfModule>

The final file content looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/files/(.*)$
RewriteRule ^.*$ - [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Now, you can link this files in your posts with www.yourdomain.com/files/myfile.txt

Nagios plugin for checking mysql synchronization state

I want to share this simple nagios plugin for monitoring mysql slaves replications states:

check_mysql_sync

This plugin can be downloaded here. To install copy this script to nagios plugins directory (/usr/lib/nagios/plugins/). View script help for full options list:

# /usr/lib/nagios/plugins/check_mysql_sync.pl -h

Check mysql sync between master and slave for Nagios version 0.1
Usage: /usr/lib/nagios/plugins/check_mysql_sync.pl [-v] -H <host> -p <port> -l <username> -x <password> -w <warn level> -c <crit level>  [-V]
-v, --verbose
   print extra debugging information 
-h, --help
   print this help message
-H, --hostname=HOST
   name or IP address of host to check
-l, --login
    username for mysql database (Default nagios)
-x, --passwd=PASSWD
   password
-p, --port=PORT
   MYSQL port (Default 3361)
-w, --warn=INTEGER
   warning level for seconds behind sync
-c, --crit=INTEGER 
   critical level for seconds behind sync
-V, --version
   prints version number

Run this command in your mysql master for grant to nagios user the required privileges:

 GRANT PROCESS, REPLICATION CLIENT on *.*  TO 'nagios'@'192.168.1.25' IDENTIFIED BY 'yourpass';