$ serverkit check recipe.yml
/Library/Ruby/Gems/2.0.0/gems/serverkit-0.6.2/lib/serverkit/loaders/base_loader.rb:52:in ``': No such file or directory - recipe.yml (Errno::ENOENT)
from /Library/Ruby/Gems/2.0.0/gems/serverkit-0.6.2/lib/serverkit/loaders/base_loader.rb:52:in `execute'
from /Library/Ruby/Gems/2.0.0/gems/serverkit-0.6.2/lib/serverkit/loaders/base_loader.rb:124:in `load_data_from_executable'
from /Library/Ruby/Gems/2.0.0/gems/serverkit-0.6.2/lib/serverkit/loaders/base_loader.rb:95:in `load_data'
from /Library/Ruby/Gems/2.0.0/gems/serverkit-0.6.2/lib/serverkit/loaders/recipe_loader.rb:36:in `load_from_data'
from /Library/Ruby/Gems/2.0.0/gems/serverkit-0.6.2/lib/serverkit/loaders/base_loader.rb:27:in `load'
from /Library/Ruby/Gems/2.0.0/gems/serverkit-0.6.2/lib/serverkit/actions/base.rb:77:in `recipe'
from /Library/Ruby/Gems/2.0.0/gems/serverkit-0.6.2/lib/serverkit/actions/base.rb:72:in `setup'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// e.g. | |
// Cpu(s): 1.1%us, 0.6%sy, 0.0%ni, 97.5%id, 0.6%wa, 0.1%hi, 0.1%si, 0.0%st | |
new File('/path/02_cpu.txt').eachLine { | |
m = (it =~ /Cpu\(s\):\ +([0-9.]+)%us,\ +([0-9.]+)%sy.+/) | |
// if(m.matches()) { | |
println "${m[0][1]}\t${m[0][2]}" | |
// } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''\ | |
pwd | |
ls | |
'''.eachLine { | |
def p = it.execute() | |
p.waitFor() | |
println p.text | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''\ | |
https://twitter.com/eiryu/status/586690213721714688 | |
https://twitter.com/eiryu/status/586781258572701697 | |
https://twitter.com/eiryu/status/586789657985163264 | |
https://twitter.com/eiryu/status/586792192858927104 | |
https://twitter.com/eiryu/status/586801384097366016 | |
'''.eachLine { | |
println "[${it}:embed]" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('commons-beanutils:commons-beanutils:1.8.3') | |
import org.apache.commons.beanutils.PropertyUtils | |
def b= new Bean(); | |
b.name= 'bob' | |
b.age= 11 | |
println b | |
// Mapに詰めてくれる |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Groovy Version: 2.2.1 JVM: 1.7.0_51 Vendor: Oracle Corporation OS: Mac OS X | |
// 実行時に引数としてログファイル名を絶対パスで指定すること | |
// 特定の間隔でアクセス数を算出 | |
@Grab('org.apache.commons:commons-lang3:3.2.1') | |
import org.apache.commons.lang3.time.FastDateFormat | |
@Grab('am.ik.ltsv4j:ltsv4j:0.9.0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
【インシデント発生連絡】インシデントNo.{EVENT.ID} {HOST.NAME}で{TRIGGER.NAME}が発生 | |
インシデントチケットを発行します。 | |
インシデントNo:{EVENT.ID} | |
発見日時:{DATE} {TIME} | |
ホスト名:{HOST.NAME} | |
ホストIP:{HOST.IP} | |
ホストグループ:{TRIGGER.HOSTGROUP.NAME} | |
監視項目名:{ITEM.NAME1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('com.amazonaws:aws-java-sdk:1.9.17') | |
import com.amazonaws.ClientConfiguration; | |
import com.amazonaws.auth.AWSCredentials; | |
import com.amazonaws.auth.BasicAWSCredentials; | |
import com.amazonaws.regions.Region; | |
import com.amazonaws.regions.Regions; | |
import com.amazonaws.services.elastictranscoder.AmazonElasticTranscoderClient; | |
import com.amazonaws.services.elastictranscoder.model.CreateJobOutput; | |
import com.amazonaws.services.elastictranscoder.model.CreateJobRequest; | |
import com.amazonaws.services.elastictranscoder.model.CreateJobResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('com.moandjiezana.toml:toml4j:0.3.1') | |
import com.moandjiezana.toml.Toml | |
Toml toml = new Toml().parse(new File("sample.toml")) | |
println toml.getString("servers.beta.ip") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Groovy Version: 2.3.8 JVM: 1.8.0_25 Vendor: Oracle Corporation OS: Mac OS X | |
@Grab('com.amazonaws:aws-java-sdk:1.9.17') | |
import com.amazonaws.services.sns.util.SignatureChecker; | |
import java.security.cert.CertificateFactory; | |
import java.security.cert.X509Certificate; | |
String json = "SNSから送られてきたJSON"; | |
// 上記JSONから取り出したsigningCertUrl | |
String signingCertUrl = "https://xxxx.amazonaws.com/SimpleNotificationService-xxxxx.pem"; |