Skip to content

Instantly share code, notes, and snippets.

View rc9000's full-sized avatar

Christian Ramseyer rc9000

View GitHub Profile
$ cat /data/postgres/bin/nd_poller_perf.sql
with cte as (
select
(select count(*) from device where last_macsuck > (current_timestamp - interval '1 minute')) as macsuck_last1min,
(select count(*) from device where last_arpnip > (current_timestamp - interval '1 minute')) as arpnip_last1min,
(select count(*) from device where last_macsuck > (current_timestamp - interval '5 minutes')) as macsuck_last5min,
(select count(*) from device where last_arpnip > (current_timestamp - interval '5 minutes')) as arpnip_last5min
)
select
c.macsuck_last1min,
@rc9000
rc9000 / deployment.yml
Last active September 28, 2022 13:44
netdisco v3 device auth
device_auth:
- auth:
pass: jhiK34KahT20
proto: MD5
only: 10.28.15.1
priv:
pass: ncTzu28VVndL
proto: DES
read: true
package App::Netdisco::SSHCollector::Platform::Aruba;
=head1 NAME
App::Netdisco::SSHCollector::Platform::Aruba
=head1 DESCRIPTION
=cut
@rc9000
rc9000 / pg-fail2ban.md
Last active December 31, 2023 16:31
postgres fail2ban configuration with user locking
@rc9000
rc9000 / gist:637bfbcee2ecffec63d683bc06388b89
Created January 24, 2019 15:34
netdisco 2.0 - modify check_mac to collect VRRP addresses
$ diff nd2/lib/perl5/App/Netdisco/Util/Node.pm nd2/lib/perl5/App/Netdisco/Util/Node.pm.dist
105,106c105,107
< debug sprintf ' [%s] check_mac - VRRP mac [%s] - still including', $devip, $node;
< #return 0;
---
> debug sprintf ' [%s] check_mac - VRRP mac [%s] - skipping',
> $devip, $node;
> return 0;
@rc9000
rc9000 / update_public_dns.sh
Last active August 29, 2015 14:27
Create route53 entry with the Name tag of an instance, as CNAME to the public DNS entry provided by AWS
#!/bin/bash
# best to use a dedicated IAM user, see http://cantina.co/automated-dns-for-aws-instances-using-route-53/
# for a guide
export AWS_ACCESS_KEY_ID="your access key"
export AWS_SECRET_ACCESS_KEY="your secret access key"
export ZONE="delegated-to-route53.example.com"
export TTL="600"
1 hostname: cx-core-10070
2 ipaddress: 192.168.2.70
3 tables:
4 - [ ifDescr, ifInUcastPkts, ifInErrors ]
5 pollrules:
6 - rulename: BasicCheck
7 selector: unique
8 continueif: clear
9 - rulename: IfInErrors
10 selector: ifDescr.%