Archive

Archive for the ‘Sys Admin’ Category

Install Webmin on CentOS 5

January 22nd, 2009 No comments

Install dependency :

sudo yum -y install perl-Net-SSLeay

Get the latest RPM from the Webmin website and install it

wget http://prdownloads.sourceforge.net/webadmin/webmin-1.441-1.noarch.rpm
rpm -ihv webmin-1.441-1.noarch.rpm

open port 10000 in your iptables :

sudo vi /etc/sysconfig/iptables

Add the following line :

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 10000 -j ACCEPT

Reload iptables :

sudo /sbin/service iptables restart

access your webmin install via browser :

https://your server name:10000/

Note: you should probably limit the ip’s that can access your webmin interface , cant be too careful now days…
this can be done by changing the above iptables line and add a “-s subnet or ip” , for example limit access to the 192.168.1.0 subnet only :

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp -s 192.168.1.0/24 –dport 10000 -j ACCEPT

and of course reload your iptables again.

Svc command line switches

January 3rd, 2009 No comments

  • -u: Up. If the service is not running, start it. If the service stops, restart it.
  • -d: Down. If the service is running, send it a TERM signal and then a CONT signal. After it stops, do not restart it.
  • -o: Once. If the service is not running, start it. Do not restart it if it stops.
  • -p: Pause. Send the service a STOP signal.
  • -c: Continue. Send the service a CONT signal.
  • -h: Hangup. Send the service a HUP signal.
  • -a: Alarm. Send the service an ALRM signal.
  • -i: Interrupt. Send the service an INT signal.
  • -t: Terminate. Send the service a TERM signal.
  • -k: Kill. Send the service a KILL signal.
  • -x: Exit. supervise will exit as soon as the service is down. If you use this option on a stable system, you're doing something wrong; supervise is designed to run forever.

Install check_mysql_perf on FreeBSD

December 18th, 2008 No comments

I recently had to install check_mysql_perf on our nagios server runing FreeBSD.

After a few failed attempts , I contacted the author Gerhard asking for help. Sure enough a few minutes ( !!! ) later he send me a reply back : 

Add the following at the end of the check_mysql_perf.c : 

char* strndup(const char* string, size_t n)
{
char* copy_string = 0;

if(0 == string || 0 == n)
return 0;

copy_string = (char*) malloc(n + 1);
if(0 == copy_string)
return 0;

memcpy(copy_string, string, n);
*(copy_string + n) = ‘\0′;

return copy_string;
}

and find this line ( line number 77 in my file ) :

char *mysql_status_historical (MYSQL *, char *, long *, int);

and add below it :

char *strndup(const char*, size_t);

this worked like a charm and I have a working plugin now.

thanks Gerhard !!!