Mgrctl

From ISPWiki
Jump to: navigation, search

Mgrctl is the utility that can be used by all our software products for calling panels' functins from shell. It is located in

/usr/local/mgr5/sbin/mgrctl

Syntax

/usr/local/mgr5/sbin/mgrctl [-m <manager>] [-o <output format>] [-R | funcname [[param=value] ...]]
-m <manager> - short name of a control panel  (ispmgr, billmgr, vmmgr, vemgr, dcimgr, ipmgr, dnsmgr).
-o <output format> - output mode; possible values:  text, xml, devel, json. By default - text.
-l - pause the control panel. 
-u - resume operation of the control panel suspended with the -l option. 

Execute the following command to get a list of all the mgrctl functions

/usr/local/mgr5/sbin/mgrctl -m <manager> actionlist

Examples

  • Restart a control panel
/usr/local/mgr5/sbin/mgrctl -m <manager> exit

ISPmanager

Description of all the functions and there parameters can be found here.

  • Update ISPmanager Lite
/usr/local/mgr5/sbin/mgrctl -m core product.update elid=ispmgr.lite
  • Get a list of all Web-domains
/usr/local/mgr5/sbin/mgrctl -m ispmgr webdomain  | sed 's/=/ /' | awk '{print $2}'
  • Get a list of all Web-domains that belong to the certain user
/usr/local/mgr5/sbin/mgrctl -m ispmgr webdomain  su=user  | sed 's/=/ /' | awk '{print $2}'
  • Update all domains on external name servers
for i in `/usr/local/mgr5/sbin/mgrctl -m ispmgr webdomain | awk '{print $1}' | awk -F = '{print $2}'`; do /usr/local/mgr5/sbin/mgrctl -m ispmgr domain.fix elid=$i;done
  • Disable php for all domains
for i in `/usr/local/mg5/sbin/mgrctl -m ispmgr webdomain | awk '{print $1}' | awk -F = '{print $2}'`; do /usr/local/mgr5/sbin/mgrctl -m ispmgr webdomain.edit php=off elid=$i sok=ok;done

VEmanager

Description of all the functions and there parameters can be found here.

  • Restart a container
/usr/local/mgr5/sbin/mgrctl -m vemgr vm.restart elid=<container_id>
  • Get a list of all OS templates
/usr/local/mgr5/sbin/mgrctl -m vemgr osmgr | sed 's/=/ /g' | awk '{print $4}'
  • Install/Update OS templates
for i in `/usr/local/mgr5/sbin/mgrctl -m vemgr osmgr | sed 's/=/ /g' | awk '{print $2}'`; do /usr/local/mgr5/sbin/mgrctl -m vemgr osmgr.install elid=$i sok=ok;done

VMmanager

Description of all the functions and there parameters can be found here.

  • Stop virtual machines
/usr/local/mgr5/sbin/mgrctl -m vmmgr vm.stop elid=id1,id2,....
  • Stop all virtual machines
for i in `/usr/local/mgr5/sbin/mgrctl -m vmmgr vm | awk '{print $1}' | awk -F= '{print $2}'`; do /usr/local/mgr5/sbin/mgrctl -m vmmgr vm.stop elid=$i; done
  • Get the names of all running virtual machines
/usr/local/mgr5/sbin/mgrctl -m vmmgr vm | grep running | awk '{print $2}' | awk -F= '{print $2}'

DNSmanager

Description of all the functions and there parameters can be found here.

  • Updates domain names of domain.com
/usr/local/mgr5/sbin/mgrctl -m dnsmgr domain.refresh elid=domain.com
  • Updata data for all domains belongong to user
for i in `/usr/local/mgr5/sbin/mgrctl -m dnsmgr domain su=user | awk '{print $4}' | awk -F= '{print $2}'`; do /usr/local/mgr5/sbin/mgrctl -m dnsmgr domain.refresh elid=$i;done

IPmanager

Description of all the functions and there parameters can be found here.

  • Get statistics on allocated IP addresses
/usr/local/mgr5/sbin/mgrctl -m ipmgr permstat

DCImanager

Description of all the functions and there parameters can be found here.

  • Get names of all the servers located in the rack 'RAC 5'
/usr/local/mgr5/sbin/mgrctl -m dcimgr server su=admin | grep 'RAC 5' | awk '{print $2}' | awk -F= '{print $2}'