From f0d3126c30e18c9451104ed9b0e63e39b90ba502 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 2 Feb 2015 09:40:57 +0100 Subject: [PATCH] Add some tests to print process and socket informations. --- dynmotd | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 148 insertions(+), 3 deletions(-) diff --git a/dynmotd b/dynmotd index 7a60026..84e7aa8 100755 --- a/dynmotd +++ b/dynmotd @@ -176,11 +176,156 @@ done printf '%b' "\n${MAGENTA}+++++++++++++++++++: ${WHITE}Service Info${MAGENTA} :++++++++++++++++++++${RESET}" ## IF POSTFIX -MSG=$(process_info "postfix" '') -MSG=$(service_info "25" "${MSG}") -printf '%b' "\n${MSG}" +if [ $(which postfix) ]; then + MSG=$(process_info "postfix" '') + MSG=$(service_info "25" "${MSG}") + printf '%b' "\n${MSG}" +fi ## FI POSTFIX +### IF APACHE2 +if [ $(which apache2) ]; then + MSG=$(process_info "apache2" '') + MSG=$(service_info "80 443" "${MSG}") + printf '%b' "\n${MSG}" +fi +### FI APACHE2 + +### IF NGINX +if [ $(which nginx) ]; then + MSG=$(process_info "nginx" '') + MSG=$(service_info "80 443" "${MSG}") + printf '%b' "\n${MSG}" +fi +### FI NGINX + +### IF MYSQLD +if [ $(which mysqld) ]; then + MSG=$(process_info "mysqld" '') + MSG=$(service_info "3306" "${MSG}") + printf '%b' "\n${MSG}" +fi +### IF MYSQLD + +### IF SLAPD +if [ $(which slapd) ]; then + MSG=$(process_info "slapd" '') + MSG=$(service_info "389 636" "${MSG}") + printf '%b' "\n${MSG}" +fi +### IF SLAPD + +### IF ZFS +if [ $(which zfs) ]; then + MSG=$(process_info "zfs" '') + printf '%b' "\n${MSG}" +fi +### FI ZFS + +### IF PUPPETMASTER +if [ $(which puppetmaster) ]; then + MSG=$(process_info "puppetmaster" '') + MSG=$(service_info "8140" "${MSG}") + printf '%b' "\n${MSG}" +fi +### IF SLAPD + +### IF NFS Server +if [ $(which nfsd) ]; then + MSG=$(process_info "nfsd" '') + MSG=$(service_info "111 2049" "${MSG}") + printf '%b' "\n${MSG}" +fi +### IF SLAPD + +### IF TFTPD +if [ $(which in.tftpd) ]; then + MSG=$(process_info "in.tftpd" '') + #MSG=$(service_info "69" "${MSG}") + printf '%b' "\n${MSG}" +fi +### FI TFTPD + +### IF SQUID3 +if [ $(which squid3) ]; then + MSG=$(process_info "squid3" '') + MSG=$(service_info "3128" "${MSG}") + printf '%b' "\n${MSG}" +fi +### FI SQUID3 + +### IF APT-CACHER-NG +if [ $(which apt-cacher-ng) ]; then + MSG=$(process_info "apt-cacher-ng" '') + MSG=$(service_info "3142" "${MSG}") + printf '%b' "\n${MSG}" +fi +### FI APT-CACHER-NG + +### IF SSHD +if [ $(which sshd) ]; then + MSG=$(process_info "sshd" '') + MSG=$(service_info "22" "${MSG}") + printf '%b' "\n${MSG}" +fi +### FI SSH + +### IF DHCPD +if [ $(which dhcpd) ]; then + MSG=$(process_info "dhcpd" '') + printf '%b' "\n${MSG}" +fi +### IF DHCPD + +### IF FAIL2BAN +if [ $(which fail2ban-server) ]; then + MSG=$(process_info "fail2ban" '') + printf '%b' "\n${MSG}" +fi +### IF FAIL2BAN + +### IF ETHERPAD +if [ $(which etherpad) ]; then + MSG=$(process_info "etherpad" '') + MSG=$(service_info "9001" "${MSG}") + printf '%b' "\n${MSG}" +fi +### IF ETHERPAD + +### IF ETHERCALC +if [ $(which ethercalc) ]; then + MSG=$(process_info "ethercalc" '') + MSG=$(service_info "8000" "${MSG}") + printf '%b' "\n${MSG}" +fi +### IF ETHERCALC + +### IF GITLAB +if [ $(which gitlab-ctl) ]; then + MSG=$(process_info "nginx" '') + MSG=$(service_info "80 443" "${MSG}") + printf '%b' "\n${MSG}" + MSG=$(process_info "gitlab" '') + printf '%b' "\n${MSG}" +fi +### IF GITLAB + +### IF XYMONSERVER +if [ $(which xymond) ]; then + MSG=$(process_info "xymond" '') + MSG=$(service_info "1984" "${MSG}") + printf '%b' "\n${MSG}" +fi +### IF XYMONSERVER + +### IF XYMONCLIENT +if [ $(which xymon) ]; then + MSG=$(process_info "xymonlaunch" '') + printf '%b' "\n${MSG}" +fi +### IF XYMONCLIENT + + ## Service need a warning if running YELLOW_SERVICE='tmux screen glances htop automysqlbackup vzdump puppet aptitude' for SERVICE in ${YELLOW_SERVICE}; do