ã¹ã¯ãªããã³ã³ã½ã¼ã«ããã¹ã¬ã¤ãã«ã¹ã¯ãªããéã£ã¦ã¿ã
æè¿ããã£ããJenkinsããã¨ãç¡æ²æ±°ãªãããªããªããã¦ãå®ã¯邪道Jenkinsã®ããæ¹ã模索ãã¦ããããã¾ãããã£ã¦ã¿ãããã¨ã¯ãJenkinsã«ãããªã¢ã¼ãã¸ã§ãå®è¡ã¨ãªã¢ã¼ããµã¼ãã®ç£è¦ãªã©ãªã©ãããããããªãHinemosã¨ãZabbix使ãããã¨ãè¨ããªãã
ã¸ã§ãå®è¡ã¯ãªãã ããã è¨ã£ã¦Jenkinsããã®å¾æåéãªã®ã§ããããç£è¦ç³»ã¯ã©ãããã¹ããï¼ãèãã¦ã¿ããã²ã¨ã¤ã¯ã[twitter:@akiko_pusu]ãããå¾æï¼ï¼ï¼ã«ãã¦ãããå¤é¨ã¸ã§ãã®ç£è¦ãã
â 外部ジョブの監視も使ってみよう!
ããã¯ãç£è¦ãããå´ããç£è¦ãã¦æ¬²ããæ
å ±ãJenkinsããã«éãã¤ããã®ã§ãå³å¯ãªæå³ã§ç£è¦ã¨è¨ããã®ãçåãæ®ãï¼æ»æ´»ç£è¦ã¨ãé£ããããªã¨ï¼ãããã¨ãå¤é¨ã¸ã§ãã®ç£è¦ãã¯ãã«ãã®å¾å¦çã¨ãä»è¾¼ããªãã®ã§ãç£è¦çµæã®éç¥ã¨ãããå ´åãããã²ã¨ã¤ç¥æµãçµããªãã¨ãããªããã
ãã§ãããã£ãèããã®ã¯ã被ç£è¦ãµã¼ããJenkinsããã®ã¹ã¬ã¤ãã«ãã¡ãããã¨ãã¸ã§ã管çã¨ãããããã¨æã£ã¦ããã®ã§ãã¹ã¬ã¤ãã«ãã¨ãã®ãç¡é£ã¡ããç¡é£ãããã§æ°ã«ããã®ã¯ã¹ã¬ã¤ãå´ã§ã©ããªã¸ã§ããå®è¡ãããããªï¼ã£ã¦äºã
ã¹ã¬ã¤ã以å¤ä½è¨ãªã¢ãå
¥ããããªããªã¨æã£ãã®ã§ãæ¨æºã§ã§ããDOSã³ãã³ããã·ã§ã«ã¹ã¯ãªãããèãã¦ã¿ããWindowsç³»ã®ã¹ã¬ã¤ãããç¨æã§ããªãã£ãã®ã§ãDOSã³ãã³ãå©ããã¦ã¿ããã¨ããããå©ãã³ãã³ãã«ãã£ã¦ã¯ã¹ã¬ã¤ãå´ã®æ¨©éä¸è¶³ã§ãã¡ã£ã¦è¨ãããã:-(
ãããããGroovyããªãã¨æã£ããã©ãGroovyãã©ã°ã¤ã³ã ã¨ã¹ã¬ã¤ãå´ã«ãå¥éGroovyå
¥ãã¨ãå¿
è¦ãããã¿ãããJenkinsã«Groovyå
¥ã£ã¦ããã®ã«ãããããå¥ã«Groovyå
¥ããã®ã¯ä½ãã¤ããªã¨ï¼ããããããããäºã¯ã¹ã¯ãªããã³ã³ã½ã¼ã«ã§ã§ããç¨åº¦ã®å
容ã ã£ããï¼ãGroovyãã¤ã³ã¹ãã¼ã«ããæéãæããã§ã¿ãããã
ãã¨ãã¨ãã¹ã¬ã¤ãã®ç®¡çç»é¢ããç¹å®ã®ã¹ã¬ã¤ãã«å¯¾ãã¦ã¹ã¯ãªããã³ã³ã½ã¼ã«ã使ãããã ããããã®è¾ºãå«ãã¦ã¹ã¯ãªããã³ã³ã½ã¼ã«ã§å¶å¾¡ã§ãããããï¼ãã¨æã£ã¦è©¦ãã¦ã¿ãããæå¤ã¨ãã£ããã§ããããããã¯Jenkinsãããç¸å¤ãããæå¾ ãè£åããªãï½
ã¨ãããããã¹ã¯ãªããã³ã³ã½ã¼ã«ã§è©¦ãã¦ã¿ãã³ã¼ãã¯ãããªãã¤ã
import hudson.util.RemotingDiagnostics jenkins.model.Jenkins.instance.nodes.each { computer = it.toComputer() if (computer.isOnline()) { println RemotingDiagnostics.executeGroovy("'ipconfig /all'.execute().in.text", computer.channel) } }
ã§ãã£ã¦ãå®è¡çµæã¯ãããªæãã
RemotingDiagnostics.executeGroovy()
ã«æ¸¡ãGroovyã¹ã¯ãªãããGroovyã£ã½ããªããã©ãæä½é確èªãããã£ããã¨ã¯ã§ããããã¨ã¯ããããã¹ã¯ãªããã³ã³ã½ã¼ã«ãããããªãã¦ãã¸ã§ãããå®è¡ããããã
ããããã£ã¦ã¯Jenkins CLIãèªåèªèº«ã«å¯¾ãã¦å®è¡ãããã¸ã§ããä½ã£ã¦ã¿ãã¨ããããå§ããããããã
ps.
[twitter:@ikikko]ããã®ã¨ã³ããªã¨ãã¿ã¦ãã¨ãJenkinsèªä½ã®ã»ã«ãã¡ã³ããã³ã¹ç¨ã«å®æçã«ã¹ã¯ãªããã³ã³ã½ã¼ã«ã§ä½¿ããã¹ã¯ãªãããå®è¡ãããã£ã¦ç¨éã¯ãããããªãã ãã©ãªãããã§ã«ãããããããæ¹ç¢ºç«ããã¦ãªãã®ããªï¼|дï¾)ï¾ï¾ï½¯
ï¼ã¡ãã£ã¨Manage Script Pluginã¨ãæ°ã«ãªãã