#!/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 active属性

    源代码 <div class="col-md-3"> <div class="list-group"> <a href=" ...

  2. JS数组与对象的遍历方法大全

    本文简单解析各种数组和对象属性的遍历方法: 原生for循环.for-in及forEach ES6 for-of方法遍历类数组集合 Object.key()返回键名的集合 jQuery的$.each() ...

  3. ReactJS表单handleChange

    handleInputChange = (event) => { const target = event.target; const type = target.type; const val ...

  4. PHP二维数据排序,二维数据模糊查询

    一.因为项目中的一个报表需要合并三个表的数据,所以分表查询再合并数据,利用PHP数组函数进行排序,搜索.三表合并后的数组结构如下: Array ( [0] => Array ( [history ...

  5. JQuery this和$(this)的区别

    this其实是一个Html 元素. $this 只是个变量名,加$是为说明其是个jquery对象. 而$(this)是个转换,将this表示的dom对象转为jquery对象,这样就可以使用jquery ...

  6. SqlServer横向扩展负载均衡终极利器SqlServerProxy 不限功能永久免费

    一直以来,MySQL因为开源,诞生了很多扩展方案,类似Amoeba.Atlas.Cobar.MySQLProxy等,大都基于MySQL通信协议来定制解决方案,让我们很羡慕嫉妒,但没办法,Microso ...

  7. Linux 查看双节点是否做了SSH信任

    perl $AD_TOP/patch/115/bin/txkRunSSHSetup.pl verifyssh -contextfile=$CONTEXT_FILE -hosts=erpapp1,erp ...

  8. VisualSVN Server迁移的方法

    VisualSVN Server迁移涉及到两种情况: 第一种情况:VisualSVN Server没有更换电脑或者服务器,只是修改Server name. 第二种情况:当VisualSVN Serve ...

  9. centos7上安装 mysql

    centos7上的安装是和其他的版本不一样的 ,因为centos上的安装与centos的操作是不通了的 在CentOS中默认安装有MariaDB,这个是MySQL的分支,但为了需要,还是要在系统中安装 ...

  10. [翻译] SSKeychain

    SSKeychain https://github.com/soffes/sskeychain SSKeychain is a simple wrapper for accessing account ...