Information and news on technology, music and other stuff

July 15th, 2011

Showing all grants in mysql

No Comments, Uncategorized, by Julian Mulder.

This is one thing that I really wonder why mysql did not just add.

Something simple like ‘show all grants;’ would have been perfect. I had to do this on all our servers and doing this by hand would not be nice. A colleague of mine, Nick Kirsten’ tried to write a simple little script to do it automatically. Works quite well :)

mysql_connect("ServerIP", "Username", "Password")or die(mysql_error());;
mysql_select_db("mysql")or die(mysql_error());;
ini_set("display_error", 0);
$sql = mysql_query("select user, host from user order by user");
while($row = mysql_fetch_assoc($sql)){
$sql2 = mysql_query("show grants for ".$row['user']."@'".$row['host']."'");
$row2 = mysql_fetch_array($sql2);
print "

  • “.$row2[0];
    unset($row2);
    }
    ?>

    Thanks Nick!

  • July 4th, 2011

    Cloning a KVM Virtual Server on Proxmox

    1 Comment, Uncategorized, by Julian Mulder.

    There is a lot of host software to use to run a virtual server. We use an open source copy called Proxmox. It does the job. It does everything we need, and is platform independent as it uses a web console. So we can run it under linux.

    I need to clone an existing virtual machine, which is luckily very easy in proxmox.

    Login using ssh as root onto the server
    The VM Disks(or virtual hard drives) are usually located in /var/lib/vz/images/. If you have more that one hard drive like I do, it will be /var/lib/vz/DRIVE/images. In my case /var/lib/vz/sdd/images.
    vmserver:/var/lib/vz/sdd/images# dir -hl
    total 28K
    drwxr-xr-x 2 root root 4.0K May 23 09:14 113
    drwxr-xr-x 2 root root 4.0K Mar 18 09:08 201
    drwxr-xr-x 2 root root 4.0K Mar 18 09:52 2012
    drwxr-xr-x 2 root root 4.0K May 31 09:57 2013
    drwxr-xr-x 2 root root 4.0K May 27 10:50 501
    drwxr-xr-x 2 root root 4.0K May 21 06:56 502
    drwxr-xr-x 2 root root 4.0K May 27 10:51 503

     

    The config files are located in /etc/qemu-server/

    So to clone an existing vm do the following:

    • Login to the web interface and locate the vm. Stop it. Look at the VMID if the virtual machine
    • Go back to the ssh console and locate it, and then copy it:
    • vmserver:/var/lib/vz/sdd/images# cp -r 2013/ 2014

    • Once it has been copied, go into that VMID directory and change the file to the new vmid:
    • vmserver:/var/lib/vz/sdd/images/2014# dir
      vm-2013-disk-1.raw
      vmserver:/var/lib/vz/sdd/images/2014# mv vm-2013-disk-1.raw vm-2014-disk-1.raw
      vmserver:/var/lib/vz/sdd/images/2014# dir
      vm-2014-disk-1.raw

    • Once it is finished copying, you need to goto the config file and locate the config file for that vm. Goto /etc/qemu-server/. Again make a copy of that vm config file with the same number as the clone
    • vmserver:/etc/qemu-server# cp 2013.conf 2014.conf

    • After copying it, you need to edit the information in the file. I have changed it to read the following:
    • name: clone vm
      ide2: none,media=cdrom
      vlan0: e1000=9E:16:98:C1:86:B8
      bootdisk: ide0
      ostype: other
      ide0: VZ2:2014/vm-2014-disk-1.raw
      memory: 1000
      sockets: 2
      boot: cd
      freeze: 0
      cpuunits: 1000
      acpi: 1
      kvm: 1
      onboot: 1
      cores: 2

    • Basically, Change the name of the vm, the vlan0 address and the ide0 should be same as the clone vm

    ALWAYS remember to change the mac adress of vlan0, else it may cause issues in windows.

    Start the vm up again and change the ip address of the machine. All should work then and you have a vm :D

    July 3rd, 2011

    Vodacom and their issues

    No Comments, Uncategorized, by Julian Mulder.

    On thursday 30th June 2011, vodacom had a major network issue. This issue brought down the network for most of the day in several parts of South Africa. Many subscribers were left in the dark and were not happy. 3 Days later and still, vodacom do not know what caused the problem.

    MyBroadband.co.za first reported:
    Vodacom confirmed the problems, saying that they are aware that certain customers “are experiencing issues calling and SMSing”.

    In another article, they said:
    Vodacom Group [JSE:VOD] CEO Pieter Uys on Friday claimed that the mobile operator had been a victim of sabotage on its fibre networks.
    and
    Uys compared the network failure to a hosepipe being severed in two or three pieces with water unable to go through.

    On the same day, Vodacom said:
    Vodacom has denied that a network outage on Thursday was caused by sabotaged fibre optic cables.

    but:
    “The cause of the outage is still being determined, and we will only be able to know once we have done a post mortem on the situation,” Vodacom spokesman Richard Boorman said on Friday.

    So what was the issue?

    ICASA recently conducted a quality of service survey and has found that the largest three mobile operators have failed to meet the minimum requirements for Call Set Up Success Rate (CSSR) and Dropped Call Rate (DCR).

    ICASA conducted the sampled quality of service survey on MTN, Vodacom and Cell C’s networks from the 10th to 15th November 2010 in parts of the Gauteng Province.

    The results of the survey found that MTN did not meet the target in terms of Call Set Up Success Rate, whereas Vodacom and Cell C have complied with this requirement.

    However, all three operators s failed to meet the target in terms of Dropped Call Rate.

    Sources:http://mybroadband.co.za/news/telecoms/28015-mobile-operators-fail-quality-test-icasa.html

    http://mybroadband.co.za/news/cellular/27891-vodacom-network-problems-2.html

    http://mybroadband.co.za/news/cellular/28067-vodacom-denies.html

    http://www.fin24.com/Companies/ICT/Vodacom-claims-sabotage-to-its-network-20110701