├── README.md ├── config ├── config.info ├── docker-init.pl ├── images └── icon.gif ├── index.cgi ├── lang └── en ├── module.info └── pkg.sh /README.md: -------------------------------------------------------------------------------- 1 | Module to learn Webmin Modules 2 | -------------------------------------------------------------------------------- /config: -------------------------------------------------------------------------------- 1 | mode=/test 2 | -------------------------------------------------------------------------------- /config.info: -------------------------------------------------------------------------------- 1 | mode=the mode 2 | -------------------------------------------------------------------------------- /docker-init.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # my $version = `docker --version`; 3 | # my $status = `service docker status | grep Active`; 4 | 5 | #printf "$version"; 6 | #printf "$status"; 7 | 8 | sub get_docker_version{ 9 | $version = `docker --version`; 10 | return $version; 11 | } 12 | 13 | sub get_docker_status{ 14 | $status = `service docker status | grep Active`; 15 | return $status; 16 | } 17 | 18 | sub get_active{ 19 | @active = `docker ps --format '{{.Names}}'`; 20 | return @active; 21 | } 22 | 23 | sub get_container_details_status{ 24 | my $name = $ARGV[0]; 25 | my $details = `docker ps -f name="$name" --format '{{.Status}}'`; 26 | return $details; 27 | } 28 | 29 | #my $info = `docker ps -f name=xrdp --format '{{.Status}}'`; 30 | #printf "$info"; 31 | #print $ARGV[0]; 32 | -------------------------------------------------------------------------------- /images/icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pknw1/webmin-docker-module/f126e688d4a81483fde65718d95821eeebde5d69/images/icon.gif -------------------------------------------------------------------------------- /index.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | 4 | do '../web-lib.pl'; 5 | do './docker-init.pl'; 6 | require './docker-init.pl'; 7 | 8 | my $version = get_docker_version(); 9 | my $status = get_docker_status(); 10 | my @active = get_active(); 11 | 12 | 13 | &init_config("dockerinfo"); 14 | 15 | %access=&get_module_acl; 16 | 17 | 18 | &header($text{'index_title'}, "", "intro", 1, 1, undef,""); 19 | 20 | 21 | print "
\n"; 22 | ## Insert Output code here 23 | 24 | printf " Docker Version : $version
"; 25 | printf " Docker Status : $status
"; 26 | printf "
"; 27 | 28 | printf ""; 29 | foreach my $container (@active) { 30 | my $status = " "; 31 | my $status = get_container_details_status($container); 32 | 33 | printf ""; 34 | printf ""; 35 | printf ""; 36 | } 37 | printf "
123
$container $status
"; 38 | 39 | my $info = get_container_details_status("xrdp"); 40 | printf "

$info
"; 41 | 42 | printf "
"; 43 | 44 | &footer("/", $text{'index'}); 45 | # uses the index entry in /lang/en 46 | 47 | 48 | 49 | ## if subroutines are not in an extra file put them here 50 | 51 | 52 | ### END of index.cgi ###. 53 | -------------------------------------------------------------------------------- /lang/en: -------------------------------------------------------------------------------- 1 | lang=en 2 | author=PK 3 | module_author=PK 4 | homepage=https://www.github.com/pknw1 5 | copyright=(C) 2019 by PK 6 | license=GPL 7 | 8 | index_root=Webmin Home 9 | index_title=Docker Info 10 | index_not_running_services=Docker is not running. 11 | index_running_services=Docker is running. 12 | index_ever=Docker was not found on your system. Maybe it is not installed, or your module configuration is incorrect. 13 | -------------------------------------------------------------------------------- /module.info: -------------------------------------------------------------------------------- 1 | name=docker 2 | desc=Docker Info 3 | os_support=solaris redhat-linux debian-linux slackware-linux suse-linux aix hpux freebsd osf1 irix 4 | category=servers 5 | -------------------------------------------------------------------------------- /pkg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [[ -d /tmp/dockerinfo ]];then rm -rf /tmp/dockerinfo; fi 3 | if [[ -f /tmp/dockerinfo.wbm.gz ]]; then rm /tmp/dockerinfo.wbm.gz; fi 4 | 5 | mkdir -p /tmp/dockerinfo 6 | cp -R * /tmp/dockerinfo/ 7 | cd /tmp 8 | tar -zcvf ./dockerinfo.wbm.gz dockerinfo 9 | --------------------------------------------------------------------------------