Skip to content

Instantly share code, notes, and snippets.

View Wicaeed's full-sized avatar

Craig Gill Wicaeed

View GitHub Profile
@Wicaeed
Wicaeed / error
Last active January 30, 2016 00:32
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Could not find class ::profile::linuxfw::pre for confluence-test.company.loc at /etc/puppetlabs/code/environments/facter_environment/dist/profile/manifests/linuxfw.pp:19:3 on node confluence-test.company.loc
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
# == Class: linuxfw::post.pp
class profile::linuxfw::post {
firewall { '998 input reject':
proto => 'all',
action => 'reject',
reject => 'icmp-host-prohibited',
before => undef,
}
firewall { '999 forward reject':
proto => 'all',
@Wicaeed
Wicaeed / hiera class
Last active February 4, 2016 23:28
Hiera hash hash format?
{'yaml' => { 'datadir' => '$codedir/hieradata/%{environment}',} }
@Wicaeed
Wicaeed / location.rb
Created March 8, 2016 00:21
IP Physical location from local network
Facter.add(:location) do
setcode do
location = Facter.value(:network)
case location
when /10/
'aws_datacenter'
when /192.168.(230|231|232|233)/
'us_office_location'
when /192.168.(240|241|242|243)/
'overseas_office'
@Wicaeed
Wicaeed / ca_cert.pp
Created March 10, 2016 23:06
Puppet Directory Environment
class profile::certs::ca_cert {
include ::ca_cert
ca_cert::ca { 'Trusted ROOT CA':
ensure => 'trusted',
source => 'puppet:///dist/profile/files/certificates/trustedca.crt',
}
}
@Wicaeed
Wicaeed / Latest Data
Last active March 16, 2016 19:32
Zabbix Idle Transaction Trigger
PostgreSQL Database Backend Connections (2 Items)
PostgreSQL Time Spend Idling In Transaction 2016-03-16 12:31:22 506.12 seconds +60.59 seconds Graph
PostgreSQL Sessions Idling in Transaction 2016-03-16 12:30:48 3 Sessions +2 Sessions Graph
2226:20160623:202355.068 Requested [pgbouncer.stat[free_clients,pgbouncer,host=myhostname port=5432]]
2226:20160623:202355.068 In zbx_popen() command:'/home/zabbix/zabbix-extensions/pgbouncer/scripts/pgbouncer.stat.metadb.sh free_clients pgbouncer host=myhostname port=5432 '
2226:20160623:202355.068 End of zbx_popen():7
13103:20160623:202355.069 zbx_popen(): executing script
2226:20160623:202355.123 In zbx_waitpid()
2226:20160623:202355.123 zbx_waitpid() exited, status:0
2226:20160623:202355.123 End of zbx_waitpid():13103
2226:20160623:202355.123 EXECUTE_STR() command:'/home/zabbix/zabbix-extensions/pgbouncer/scripts/pgbouncer.stat.metadb.sh free_clients pgbouncer host=myhostname port=5432 ' len:4 cmd_result:'1299'
2226:20160623:202355.123 Sending back [1299]
Incorrect trigger expression. Check expression part starting from " & {Templates Scanner Runtime Job Status:pg.query.string[{$PG_CONN},{$PG_DB},"SELECT count(*) FROM job WHERE status = 'pending'"].last()} > {Templates Scanner Runtime Job Status:runtime.job.total.last()}*0.10) | ({TRIGGER.VALUE}=1 & {Templates Scanner Runtime Job Status:pg.query.string[{$PG_CONN},{$PG_DB},"SELECT count(*) FROM job WHERE status = 'pending'"].last()} > {Templates Scanner Runtime Job Status:runtime.job.total.last()}*0.07)".
@Wicaeed
Wicaeed / gist:07f8bb6173d25592901028fc87c7dfa0
Created August 23, 2016 20:54
Zabbix 25% increase trigger
({Template Runtime Job Status:pg.query.string[{$PG_CONN},{$PG_DB},"SELECT count(*) FROM job WHERE status = 'pending'"].max(600)>{Template Runtime Job Status:pg.query.string[{$PG_CONN},{$PG_DB},"SELECT count(*) FROM job WHERE status = 'pending'"].min(600)}*0.25)
@Wicaeed
Wicaeed / Error
Created August 26, 2016 22:28
Advanced Trigger
Incorrect trigger expression. Check expression part starting from " & {Template Runtime Job Status:pg.query.string[{$PG_CONN},{$PG_DB},"SELECT count(*) FROM job WHERE status = 'suspended'"].last()} >
{Template Runtime Job Status:pg.query.string[{$PG_CONN},{$PG_DB},"SELECT count(*) FROM job WHERE status = 'running'"].last()}*0.10)
|
({TRIGGER.VALUE}=1 & {Template Runtime Job Status:pg.query.string[{$PG_CONN},{$PG_DB},"SELECT count(*) FROM job WHERE status = 'suspended'"].last()} >
{Template Runtime Job Status:pg.query.string[{$PG_CONN},{$PG_DB},"SELECT count(*) FROM job WHERE status = 'running'"].last()}*0.05)".