#!/bin/bash
#author xiaoweige
#todo: ip -- > ingredient or ingredient -- > ip

#todo: get the ip of the given ingredient
function ingredient_ip() {
#todo: get the ip of the ingredient given
  mysql -uroot -pengine -e "select * from ipandingredient.ipandingredient where env ='$1' and ingredient='$2'"
}
#todo: not sure what the ingredient is
function search_ingredient() {
  mysql -uroot -pengine -e "use ipandingredient ;select * from ipandingredient where ingredient like '%${1}%' "

}
#todo: get the ip of the ingredient given
function ip_ingredient() {
  mysql -uroot -pengine -e "use ipandingredient; select * from ipandingredient where env='$1' and ip='$2' "

}

function usage() {
  echo "to get ingredient USAGE: ./$0 ip"
  echo "to get ip USAGE: ./$0 ingredient"
  echo "search ingredient ./$0 sth"

}

function main(){
  if [ $# -eq 0 ]
  then
    usage
  elif [ $# -eq 1 ]
  then
    search_ingredient $1
  elif [ $# -eq 2 ]
  then
  argtype=`echo $2|egrep [1-9+\.]`
  if [ -z $argtype ]
  then
    ingredient_ip $1 $2
  else
    ip_ingredient_ip $1 $2
  fi
fi

}
main $*

从CMDB查询云平台组件或者IP简单脚本的更多相关文章

  1. 云平台服务运行情况检测脚本V0.1

    1.准备Python3环境 yum groupinstall "Development tools" -y yum install zlib-devel bzip2-devel o ...

  2. 基于容器微服务的PaaS云平台设计(一) 实现容器微服务和持续集成

    版权声明:本文为博主原创文章,欢迎转载,转载请注明作者.原文超链接 ,博主地址:http://www.cnblogs.com/SuperXJ/ 前言:关于什么是容器微服务PaaS和容器微服务PaaS的 ...

  3. 完整部署CentOS7.2+OpenStack+kvm 云平台环境(3)--为虚拟机指定固定ip

    之前在测试环境(centos7.2)上部署了openstack云平台(完整部署CentOS7.2+OpenStack+kvm 云平台环境(1)--基础环境搭建),openstack在neutron组网 ...

  4. YY游戏私有云平台实践 (转自InfoQ )

    作者 风河 发布于 2016年1月13日 | 讨论   编者按:YY游戏的页游早在2013年就在云平台上运行,其Cloud 1.0已经支撑几十万的同时在线用户.日前,YY游戏云平台进行了Cloud 2 ...

  5. OpenStack-Ocata版+CentOS7.6 云平台环境搭建 — 8.仪表盘 Dashboard(horizon)安装配置

    仪表盘Dashboard(horizon)是一个web接口,使得云平台管理员以及用户可以管理不同的Openstack资源以及服务.这个部署示例使用的是 Apache Web 服务器. 节点配置信息说明 ...

  6. 完整部署CentOS7.2+OpenStack+kvm 云平台环境(2)--云硬盘等后续配置

    继上一篇博客介绍了完整部署CentOS7.2+OpenStack+kvm 云平台环境(1)--基础环境搭建,本篇继续讲述后续部分的内容 1 虚拟机相关1.1 虚拟机位置介绍 openstack上创建的 ...

  7. 使用 Azure CLI 在 Azure China Cloud 云平台上手动部署一套 Cloud Foundry

    这篇文章将介绍如何使用 Azure CLI 在 Azure China Cloud 云平台上手动部署一套 Cloud Foundry.本文的目的在于: 了解作为 PaaS 的 Cloud Foundr ...

  8. Kubernetes容器云平台建设实践

    [51CTO.com原创稿件]Kubernetes是Google开源的一个容器编排引擎,它支持自动化部署.大规模可伸缩.应用容器化管理.伴随着云原生技术的迅速崛起,如今Kubernetes 事实上已经 ...

  9. 轻量化安装 TKEStack:让已有 K8s 集群拥有企业级容器云平台的能力

    关于我们 更多关于云原生的案例和知识,可关注同名[腾讯云原生]公众号~ 福利: ①公众号后台回复[手册],可获得<腾讯云原生路线图手册>&<腾讯云原生最佳实践>~ ②公 ...

随机推荐

  1. html基础-a标签-img标签-绝对/相对路径(3)

    美好的星期六,今天多写一点,争取早点写js这个有点小无聊. 一.先来讲点网页之间的跳转 (1).<a href=""></a>  href="这里 ...

  2. Linux之FineBI集群部署

    在企业应用中,通常单个计算机的配置是有限的,而企业应用又是高并发的需求,这个时候会通过计算机集群的方式来提高并发数,从而提高整体应用服务的性能.集群是将多台计算机作为一个整体来提供相关应用的服务.Fi ...

  3. 使用 RamMap 清理内存 How to Use RamMap to Empty System Working Set

    使用 RamMap 清理内存 In this post I want to introduce RamMap by Microsoft. It’s a free tool you can use to ...

  4. Windows access Linux / Ubuntu via Remote Desktop via xrdp

    Windows 多用户远程桌面连接到 Ubuntu / Linux Access Ubuntu from Windows remotely   Follow these steps : Step 1 ...

  5. keras Lambda 层

    Lambda层 keras.layers.core.Lambda(function, output_shape=None, mask=None, arguments=None) 本函数用以对上一层的输 ...

  6. ActionContext和ServletActionContext小结(转)

    ActionContext和ServletActionContext小结 1. ActionContext 在Struts2开发中,除了将请求参数自动设置到Action的字段中,我们往往也需要在Act ...

  7. Oracle EBS 应收API只创建收款没有核销行以及消息堆栈

    只创建了收款但没有创建核销行 排除其他原因 有可能是缓存溢出导致的这个要改成true 且使用消息堆栈处理

  8. 转:.net设计模式之单例模式

    原文地址:http://terrylee.cnblogs.com/archive/2005/12/09/293509.html 概述 Singleton模式要求一个类有且仅有一个实例,并且提供了一个全 ...

  9. 有序字典(OrderedDict)、默认字典(defaultdict)内置函数

    http://www.cnblogs.com/wupeiqi/articles/5115190.html import collections do = collections.OrderedDict ...

  10. REDIS线上问题

    这周终于解决了Redis访问经常超时的问题,终于可以踏实睡觉了.从上周就开始纠结在这个问题上,可以用寝食难安来形容,感觉这个问题就像个定时炸弹一样,虽然根据手搜的访问量,极少的Timeout Erro ...