brew install gnu-sed gnu-tar docker docker-compose docker-buildx colima
- follow the instruction to edit docker config
- follow the instruction to start colima daemon
- follow the PATH updates guidance
colima start
curl -Ls -o docker-compose.yml https://tinyurl.com/nd2-dockercompose
docker-compose pull netdisco-do
docker run -it --entrypoint ash 5a0269c7d43a
docker rm -vf $(docker ps -aq)
docker rmi -f $(docker images -aq)
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
%MIBS = ( | |
%SNMP::Info::Layer3::MIBS, | |
'WLSR-AP-MIB' => 'wlsrHideSSID', | |
'WLSX-IFEXT-MIB' => 'ifExtVlanName', | |
'WLSX-POE-MIB' => 'wlsxPseSlotPowerAvailable', | |
'WLSX-SWITCH-MIB' => 'wlsxHostname', | |
'WLSX-SYSTEMEXT-MIB' => 'wlsxSysExtSwitchBaseMacaddress', | |
'WLSX-USER-MIB' => 'nUserCurrentVlan', | |
'WLSX-WLAN-MIB' => 'wlanAPFQLN', | |
'AI-AP-MIB' => 'aiAPSerialNum', |
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
SELECT ips[1] AS left_ip, | |
ports[1] AS left_port, | |
(SELECT array_agg(a) FROM jsonb_array_elements_text(vlans->0) AS a) AS left_vlans, | |
(SELECT array_agg(a) | |
FROM jsonb_array_elements_text(vlans->0) AS a | |
WHERE a NOT IN | |
(SELECT b FROM jsonb_array_elements_text(vlans->1) AS b)) as only_left_vlans, | |
ips[2] AS right_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
PUT http://localhost:5000/api/v1/object/device/192.0.2.1/nodes | |
# GET/DELETE methods take query string params to filter: | |
# device, port, action, status, username, userip, backend | |
# list of jobs in the queue | |
# accepts LIMIT option | |
GET http://localhost:5000/api/v1/queue/jobs | |
# submit one or more new jobs |
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
SELECT ip | |
FROM device | |
LEFT OUTER JOIN admin ON (device.ip = admin.device | |
AND admin.status = 'queued' | |
AND admin.action = 'macsuck') | |
FULL OUTER JOIN device_skip ON (device_skip.device = device.ip | |
AND (device_skip.actionset @> string_to_array('macsuck', '') | |
OR (device_skip.deferrals >= '10' | |
AND device_skip.last_defer > (LOCALTIMESTAMP - '7 days' ::interval)))) | |
WHERE admin.device IS NULL |
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
PUT http://localhost:5000/api/v1/action/macsuck/192.0.2.1?enqueue=true×tamp=now | |
port | |
mac | |
vlan? | |
params - "not part of the resource itself" so OK for query string | |
cannot use macsuck_no because then job refuses to run | |
but will rows be removed by snmp job exec? | |
skip is_macsuckable_now in check phase | |
use early phase to gather data or skip if in `extra` or `port` (mnemonic: path), use store to store. |
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
ignore_deviceports: | |
'group:__ANY__': | |
- 'port:EOBC' | |
- 'port:unrouted VLAN(?: \d+)?' | |
# etc... | |
'vendor:juniper': | |
- '128.0.0.0/2' | |
- 'port:.+\.1638[3456]' | |
- 'port:.+\.3276[789]' |
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
# curl -f >> onto authorized_keys | |
# grep a_k for certs | |
# if more than two lines | |
# sed out the first N of them | |
curl -sf https://my-cert.pub >> ~/.ssh/authorized_keys && | |
sed -i '' '1!G;h;$!d' ~/.ssh/authorized_keys && | |
awk '!/^cert-authority / || ++n < 3' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.tmp && | |
sed '1!G;h;$!d' ~/.ssh/authorized_keys.tmp > ~/.ssh/authorized_keys && | |
rm ~/.ssh/authorized_keys.tmp && |
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
# find files | |
g grep -cP "% [a-z][a-z._\(\/\)']+ %" share/views/ | |
# vim command | |
.,$s:\(% \l[a-z._('/)]\+\) %:\1 | hmtl_entity %:cgI |
NewerOlder