diff --git a/ansible/README.md b/ansible/README.md index 9983a0d..4e06fb7 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -80,12 +80,16 @@ alerts until it is: |---|---| | WireGuard client | `wireguard_clients` (`group_vars/all/wireguard.yaml`) | | Server on the VPC | `security_vpc_hosts` | +| Server in the Hetzner project | `monitoring_hcloud_servers` (`group_vars/all/monitoring.yaml`) | | Account, sudo or docker member | `security_login_users`, `security_sudo_users`, `security_docker_users` | | Published or listening port | `security_ports_extra` (host_vars) | | Privileged container, host network, Docker socket | `security_containers_extra` (host_vars) | Defaults are in `roles/monitoring_agent/defaults/main.yaml`. The VPC check is a ping sweep: a device that drops ICMP is not seen. +Prometheus therefore also lists the project's servers from the Hetzner +API (`vault_hcloud_ro_token`, a read-only token) and alerts on an unknown +one, or when the list stops updating. ## Bootstrap playbooks diff --git a/ansible/inventory/group_vars/all/monitoring.yaml b/ansible/inventory/group_vars/all/monitoring.yaml index fa0e594..b937852 100644 --- a/ansible/inventory/group_vars/all/monitoring.yaml +++ b/ansible/inventory/group_vars/all/monitoring.yaml @@ -32,3 +32,8 @@ monitoring_textfile_dir: /var/lib/node_exporter/textfile monitoring_grafana_host: gf.asxp.io monitoring_grafana_admin_password: "{{ vault_grafana_admin_password }}" monitoring_forgejo_metrics_token: "{{ vault_forgejo_metrics_token }}" + +# Read-only Hetzner Cloud token: Prometheus lists the project's servers +# and alerts on one that is not named here. +monitoring_hcloud_token: "{{ vault_hcloud_ro_token }}" +monitoring_hcloud_servers: [asxpio-ops, asxpio-services] diff --git a/ansible/inventory/group_vars/all/vault.yaml b/ansible/inventory/group_vars/all/vault.yaml index 0d69c67..2049a74 100644 --- a/ansible/inventory/group_vars/all/vault.yaml +++ b/ansible/inventory/group_vars/all/vault.yaml @@ -1,170 +1,175 @@ $ANSIBLE_VAULT;1.1;AES256 -62653531636435386335636364616132363938633234306136383934323061656135646462613361 -3565643532313232366136316437306231656365656238300a643861333935623734653466663563 -36383330363030393064303035363639646362326132313433333232613933653532333965353163 -3939363632393635350a316436626464663234313137666337646635326535326165653831346565 -32623865396532633862633632663363323466346232643335633733343237663337336262663564 -34356162653338656533363965653264303931363461613431386363336364646137633537393338 -64343637333462386365323535333962666566333561363033343062613330366466323063356237 -63633662336364663164656536656237396630356364336534663931346636666435313935343436 -65363533303162643435306232303131396161623837356163306531316462323739303866346263 -36313535373539326132643033373161613738336133663439373866376530323163623061653163 -62636362656362356636656338303064303832376165356566363164656633383430656330663439 -65663332343161643466313261643734313735663635363836393735663533323939666632666637 -66303932333438643436623539636636653139373562363733303637663165623366333237613261 -39386333373462303439333963373264636565646635623532393365303635656136623362656561 -33636635346261396661663662613336306662643635396261653636643639346466656130343764 -31336337383763633139303430316366393931616138353637613765333337323764656230373731 -34346632336133306433323535303162623763303135353834303766613839353939376436366464 -62333263343561663836376134613736383131366638626265343462313164666461306464366430 -39343266613535363465376133623437303966366533646663396136393135383136383536616633 -34353864393961356533633163333035323164353061373366326266623734313631643637303936 -61303935336537663865663431643739616430353933313766373466346435333263323630353961 -39356335666364393239303937363134313231333264373139333865353139353738346561336138 -36363265303161303536373736613265383232616466616635336232646336316265616531343932 -62326133613764666536356262396163626437646230663933636534373062393831363238326461 -63613639656535346561393234323063663765383234313339656332366539353866313739656533 -38666232313330623738346561353165346664626439303263336138393763653432366162303837 -61323733366161336439373564333937303137373334343132643137303935616361653036366538 -64306434646665323866653664373539643233383962346137393366316639616637303732323432 -35653065613033663763343933316631363764356137333661613433303139326135353863356435 -33303730633262336433626232613334646365383533386164326232636139653639366362303830 -63663632303263373038386230313130336235613033643565346435326466653838373366653530 -61343661353235393262366439343563346232636431383938333130373534366538363637663931 -33303938356666393738636231366264373061333765323339346362363337313234323631353331 -37656134623861353866313936373430333063626664376162323232653635306361633162373061 -39643132323162333961346261373132373962333137336332656437316332343364326434613336 -33663961323661636439626337316565663835373938643034623534613263346432643435313438 -33313561363866633964613635666335313031373465383666363937656133616665396666346163 -36303932336262393862333935353932646337656331306438643432633165306265646535316536 -36353530326263643765623562613433356439376238393531633235383461316462386139323864 -31313838386232383861663738653937623866376637626364643730343830636161383135633338 -61326635643765633631356262353661623865363839386166656530656239333261313961346661 -61653663643963313764633931326530626433306466303839346663343637343565393732616235 -65343639396537386435656263313337653636313135353465303635303331376263383565346261 -64366366633834666539653062353166626138623231303437633563653238336561613234633835 -65663262343637653532376238353837376561653732633738333933626561333932383732356132 -30653066353063313836666563326165343933386336336233353066383338343339316534326161 -31323438663433633139643061333635316633353262343234633034303965663361626438313830 -62653238616233303466373034333262313932616565643330393363376337383662373631386338 -39323030353564646330323361353737333936373137336362346635346665376165613336313431 -30353463333335616433663563653261383534613730646230376533373735613263323966393839 -66626364663266616332643633343165336131313665376132616339356639313761383761636463 -31343565326139646663356431643634636538323933343136626434316162316463313464356539 -31333638393337393835626331376131326331376638613739636336313536376363396331646334 -66616136333964343436636563353837363731386662656466623239383865663836653563306632 -63336365303731663465336539613637376332653165663830336133366661393530383836376538 -62393032626633346238353663383761373637356361313163336138663537313937303766376137 -31393130616539313162663236323565643636663764386238313532353064636163333832663933 -64396439363135323866636164633437663639366262356565326133653335613731333230626532 -35303965376238636463333634366630346161336638386238633032636335323838656139316138 -36316530376433366632626462656332313334313235633138303235336666333666393362373839 -64366438633463336538336230653739653537363635393839373235373737623861633434306636 -61333364626135353037623237363838363834383431356661626139386331313563363130383834 -33633933643361663433666665623266326233643361306435616236633139356138363462656533 -64613130633135343631363639633066373663393336396665643532316233376531353261363538 -30333563363435323133636432346333346139633361333738383438626338396263623961653163 -36303731613062663064333538383261303561336536633231613939666134326338636633356239 -31363739653430383965396461323830316237653839353065313632613530663737663230353531 -35356464383037343739373435303662343261663637303365633064316632333634343933383733 -37633164343932373962363338306535636138383834643232316531643339346564373136326361 -61623638666237333266326364636133356234343263623637333039353131353536343439373836 -38613764633038656362376637366335376561303735343663636232343262393263373731346461 -32663966333932373264383935613632643633623966336233393736663339666135663037663936 -36633366623234323137366561373233613738366431326338616661373632306338366634313737 -33366564653933373332626162316335393837323664333530336635353139386363613338633432 -34306435616539626239396163333963376336616336336338623461303261393265353930323765 -32656262376237643862336238636264613663646338353835356131626264363736393030396331 -63653864313637313462303764663364396532343838383833346466336162323939386461633733 -62313335336132343236376539373863363134366563313563333733353237666334626432363362 -65363865376561633437616365306332373564313038316635373538343232376165656639373932 -37343735343863616161663861353338643533356638326230326437353535343432653632343935 -32636239363434653139366131306237306262643364663638326333353331363130363464373964 -66333138306233616164333838346533346561336334656166633838666164636438383939376434 -62313031663131383335633666376137396162636466343033316565343337386664663135636236 -33633934613037666632336237633632643230383433336263373864633765623339646661663334 -66613765326639323832623835333361376562636530643636326266333333376263663732643763 -65306133323534366133636330363830663834356161646436393866313130623835336533383530 -34613539303164663064316234623339353635643939323361316361393761363031353036333137 -33613630623362653533653961343139376164623332376431626464636436383762303733303138 -30313132653530313532653632393065613435616666393264386266373037623936363962653234 -64303461623839303035386533396266303534306431343864323130373732393430373062326637 -66396133376666383238303761663061396238323963643134626165356331616332663264633838 -35663765346633653064393237613439626465303530316130366665643131613864353331366331 -65396533376438323036366137383736666638393061346565613833643239646363393064633666 -66326261313932343039306465653861366136313933323134376236306539346336313039393136 -65353036353038323764653065373033306638636538356138363364643135303263613564666665 -61316166616230313039656433636232626630653665643963336632366637663163633933373237 -66653733663638313038363366643866633865303839613033323161353030393330316133303130 -30666634633761666438386364663762343332613466316338623634303263386333366266366633 -32663536396539376661363164656537633330636637313833326131643463643434636663346431 -30356333343266616632376264663264393462323736326138643737636264306339356137653436 -38333062393439333631396463363131326665646230616535633731313564626435313832383430 -31633231663536663437396462336231666363646230626533663265616435346366653532323835 -33646131343335303632653631363637656538343032363631303565613738383533363237376233 -64303538303934363137306639666433643338323930656465323533323532383763353938303662 -61376138343032643762326631323164386635613838623539313931623934623363316435653864 -35336539663661663363306164303965333534636663643765363831323537636665623633343639 -39643664653465316334376437653932343934383536353533316338303261326162306338383531 -32303434316362663331613131373833386338633138636563663666373165633134643230303839 -66383033316431623735663833333631393031323363303164363238396539306333363039393737 -38653230303062303437336234353765333636383937613062356338613534653862643561363966 -31363438383530313032316136346264373632356238663033393837366665633433323338333937 -63393937373434663961356661306132386464303632636135383333346439646166353737643132 -66633336343930643266336630383838373436396130343633646530623066623630616634366362 -62326537366365323839633161353238653934353739626565306263316266666336613235656336 -31643533343961363736633865363961386536323935616133313965343739353963383264633065 -61383532636330316134613531326231613132396663333864663866376439306464616162373931 -63336438343463623236626563313230613030366437396162643636383163303465333661663234 -38333832313563373838303565613434393232363030366439376333356638333735343035363138 -30643032616465326166646263326339616237663265373963343438376463383336373637313430 -31376338626164373136386431333633383731373736666439386664336132343136303138646265 -30366235356666393030633735346139663432353837353236623638313266336637373964626266 -37643766333736656664376264336635613038363830383935653331393164383436653938326266 -65623461383462313763326464383466363531636234656536393633623938363330396461613366 -65303363323764613863643763633832313632613538363436393834613466633266343239656164 -31383833396437663135326436343264383963353265643737363336663166303764356566613536 -63376463323637303464313132663539313333306665316538303539623535356335306133613065 -31356438356234336261656131613731633338646165333632323931313334333131623335666331 -65663934393239326563333039393337653032633437303638326463653436373839363662303065 -32653337313235323334376639383336633861653137643833646234393438663561316431616664 -35616331333239636230333166323262396666626139383031326634653230383561376362666463 -35383066666531353237666464333535626165653136316461303966623530666564626130626264 -33333035396536333438366138306463663531333135333530326565383964386533653630646232 -66656662313933313063666164643134386536366630373536613531636332633663363539393761 -36376464653435306665616639346132643634333365656237613439386132616332356434333737 -35303137333366343639343666656665333134383335396333346365656632326534363330396235 -34316130323662633165616162623530623866373134323964643134326663376234343165366265 -34663662303938346132626434646364363835376439633764356335333734663365653637623064 -61373465366464646239653539663266313662643933316465386132616534383333326635653639 -62666363653031316137336431396338333866383433366664326663386533313839393365643039 -62313239653532353439386161646438343732313735646637313533623862366336346664646534 -64333237353137316662616434393339386137666563336236643038316564623136613733613630 -37653763373236623033336363656166316463396230623963343435333465633863373962366138 -65383166653063616435656236653939636435343362343332323866363134613231666537373237 -35353838643535316639363130306266383736386130373965623131636665393666366663323964 -38356338383166376531366265346235346233366632363133376465323666353563646639386131 -37323363353765383163616133653665373965613361336466366431313336303337643131656132 -62646463623731383031656564353934383236366264383131343939633235323265616234656638 -31666232303263623236346531376364616361353635386131653235636566303432353866616163 -32313561386234643533396263393739623366653239336161616238623638333061393165376530 -61323637366636376166326661323262613739653663343930616338343735393030313433353035 -31653233316263633666633132636231653231333833653230643164316130613563333637303333 -34626130373933616437653132616632633663376138616164636362613764646563366437303066 -35336561313666303034623662656361343861363763373236353063623162366336313538653736 -62393933373231393531306334323861613932643362366265306133303432366631383630626461 -30333665643836396162363032613031646234333965366532353862393534386638646138383366 -32653465626566306366393565303663643134396561316163616664383236306430333839646466 -32353031656631333464363038306466366266353439633331336466316362373432353430346430 -36373836333031336334353838303133346461373032336537373432303332616363323464333830 -61633334393630393061633532306365303736343737613733343436636636343237356230386232 -37653333376239646532373564613364366364356435666136366163663531623136376337656537 -30376561633362373134663737616464383932646664383930323939353961646532363365623264 -33366330393430336134373462343334633563373561316132393632623131376363363366326462 -37653764643939336339626164333530396662656332366638306137313236303062396632623539 -62626134636362643231346434393838393632326464303534396332363065363431346236383439 -35633065663737656565303130656434396366323364313832323134383565633866626364393163 -39616337653064353035616666313439616138303866636235646637393965316562386263393833 -38646238343266383561626333356563613831353935303763343037663431636261373038623639 -39376563366635383565646231613961393338393837616631323836346431346163393166373735 -37306432393938363435303332336335393764306233633931373662356536616262 +31303531666133303130366364333335633834613435396332383835646361393965326264313761 +3130333462393633626164343139326463333730663730660a356337376432306236386433663136 +31303461383964663635306232663831333232646163336639393231316633613465616532623032 +3462313231346132370a623139626336646164356436356366653737316635643733616332333265 +30623737623135313333346531386431663139373863666661323330393263343361303565653861 +61363338336666363765663432663233656136316436656636366265616362646130303437326466 +33333336626531396232346663356636643265633238346638623766643639653035306633383237 +61653135663039333736633861636434393866303432643530656139333338383661613464616663 +32646135323661326431373731383339666533326464663636383732356239396430343634393233 +61633231393039336665616239323466383838396538343264303038323437653239313039373666 +38656166386366333836666565343864376361653033356439343365646239333462346336333034 +37316637323839633032313363316431623232313830303764396666643963643663316433653638 +30636365613637663064316138336563393238396364653431383233303064383037386334613230 +32383064363033623661646131636438303664363732663963313438666162646365316365386333 +66373435653065306634653962376366653566363034393832663161636163393032343164616163 +61626162346466333431303134393038646431613335373862323831303461626332376664393633 +65353932643064633132316465626639346365633137653661303031383031373738643965663965 +63646337646638373565363030656134623361653161623830303166623739323736383438656434 +32383936636336386361353734613538663831326666666233323231653238353233333937626266 +36663130653336646165373438353039623061386364643666616365636434306330316664326134 +39396364393531396233626235386331313862663765666564313565663230633536316430366264 +34303439636338643334356134363835356639356365343566346131383065646533633133303135 +38633265633037386566663264646161393165316261653330646631656631613330336639623862 +66383164376232396135373165386663643165323039303066376234636565653534613965303734 +61383964396338326162303633336465323538363365623864303034386238336363653263626664 +38333839303763326466303565386366623337613963383363393638613930353665636135346165 +34623539633239653563326165326636383734663635393030383063666138356564326132343661 +30303161303336396461313962323962336162366336663066663630656438643834653963353264 +61646666613834616439346233663338666137386134323130626336663565356561376464353635 +36333430636461333130353762363835373631346362366637306135656564656639393337383863 +65303763386263363661353337666166396334393034353364383336393261356562333733353861 +64393531653961326335363663663137346239393436633137376163616537633864643364356362 +39376662633039316632336630373432643235326336313433376639663966353233643335333061 +66333335356232643566613963303930656135326230666562333365383338656334366135396135 +31316634313663653939353134383735303438306361386433333862383261353037316439323135 +30323963303064663665346632393532343739373530633536653133346437343763656665613131 +37623162386434353433376533653036373332636265613737386465333036623263376361376134 +34623230376666646538303936373837613766613563346238353663616435643930613130316439 +38346331346630323234653762313763666364663433343938636562306261333566313863353261 +64326338373636353231643665343039313962343039613635633137666230336231323631343339 +66643362326266626565306439646632623231343137323838316330343432383538303237623232 +64636334653161343363373938393864333437373430393533366263363761306562376561393137 +39353166363230626139333566663161386138343835616436366664336537623661623930666463 +34323235613334363964346431333563656631663239663563356161383430616262643730366136 +64663031326639386634306361643536373635316266383263633264383237326664373865646230 +30343739626463636135343639363230643037613166393130626539303037616264373134393763 +37346466376438323234643162333739353831383137386238633132613434353730663430623035 +65343639663365336631303236356361363533376564613335666534393535646637636361323435 +62373039623338306166646465623963656334363563666134336630613531353365326662623064 +39373330333164643561653133613731396466323335346362663338333937343034386533333965 +61343532346232386263623533613432343231383838636130613137323061383465356131326461 +31383534663663626433316331396139333365643630336135376536356564383131653836373238 +36363334643239656331323533626266363130663237636463366364333634366134666135666363 +31363965323335346263333532373966386336653730663334356437636438323132303263393463 +33363562306433326331346235626234353064633334373861363962396162393134623235343535 +39633137323632346533353366633263356534323132333035343035663631306235633433343030 +35643565393263613562333637306362376430616236366361343466353163666461333839393561 +39326538656662663836633933393739366633323164383838633961626638616337383531306131 +33623734353836636235343663616665323039343637323132386464613763313862306531353736 +35303261393331333665626234373036336132366364393837326561313039656430653137346361 +63643364366565303566373931343063623338393432333039666531633537343033663661616534 +34333766653431366639306433306136316461363562306535616132616339663563323061316536 +35356338336363633435663538663832613238306139316163663262616339306633353363633763 +62643731306535303763323439333133346362623234376634623666663734636232323032306139 +39386464306338393339353831623037353034633134656465386332316334636162623639643634 +64633165643238623466353262663863373562613363363131373934623833663865633862373939 +37313131343562383530303933663033336463666133623739633266373339313634396634393665 +32396165316339616436396633343161333537666235343834633861393139343433396437383130 +37373961646166633631303238306463663536663663333661343239376565353030343437663730 +31396239306236356632646464346465373635383466623631373265643734383834356437656361 +34323838323964303563653133646333646133666164386464396362363566333139316566343835 +63626661333538343430346231376362393063333736653933356539623434613462663461373563 +64363062613037393930383562616230346631303966623466663130346230303537333964323238 +63316264306439313564656464633037376639363839393262613236393564626134353034633235 +64343837393464373631636561333636653735623832393236353135396231643632353233386536 +31656637366337633530623831383737626431363763346139393136636361663135326439366135 +33326337373661633861613466633165383437633830336364356666623738333135646536383438 +66336630663937326534306336386137356464663764326634646438356530623035626430663335 +35323338636232393330623066336162353566386432363737613239623731613038646438376339 +33353565656638636233316632626436646261323963396534323430303433663466646163643330 +63353666356263356539393833306231396335323837633262666434616165393038313164636339 +35346134306538313133376133373535373335656364623734333131316334386633346338303464 +38346337333631373663353732626163386638383437656539303264343563303561663363393463 +37653838666530336433356561316337313166613333353731626632613937633262663331633332 +63323761383533646238616662376138363132653030346162613164393231386663646130343265 +34633134613638356139333764666362636461313030366637326661623834303436653430353365 +65663766383438386538626233363430663230346633363563633130613736326631333239366334 +31646630663338316162333232353761646238643166656134323361313432353433653837326134 +63366265343936653864353433366530326633393366383061333836323332333133623866646534 +37616663633932306136336238353864326364643331373234353666656561336631313662326563 +32623334316335383161376334356331383936636137316137616465373838323964366565646561 +63633133646464303232623530333666323664386537356164346436396635396464303034313761 +66366234343436643930643039353262623866303830626530343664663462356339346233396239 +33613236303737383237623735386137383432386465636635626464313331666162653263356361 +31623639376437366530346534323939363739656563393563306532383064373566393333383730 +33666561663566383835316438383762643932316232363536383866383863366666663437623264 +39623262303938613637656266633632653462336138643130626366316336636331623464373338 +31363336343335646435316532333064633765306430666230376465613462346435623734393030 +34323836383061333736633933666532626636363034356232366335326263646335626635646433 +65373934343731663036633238373838616437656134393665663136363634323061383032323936 +66663133356561306535626131623730306266663565386663636364613064623963383838353533 +31383962626236373964363561386331376230386332333233366136396166666230636230383737 +32633530633264623864303430326561653563366164646436653061633839386165613765396433 +65653435363766386466656332653764393966613832396462356331396464336239373533633438 +62363431666533323639663434306165663966376538373535326562393331373137643530623435 +33393064346439376333666663396262653439646363643035396634383533666432313638306431 +34376531666334396634356139343534393231313032393232373866643365626461636165303934 +62333338326431383262363466306264343466346366643231616238323537636139393663386538 +31396465353633383134333432353332356330333138636533356335303165393834393832393636 +39336262613763323332616638396530663835666234613634303931616532303433366262353332 +36653735303165613263633738623839376566336437353137316264623439343031323637636538 +37383763303930383138636663363535616230666535613362366533663931353033623532306633 +38333961373335613030616333393139316235363662636137333635623063663765326165303363 +62373064356563353236376337656438663266666639323861323065643537626366653634393638 +63353265616165336237303934323033656561663131656362663463613762323032356431663739 +66363861393864386138643166316133613635393833386364666137623437303062626130646139 +37633135626363626436333365393762643866643863383765323962663534386564353264303834 +66353661343037646535623763386666393562666335373661326435353330393736613933663639 +64363065373563663337373163643730366538653766353431363630633163613035666163633837 +63643835356265616663663833333039663436333966386436643733366336353431643937323763 +31626363363733316663623433303733653930343662343364363631386138393063393033346338 +37383039613739613439366339663366363038396466343666616163386461613731343639663334 +63373864633662356261656265386232613438383733353632323030336535623765353965653330 +65373938643935613662653036646337636461373530663430383963363136613736373839643362 +31313665623537356262336432353966303634363039363965656435323139323330613735623965 +35373965346132333735336366666137383862653239623363656131343831373061373064613230 +35353564396233313337343063656366343162356633366630663261313238643266333061326265 +65353637613361613933386530363132386165333063303330396231393866313864343564363636 +35633832343636663861346230316262623361656337323065613663303765633237383565643131 +63323632353131353338653533623266663232343561626234313439663532373239633366653936 +32396233366639303839316265313738366337373061353737343733663165623538633361303961 +38336366653132656562643231313933633362623061396665356130643339336466326363643162 +30343836303364616266373464653135333261346234313863623336333666306666613739656362 +31396633626535373838656161643565386139313230393365643534633264633131323563653931 +34306632383466653435663837646538373762653837653539633039633766613435616134303234 +30366137643039373739666235343662653962366231656336353939373837666131353330636231 +33613436653835303431323437333362313363633834313337666634366463643933383934636565 +32303635396162313366653234663562366235613531613362343631396236336237393235323766 +34393066626634373163396232623131346231633562316431633331346264353963353430623134 +37636438343338666365373166373563316665373338623630613335303831393435323036663965 +31643036383738393863326631663632393366643763383539303336626330636435333833666633 +34636533613566303864643636303539363264663031643032333361663934353062323034623664 +33393664616432343733393861633431343732396238636530303135393830633265306337306337 +62376635326532333736326366383639633163626163363066303530353238373662323338633432 +63663337323535613838616236373561646262636563376632643962353466383763353337343037 +35626464346561343565396463386266616562646130623266646635386461303365643136363566 +39663737656165323730303164343431353932313638343033356262636435343061366166656638 +32376165346330353334613565643265376266353664366235666462396164353265393934633635 +63376633623066396464396464346666383765346530663638656436333730383737333433613465 +66623934346135643266356136316662366239336139366631393663323835396462386335613536 +34366638393164306561656663306263656534316130333064333963313836613163386263363538 +61383262306139346136383834333365353934313865346336346530613732636463333935366538 +32373461393039616561663933383835316539613061643863663762323130303662386363336336 +61313131623437303864373739303330363438616137323739313962623163363531656638363436 +36623564373831653037343933363166636661303736343933373239626530323862633561643365 +37336463333036363266653138393263623365616336306331623361373831616138323630623933 +61386662656163363165643439653864653765646262666332666636656464313834303634323736 +38306537643733316139383664326532653531663036616634306332336462623130616364616434 +35653239653466303031653533313338343162363665383361353766396335376237376334303435 +61323434653066363361306566653036363731393935373236303061626163323432633237633364 +37346532346162333762376439326466316233376265653632333431316339313230643834613431 +32383534653762373063323536623436633839623937386465313937383665363931306132343461 +34333933393936393537303633656662633263393635633035383261393563653432363634333861 +37336364326431653430363063633063306332386161313632323361323231396638386336363965 +64646437653266613065373662353130373134383236313064616630343934643038353161306133 +35393232303661363431633937366639303965636434646361366634363130303034336463383834 +30653865343766363563306331356664383431383932616362326234333032316439343665326439 +65336561616134336133363366363466633639353539383633386537373761623434363338643163 +30316465323436306636656135396563306538656634646330326666663237633737353233383562 +33336533383537396631333465343737633336353638636462333534343330356639343763656534 +62383163396135306630353839613631396235383061363639313135346333383265383561396132 +30376535303033353661303838663664623364306564383834306462386661343331636130373533 +65333933356264653361303434376433653866653562313630623733616630336531613637376232 +3265376534643634616634653437663435303533343630346433 diff --git a/ansible/roles/monitoring/files/dashboards/Security/security.json b/ansible/roles/monitoring/files/dashboards/Security/security.json index a444b4b..3e7fbe3 100644 --- a/ansible/roles/monitoring/files/dashboards/Security/security.json +++ b/ansible/roles/monitoring/files/dashboards/Security/security.json @@ -102,8 +102,8 @@ }, { "type": "stat", - "title": "VPC devices", - "description": "Addresses answering ping on the private network, not in security_vpc_hosts", + "title": "VPC devices, servers", + "description": "Addresses answering ping on the private network that are not in security_vpc_hosts, plus servers in the Hetzner project that are not in monitoring_hcloud_servers", "datasource": { "type": "prometheus", "uid": "prometheus" @@ -114,7 +114,7 @@ "type": "prometheus", "uid": "prometheus" }, - "expr": "count(group by (ip) (security_vpc_host_info{known=\"false\"})) or vector(0)", + "expr": "(count(group by (ip) (security_vpc_host_info{known=\"false\"})) or vector(0)) + (count(up{job=\"hcloud\",known=\"false\"}) or vector(0))", "refId": "A", "instant": true, "range": false @@ -885,6 +885,117 @@ }, "id": 13 }, + { + "type": "table", + "title": "Hetzner project servers", + "description": "Servers the Hetzner API lists for the project, refreshed every minute. Catches a server that drops ping or is not attached to the VPC.", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "group by (server, type, status, public_ip, private_ip, known) (up{job=\"hcloud\"})", + "refId": "A", + "instant": true, + "range": false, + "format": "table" + } + ], + "gridPos": { + "h": 4, + "w": 24, + "x": 0, + "y": 14 + }, + "fieldConfig": { + "defaults": { + "custom": { + "filterable": true + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "known" + }, + "properties": [ + { + "id": "mappings", + "value": [ + { + "type": "value", + "options": { + "true": { + "text": "yes", + "color": "green" + }, + "false": { + "text": "NO", + "color": "red" + } + } + } + ] + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-background" + } + }, + { + "id": "custom.width", + "value": 80 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Value" + }, + "properties": [ + { + "id": "custom.hidden", + "value": true + } + ] + } + ] + }, + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "instance": true, + "job": true + }, + "indexByName": { + "server": 0, + "type": 1, + "status": 2, + "public_ip": 3, + "private_ip": 4, + "known": 5 + } + } + } + ], + "options": { + "showHeader": true, + "cellHeight": "sm" + }, + "id": 31 + }, { "type": "table", "title": "Listening ports", @@ -910,7 +1021,7 @@ "h": 9, "w": 24, "x": 0, - "y": 14 + "y": 18 }, "fieldConfig": { "defaults": { @@ -1005,7 +1116,7 @@ "h": 1, "w": 24, "x": 0, - "y": 23 + "y": 27 }, "panels": [], "id": 15 @@ -1035,7 +1146,7 @@ "h": 8, "w": 8, "x": 0, - "y": 24 + "y": 28 }, "fieldConfig": { "defaults": { @@ -1145,7 +1256,7 @@ "h": 8, "w": 6, "x": 8, - "y": 24 + "y": 28 }, "fieldConfig": { "defaults": { @@ -1254,7 +1365,7 @@ "h": 8, "w": 10, "x": 14, - "y": 24 + "y": 28 }, "fieldConfig": { "defaults": { @@ -1363,7 +1474,7 @@ "h": 7, "w": 8, "x": 0, - "y": 32 + "y": 36 }, "fieldConfig": { "defaults": { @@ -1488,7 +1599,7 @@ "h": 7, "w": 6, "x": 8, - "y": 32 + "y": 36 }, "fieldConfig": { "defaults": { @@ -1597,7 +1708,7 @@ "h": 7, "w": 10, "x": 14, - "y": 32 + "y": 36 }, "fieldConfig": { "defaults": { @@ -1689,7 +1800,7 @@ "h": 1, "w": 24, "x": 0, - "y": 39 + "y": 43 }, "panels": [], "id": 22 @@ -1718,7 +1829,7 @@ "h": 7, "w": 12, "x": 0, - "y": 40 + "y": 44 }, "fieldConfig": { "defaults": { @@ -1772,7 +1883,7 @@ "h": 7, "w": 12, "x": 12, - "y": 40 + "y": 44 }, "fieldConfig": { "defaults": { @@ -1825,7 +1936,7 @@ "h": 9, "w": 12, "x": 0, - "y": 47 + "y": 51 }, "options": { "showTime": true, @@ -1859,7 +1970,7 @@ "h": 9, "w": 12, "x": 12, - "y": 47 + "y": 51 }, "options": { "showTime": true, @@ -1878,7 +1989,7 @@ "h": 1, "w": 24, "x": 0, - "y": 56 + "y": 60 }, "panels": [], "id": 27 @@ -1908,7 +2019,7 @@ "h": 7, "w": 8, "x": 0, - "y": 57 + "y": 61 }, "fieldConfig": { "defaults": { @@ -1979,7 +2090,7 @@ "h": 7, "w": 16, "x": 8, - "y": 57 + "y": 61 }, "fieldConfig": { "defaults": { @@ -2042,7 +2153,7 @@ "h": 8, "w": 24, "x": 0, - "y": 64 + "y": 68 }, "options": { "showTime": true, @@ -2054,4 +2165,4 @@ "id": 30 } ] -} \ No newline at end of file +} diff --git a/ansible/roles/monitoring/templates/alert-rules.yaml.j2 b/ansible/roles/monitoring/templates/alert-rules.yaml.j2 index 7503382..f55e790 100644 --- a/ansible/roles/monitoring/templates/alert-rules.yaml.j2 +++ b/ansible/roles/monitoring/templates/alert-rules.yaml.j2 @@ -255,6 +255,38 @@ groups: for: 2m labels: { severity: critical } annotations: { summary: "{{ $labels.ip }} answers on the VPC (seen from {{ $labels.host }}) and is not in security_vpc_hosts" } + - uid: sec-hcloud-server-unknown + title: "Unknown server in the Hetzner project" + condition: C + data: + - refId: A + relativeTimeRange: { from: 900, to: 0 } + datasourceUid: prometheus + model: { refId: A, expr: "up{job=\"hcloud\",known=\"false\"}", instant: true, intervalMs: 30000, maxDataPoints: 43200 } + - refId: C + datasourceUid: __expr__ + model: { refId: C, type: threshold, expression: A, conditions: [ { evaluator: { type: gt, params: [0] } } ] } + noDataState: OK + execErrState: Error + for: 2m + labels: { severity: critical } + annotations: { summary: "Server {{ $labels.server }} ({{ $labels.type }}, {{ $labels.public_ip }}, private {{ $labels.private_ip }}) exists in the Hetzner project and is not in monitoring_hcloud_servers" } + - uid: sec-hcloud-inventory-stale + title: "Hetzner server list not updating" + condition: C + data: + - refId: A + relativeTimeRange: { from: 900, to: 0 } + datasourceUid: prometheus + model: { refId: A, expr: "absent(up{job=\"hcloud\"}) or increase(prometheus_sd_refresh_failures_total{mechanism=\"hetzner\"}[30m]) > 3", instant: true, intervalMs: 30000, maxDataPoints: 43200 } + - refId: C + datasourceUid: __expr__ + model: { refId: C, type: threshold, expression: A, conditions: [ { evaluator: { type: gt, params: [0] } } ] } + noDataState: OK + execErrState: Error + for: 10m + labels: { severity: critical } + annotations: { summary: "Prometheus cannot list the servers of the Hetzner project (token revoked or API unreachable): new servers go unnoticed" } - uid: sec-user-unknown title: "Unknown login account" condition: C diff --git a/ansible/roles/monitoring/templates/prometheus.yml.j2 b/ansible/roles/monitoring/templates/prometheus.yml.j2 index 0b655c7..2e0071a 100644 --- a/ansible/roles/monitoring/templates/prometheus.yml.j2 +++ b/ansible/roles/monitoring/templates/prometheus.yml.j2 @@ -54,6 +54,40 @@ scrape_configs: - targets: ["localhost:9090", "loki:3100", "grafana:3000", "blackbox:9115"] labels: { host: asxpio-ops } + # Servers in the Hetzner project, from the API (read-only token). Nothing + # is scraped from them: every target is Prometheus itself with all + # samples dropped, which leaves one `up` series per server. + - job_name: hcloud + scrape_interval: 60s + hetzner_sd_configs: + - role: hcloud + authorization: + credentials: "{{ monitoring_hcloud_token }}" + relabel_configs: + - source_labels: [__meta_hetzner_server_name] + target_label: server + - source_labels: [__meta_hetzner_server_name] + target_label: instance + - source_labels: [__meta_hetzner_public_ipv4] + target_label: public_ip + - regex: __meta_hetzner_hcloud_private_ipv4_.+ + action: labelmap + replacement: private_ip + - source_labels: [__meta_hetzner_hcloud_server_type] + target_label: type + - source_labels: [__meta_hetzner_server_status] + target_label: status + - target_label: known + replacement: "false" + - source_labels: [__meta_hetzner_server_name] + regex: '{{ monitoring_hcloud_servers | map("regex_escape") | join("|") }}' + target_label: known + replacement: "true" + - target_label: __address__ + replacement: localhost:9090 + metric_relabel_configs: + - action: drop + {% for module in monitoring_probes | map(attribute='module') | unique %} - job_name: probe_{{ module }} metrics_path: /probe