├── .gitignore ├── COPYING ├── README.md ├── docker-compose.yml ├── img └── monitoring.png ├── monitoring ├── alertmanager │ └── config.yml ├── grafana │ └── provisioning │ │ ├── dashboards │ │ ├── dashboard.yml │ │ ├── docker_containers.json │ │ ├── docker_host.json │ │ ├── liquidsoap.json │ │ └── monitor_services.json │ │ └── datasources │ │ └── datasource.yml └── prometheus │ ├── alert.rules │ └── prometheus.yml ├── nginxhls ├── Dockerfile ├── nginx.conf └── stream.conf ├── radio.py └── radio └── live.liq /.gitignore: -------------------------------------------------------------------------------- 1 | *.m3u8 2 | *.ts 3 | *.config -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # srt2hls 2 | 3 | Simple audio HLS streaming server. 4 | 5 | ## Intro 6 | 7 | The goal of this program is to receive an audio stream with [SRT](https://github.com/Haivision/srt) and broadcast it with HLS. It can serve as a CDN origin server or as a set-and-forget streaming server. 8 | 9 | ## How it works 10 | 11 | srt2hls use [Liquidsoap](https://www.liquidsoap.info) to receive a stream and encode it in HLS, then it use [nginx] (https://www.nginx.com/) to serve HLS content. 12 | 13 | The Liquidsoap container, by default, run radio/live.liq script. It's a fully functionnal example that will : 14 | 1. Receive 2 SRT inputs on ports 10000 and 10001 15 | 2. Create a production stream with basic logic between the 2 inputs 16 | 3. Encode the stream in aac with 3 quality 17 | 4. Segment it in HLS format in /hls directory 18 | 19 | The Nginx container come with a specific configuration to serve HLS content with proper Content-Type, CORS and Cache-Control headers. It need read only access to /hls directory to serve HLS segments and playlists. 20 | 21 | ## Setup 22 | ### With docker compose 23 | ```bash 24 | mkdir hls 25 | sudo chown -R 10000:10001 hls 26 | sudo docker-compose up 27 | ``` 28 | 29 | ### Local installation requirements 30 | 31 | - [Liquidsoap](https://www.liquidsoap.info) 2.0.0+ 32 | - ffmpeg 33 | 34 | ## Basic usage 35 | 36 | ### Listening 37 | By default the encoder send blank HLS segments, that mean if it's started, you can already listen the blank stream. 38 | 39 | ```bash 40 | ffplay http://localhost:8080/live.m3u8 41 | vlc http://localhost:8080/live.m3u8 42 | ``` 43 | 44 | ### Switch live source 45 | 46 | The default script allow to switch the output between inputs. 47 | 48 | ```bash 49 | # Check available input to switch to 50 | curl http://localhost:8080/api/list?livesource 51 | # Switch the livesource 52 | curl http://localhost:8080/api/set?livesource=srt2 53 | curl http://localhost:8080/api/set?livesource=srt1 54 | # check the current live source 55 | curl http://localhost:8080/api/get?livesource 56 | ``` 57 | 58 | ### Sending audio to the streaming server 59 | 60 | #### Using ffmpeg 61 | Requirement : ffmpeg compiled with srt support (https://johnvansickle.com/ffmpeg/ for example) 62 | 63 | ```bash 64 | # live stream or static file 65 | ffmpeg -re -i $AUDIOFILE -vn -f wav -codec:a pcm_s16le srt://127.0.0.1:10000 66 | ``` 67 | 68 | ### Monitoring 69 | 70 | #### Grafana 71 | http://localhost:3000/ 72 | 73 | ![Alt text](img/monitoring.png?raw=true "Liquidsoap Dashboard in Grafana") 74 | #### Prometheus 75 | http://localhost:9090/ 76 | 77 | ## Development 78 | 79 | ### Build images 80 | ```bash 81 | sudo docker-compose build 82 | ``` 83 | 84 | ## Thanks 85 | 86 | Folks of [Liquidsoap](https://www.liquidsoap.info) 87 | 88 | Monitoring stack is mostly inspired by https://github.com/stefanprodan/dockprom 89 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.0" 2 | 3 | services: 4 | liquidsoap: 5 | image: savonet/liquidsoap:v2.0.0 6 | container_name: liquidsoap 7 | command: /radio/live.liq 8 | restart: unless-stopped 9 | networks: 10 | - default 11 | expose: 12 | - "8500" 13 | - "8081" 14 | - "9090" 15 | ports: 16 | - 10000:10000/udp 17 | - 10001:10001/udp 18 | - 8500:8500/tcp 19 | volumes: 20 | - ./radio:/radio 21 | - ./hls:/hls 22 | nginx: 23 | build: 24 | context: nginxhls 25 | image: privyplace/nginxhls:v1 26 | container_name: nginx 27 | restart: unless-stopped 28 | networks: 29 | - default 30 | expose: 31 | - "80" 32 | ports: 33 | - 8080:80/tcp 34 | volumes: 35 | - ./hls:/hls 36 | - ./nginxhls/stream.conf:/etc/nginx/conf.d/stream.conf 37 | prometheus: 38 | image: prom/prometheus:v2.23.0 39 | container_name: prometheus 40 | volumes: 41 | - ./monitoring/prometheus/:/etc/prometheus/ 42 | - prometheus_data:/prometheus 43 | command: 44 | - '--config.file=/etc/prometheus/prometheus.yml' 45 | - '--storage.tsdb.path=/prometheus' 46 | - '--web.console.libraries=/etc/prometheus/console_libraries' 47 | - '--web.console.templates=/etc/prometheus/consoles' 48 | - '--storage.tsdb.retention.time=200h' 49 | - '--web.enable-lifecycle' 50 | - '--log.level=warn' 51 | restart: unless-stopped 52 | ports: 53 | - 9090:9090/tcp 54 | networks: 55 | - default 56 | labels: 57 | org.label-schema.group: "monitoring" 58 | alertmanager: 59 | image: prom/alertmanager:v0.21.0 60 | container_name: alertmanager 61 | volumes: 62 | - ./monitoring/alertmanager:/etc/alertmanager 63 | command: 64 | - '--config.file=/etc/alertmanager/config.yml' 65 | - '--storage.path=/alertmanager' 66 | - '--log.level=warn' 67 | restart: unless-stopped 68 | expose: 69 | - 9093 70 | networks: 71 | - default 72 | labels: 73 | org.label-schema.group: "monitoring" 74 | grafana: 75 | image: grafana/grafana:7.3.5 76 | container_name: grafana 77 | volumes: 78 | - grafana_data:/var/lib/grafana 79 | - ./monitoring/grafana/provisioning:/etc/grafana/provisioning 80 | environment: 81 | - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin} 82 | - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} 83 | - GF_USERS_ALLOW_SIGN_UP=false 84 | - GF_LOG_LEVEL=warn 85 | restart: unless-stopped 86 | ports: 87 | - 3000:3000/tcp 88 | networks: 89 | - default 90 | labels: 91 | org.label-schema.group: "monitoring" 92 | cadvisor: 93 | image: gcr.io/cadvisor/cadvisor:v0.37.0 94 | container_name: cadvisor 95 | privileged: true 96 | volumes: 97 | - /:/rootfs:ro 98 | - /var/run:/var/run:rw 99 | - /sys:/sys:ro 100 | - /var/lib/docker:/var/lib/docker:ro 101 | - /cgroup:/cgroup:ro 102 | restart: unless-stopped 103 | expose: 104 | - 8080 105 | networks: 106 | - default 107 | labels: 108 | org.label-schema.group: "monitoring" 109 | nodeexporter: 110 | image: prom/node-exporter:v1.0.1 111 | container_name: nodeexporter 112 | volumes: 113 | - /proc:/host/proc:ro 114 | - /sys:/host/sys:ro 115 | - /:/rootfs:ro 116 | command: 117 | - '--path.procfs=/host/proc' 118 | - '--path.rootfs=/rootfs' 119 | - '--path.sysfs=/host/sys' 120 | - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)' 121 | - '--no-collector.powersupplyclass' 122 | - '--log.level=warn' 123 | restart: unless-stopped 124 | expose: 125 | - 9100 126 | networks: 127 | - default 128 | labels: 129 | org.label-schema.group: "monitoring" 130 | 131 | volumes: 132 | prometheus_data: {} 133 | grafana_data: {} 134 | 135 | networks: 136 | default: 137 | -------------------------------------------------------------------------------- /img/monitoring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbugeia/srt2hls/fe87a0f8fa2df46f08d2d5ca1c16c7797a408c34/img/monitoring.png -------------------------------------------------------------------------------- /monitoring/alertmanager/config.yml: -------------------------------------------------------------------------------- 1 | route: 2 | receiver: 'nullreceiver' 3 | 4 | receivers: 5 | - name: nullreceiver -------------------------------------------------------------------------------- /monitoring/grafana/provisioning/dashboards/dashboard.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'Prometheus' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: false 9 | editable: true 10 | allowUiUpdates: true 11 | options: 12 | path: /etc/grafana/provisioning/dashboards -------------------------------------------------------------------------------- /monitoring/grafana/provisioning/dashboards/docker_containers.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": null, 3 | "title": "Docker Containers", 4 | "description": "Containers metrics", 5 | "tags": [ 6 | "docker" 7 | ], 8 | "style": "dark", 9 | "timezone": "browser", 10 | "editable": true, 11 | "hideControls": false, 12 | "sharedCrosshair": true, 13 | "rows": [ 14 | { 15 | "collapse": false, 16 | "editable": true, 17 | "height": "150px", 18 | "panels": [ 19 | { 20 | "cacheTimeout": null, 21 | "colorBackground": false, 22 | "colorValue": false, 23 | "colors": [ 24 | "rgba(50, 172, 45, 0.97)", 25 | "rgba(237, 129, 40, 0.89)", 26 | "rgba(245, 54, 54, 0.9)" 27 | ], 28 | "datasource": "Prometheus", 29 | "decimals": 2, 30 | "editable": true, 31 | "error": false, 32 | "format": "percent", 33 | "gauge": { 34 | "maxValue": 100, 35 | "minValue": 0, 36 | "show": true, 37 | "thresholdLabels": false, 38 | "thresholdMarkers": true 39 | }, 40 | "id": 4, 41 | "interval": null, 42 | "isNew": true, 43 | "links": [], 44 | "mappingType": 1, 45 | "mappingTypes": [ 46 | { 47 | "name": "value to text", 48 | "value": 1 49 | }, 50 | { 51 | "name": "range to text", 52 | "value": 2 53 | } 54 | ], 55 | "maxDataPoints": 100, 56 | "nullPointMode": "connected", 57 | "nullText": null, 58 | "postfix": "", 59 | "postfixFontSize": "50%", 60 | "prefix": "", 61 | "prefixFontSize": "50%", 62 | "rangeMaps": [ 63 | { 64 | "from": "null", 65 | "text": "N/A", 66 | "to": "null" 67 | } 68 | ], 69 | "span": 2, 70 | "sparkline": { 71 | "fillColor": "rgba(31, 118, 189, 0.18)", 72 | "full": false, 73 | "lineColor": "rgb(31, 120, 193)", 74 | "show": false 75 | }, 76 | "targets": [ 77 | { 78 | "expr": "sum(rate(container_cpu_user_seconds_total{image!=\"\"}[1m])) / count(node_cpu_seconds_total{mode=\"user\"}) * 100", 79 | "interval": "10s", 80 | "intervalFactor": 1, 81 | "legendFormat": "", 82 | "refId": "A", 83 | "step": 10 84 | } 85 | ], 86 | "thresholds": "65, 90", 87 | "title": "CPU Load", 88 | "transparent": false, 89 | "type": "singlestat", 90 | "valueFontSize": "80%", 91 | "valueMaps": [ 92 | { 93 | "op": "=", 94 | "text": "N/A", 95 | "value": "null" 96 | } 97 | ], 98 | "valueName": "avg", 99 | "timeFrom": "10s", 100 | "hideTimeOverride": true 101 | }, 102 | { 103 | "cacheTimeout": null, 104 | "colorBackground": false, 105 | "colorValue": false, 106 | "colors": [ 107 | "rgba(245, 54, 54, 0.9)", 108 | "rgba(237, 129, 40, 0.89)", 109 | "rgba(50, 172, 45, 0.97)" 110 | ], 111 | "datasource": "Prometheus", 112 | "editable": true, 113 | "error": false, 114 | "format": "none", 115 | "gauge": { 116 | "maxValue": 100, 117 | "minValue": 0, 118 | "show": false, 119 | "thresholdLabels": false, 120 | "thresholdMarkers": true 121 | }, 122 | "id": 7, 123 | "interval": null, 124 | "isNew": true, 125 | "links": [], 126 | "mappingType": 1, 127 | "mappingTypes": [ 128 | { 129 | "name": "value to text", 130 | "value": 1 131 | }, 132 | { 133 | "name": "range to text", 134 | "value": 2 135 | } 136 | ], 137 | "maxDataPoints": 100, 138 | "nullPointMode": "connected", 139 | "nullText": null, 140 | "postfix": "", 141 | "postfixFontSize": "50%", 142 | "prefix": "", 143 | "prefixFontSize": "50%", 144 | "rangeMaps": [ 145 | { 146 | "from": "null", 147 | "text": "N/A", 148 | "to": "null" 149 | } 150 | ], 151 | "span": 2, 152 | "sparkline": { 153 | "fillColor": "rgba(31, 118, 189, 0.18)", 154 | "full": false, 155 | "lineColor": "rgb(31, 120, 193)", 156 | "show": false 157 | }, 158 | "targets": [ 159 | { 160 | "expr": "machine_cpu_cores", 161 | "interval": "", 162 | "intervalFactor": 2, 163 | "legendFormat": "", 164 | "metric": "machine_cpu_cores", 165 | "refId": "A", 166 | "step": 20 167 | } 168 | ], 169 | "thresholds": "", 170 | "title": "CPU Cores", 171 | "type": "singlestat", 172 | "valueFontSize": "80%", 173 | "valueMaps": [ 174 | { 175 | "op": "=", 176 | "text": "N/A", 177 | "value": "null" 178 | } 179 | ], 180 | "valueName": "avg" 181 | }, 182 | { 183 | "cacheTimeout": null, 184 | "colorBackground": false, 185 | "colorValue": false, 186 | "colors": [ 187 | "rgba(50, 172, 45, 0.97)", 188 | "rgba(237, 129, 40, 0.89)", 189 | "rgba(245, 54, 54, 0.9)" 190 | ], 191 | "datasource": "Prometheus", 192 | "editable": true, 193 | "error": false, 194 | "format": "percent", 195 | "gauge": { 196 | "maxValue": 100, 197 | "minValue": 0, 198 | "show": true, 199 | "thresholdLabels": false, 200 | "thresholdMarkers": true 201 | }, 202 | "id": 5, 203 | "interval": null, 204 | "isNew": true, 205 | "links": [], 206 | "mappingType": 1, 207 | "mappingTypes": [ 208 | { 209 | "name": "value to text", 210 | "value": 1 211 | }, 212 | { 213 | "name": "range to text", 214 | "value": 2 215 | } 216 | ], 217 | "maxDataPoints": 100, 218 | "nullPointMode": "connected", 219 | "nullText": null, 220 | "postfix": "", 221 | "postfixFontSize": "50%", 222 | "prefix": "", 223 | "prefixFontSize": "50%", 224 | "rangeMaps": [ 225 | { 226 | "from": "null", 227 | "text": "N/A", 228 | "to": "null" 229 | } 230 | ], 231 | "span": 2, 232 | "sparkline": { 233 | "fillColor": "rgba(31, 118, 189, 0.18)", 234 | "full": false, 235 | "lineColor": "rgb(31, 120, 193)", 236 | "show": false 237 | }, 238 | "targets": [ 239 | { 240 | "expr": "(sum(node_memory_MemTotal_bytes) - sum(node_memory_MemFree_bytes+node_memory_Buffers_bytes+node_memory_Cached_bytes) ) / sum(node_memory_MemTotal_bytes) * 100", 241 | "interval": "10s", 242 | "intervalFactor": 2, 243 | "legendFormat": "", 244 | "refId": "A", 245 | "step": 20 246 | } 247 | ], 248 | "thresholds": "65, 90", 249 | "title": "Memory Load", 250 | "transparent": false, 251 | "type": "singlestat", 252 | "valueFontSize": "80%", 253 | "valueMaps": [ 254 | { 255 | "op": "=", 256 | "text": "N/A", 257 | "value": "null" 258 | } 259 | ], 260 | "valueName": "avg", 261 | "timeFrom": "10s", 262 | "hideTimeOverride": true 263 | }, 264 | { 265 | "cacheTimeout": null, 266 | "colorBackground": false, 267 | "colorValue": false, 268 | "colors": [ 269 | "rgba(245, 54, 54, 0.9)", 270 | "rgba(237, 129, 40, 0.89)", 271 | "rgba(50, 172, 45, 0.97)" 272 | ], 273 | "datasource": "Prometheus", 274 | "decimals": 2, 275 | "editable": true, 276 | "error": false, 277 | "format": "bytes", 278 | "gauge": { 279 | "maxValue": 100, 280 | "minValue": 0, 281 | "show": false, 282 | "thresholdLabels": false, 283 | "thresholdMarkers": true 284 | }, 285 | "id": 2, 286 | "interval": null, 287 | "isNew": true, 288 | "links": [], 289 | "mappingType": 1, 290 | "mappingTypes": [ 291 | { 292 | "name": "value to text", 293 | "value": 1 294 | }, 295 | { 296 | "name": "range to text", 297 | "value": 2 298 | } 299 | ], 300 | "maxDataPoints": 100, 301 | "nullPointMode": "connected", 302 | "nullText": null, 303 | "postfix": "", 304 | "postfixFontSize": "50%", 305 | "prefix": "", 306 | "prefixFontSize": "50%", 307 | "rangeMaps": [ 308 | { 309 | "from": "null", 310 | "text": "N/A", 311 | "to": "null" 312 | } 313 | ], 314 | "span": 2, 315 | "sparkline": { 316 | "fillColor": "rgba(31, 118, 189, 0.18)", 317 | "full": false, 318 | "lineColor": "rgb(31, 120, 193)", 319 | "show": false 320 | }, 321 | "targets": [ 322 | { 323 | "expr": "sum(container_memory_usage_bytes{image!=\"\"})", 324 | "interval": "10s", 325 | "intervalFactor": 2, 326 | "legendFormat": "", 327 | "refId": "A", 328 | "step": 20 329 | } 330 | ], 331 | "thresholds": "", 332 | "timeFrom": "10s", 333 | "title": "Used Memory", 334 | "transparent": false, 335 | "type": "singlestat", 336 | "valueFontSize": "80%", 337 | "valueMaps": [ 338 | { 339 | "op": "=", 340 | "text": "N/A", 341 | "value": "null" 342 | } 343 | ], 344 | "valueName": "avg", 345 | "hideTimeOverride": true 346 | }, 347 | { 348 | "cacheTimeout": null, 349 | "colorBackground": false, 350 | "colorValue": false, 351 | "colors": [ 352 | "rgba(50, 172, 45, 0.97)", 353 | "rgba(237, 129, 40, 0.89)", 354 | "rgba(245, 54, 54, 0.9)" 355 | ], 356 | "datasource": "Prometheus", 357 | "decimals": null, 358 | "editable": true, 359 | "error": false, 360 | "format": "percent", 361 | "gauge": { 362 | "maxValue": 100, 363 | "minValue": 0, 364 | "show": true, 365 | "thresholdLabels": false, 366 | "thresholdMarkers": true 367 | }, 368 | "id": 6, 369 | "interval": null, 370 | "isNew": true, 371 | "links": [], 372 | "mappingType": 1, 373 | "mappingTypes": [ 374 | { 375 | "name": "value to text", 376 | "value": 1 377 | }, 378 | { 379 | "name": "range to text", 380 | "value": 2 381 | } 382 | ], 383 | "maxDataPoints": 100, 384 | "nullPointMode": "connected", 385 | "nullText": null, 386 | "postfix": "", 387 | "postfixFontSize": "50%", 388 | "prefix": "", 389 | "prefixFontSize": "50%", 390 | "rangeMaps": [ 391 | { 392 | "from": "null", 393 | "text": "N/A", 394 | "to": "null" 395 | } 396 | ], 397 | "span": 2, 398 | "sparkline": { 399 | "fillColor": "rgba(31, 118, 189, 0.18)", 400 | "full": false, 401 | "lineColor": "rgb(31, 120, 193)", 402 | "show": false 403 | }, 404 | "targets": [ 405 | { 406 | "expr": "(node_filesystem_size_bytes{fstype=\"aufs\"} - node_filesystem_free_bytes{fstype=\"aufs\"}) / node_filesystem_size_bytes{fstype=\"aufs\"} * 100", 407 | "interval": "30s", 408 | "intervalFactor": 1, 409 | "legendFormat": "", 410 | "refId": "A", 411 | "step": 30 412 | } 413 | ], 414 | "thresholds": "65, 90", 415 | "title": "Storage Load", 416 | "transparent": false, 417 | "type": "singlestat", 418 | "valueFontSize": "80%", 419 | "valueMaps": [ 420 | { 421 | "op": "=", 422 | "text": "N/A", 423 | "value": "null" 424 | } 425 | ], 426 | "valueName": "avg", 427 | "timeFrom": "10s", 428 | "hideTimeOverride": true 429 | }, 430 | { 431 | "cacheTimeout": null, 432 | "colorBackground": false, 433 | "colorValue": false, 434 | "colors": [ 435 | "rgba(245, 54, 54, 0.9)", 436 | "rgba(237, 129, 40, 0.89)", 437 | "rgba(50, 172, 45, 0.97)" 438 | ], 439 | "datasource": "Prometheus", 440 | "decimals": 2, 441 | "editable": true, 442 | "error": false, 443 | "format": "bytes", 444 | "gauge": { 445 | "maxValue": 100, 446 | "minValue": 0, 447 | "show": false, 448 | "thresholdLabels": false, 449 | "thresholdMarkers": true 450 | }, 451 | "id": 3, 452 | "interval": null, 453 | "isNew": true, 454 | "links": [], 455 | "mappingType": 1, 456 | "mappingTypes": [ 457 | { 458 | "name": "value to text", 459 | "value": 1 460 | }, 461 | { 462 | "name": "range to text", 463 | "value": 2 464 | } 465 | ], 466 | "maxDataPoints": 100, 467 | "nullPointMode": "connected", 468 | "nullText": null, 469 | "postfix": "", 470 | "postfixFontSize": "50%", 471 | "prefix": "", 472 | "prefixFontSize": "50%", 473 | "rangeMaps": [ 474 | { 475 | "from": "null", 476 | "text": "N/A", 477 | "to": "null" 478 | } 479 | ], 480 | "span": 2, 481 | "sparkline": { 482 | "fillColor": "rgba(31, 118, 189, 0.18)", 483 | "full": false, 484 | "lineColor": "rgb(31, 120, 193)", 485 | "show": false 486 | }, 487 | "targets": [ 488 | { 489 | "expr": "sum(container_fs_usage_bytes)", 490 | "interval": "30s", 491 | "intervalFactor": 2, 492 | "refId": "A", 493 | "step": 60 494 | } 495 | ], 496 | "thresholds": "", 497 | "title": "Used Storage", 498 | "transparent": false, 499 | "type": "singlestat", 500 | "valueFontSize": "80%", 501 | "valueMaps": [ 502 | { 503 | "op": "=", 504 | "text": "N/A", 505 | "value": "null" 506 | } 507 | ], 508 | "valueName": "avg", 509 | "timeFrom": "10s", 510 | "hideTimeOverride": true 511 | } 512 | ], 513 | "title": "Overview" 514 | }, 515 | { 516 | "collapse": false, 517 | "editable": true, 518 | "height": "150px", 519 | "panels": [ 520 | { 521 | "aliasColors": {}, 522 | "bars": true, 523 | "datasource": "Prometheus", 524 | "decimals": 0, 525 | "editable": true, 526 | "error": false, 527 | "fill": 1, 528 | "grid": { 529 | "threshold1": null, 530 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 531 | "threshold2": null, 532 | "threshold2Color": "rgba(234, 112, 112, 0.22)", 533 | "thresholdLine": false 534 | }, 535 | "id": 9, 536 | "isNew": true, 537 | "legend": { 538 | "avg": false, 539 | "current": false, 540 | "max": false, 541 | "min": false, 542 | "show": false, 543 | "total": false, 544 | "values": false 545 | }, 546 | "lines": false, 547 | "linewidth": 2, 548 | "links": [], 549 | "nullPointMode": "connected", 550 | "percentage": false, 551 | "pointradius": 5, 552 | "points": false, 553 | "renderer": "flot", 554 | "seriesOverrides": [], 555 | "span": 4, 556 | "stack": false, 557 | "steppedLine": false, 558 | "targets": [ 559 | { 560 | "expr": "scalar(count(container_memory_usage_bytes{image!=\"\"}) > 0)", 561 | "interval": "", 562 | "intervalFactor": 2, 563 | "legendFormat": "containers", 564 | "refId": "A", 565 | "step": 2 566 | } 567 | ], 568 | "timeFrom": null, 569 | "timeShift": null, 570 | "title": "Running Containers", 571 | "tooltip": { 572 | "msResolution": true, 573 | "shared": true, 574 | "sort": 0, 575 | "value_type": "cumulative" 576 | }, 577 | "type": "graph", 578 | "xaxis": { 579 | "show": true 580 | }, 581 | "yaxes": [ 582 | { 583 | "format": "none", 584 | "label": "", 585 | "logBase": 1, 586 | "max": null, 587 | "min": 0, 588 | "show": true 589 | }, 590 | { 591 | "format": "short", 592 | "label": null, 593 | "logBase": 1, 594 | "max": null, 595 | "min": null, 596 | "show": false 597 | } 598 | ] 599 | }, 600 | { 601 | "aliasColors": {}, 602 | "bars": true, 603 | "datasource": "Prometheus", 604 | "decimals": 2, 605 | "editable": true, 606 | "error": false, 607 | "fill": 1, 608 | "grid": { 609 | "threshold1": null, 610 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 611 | "threshold2": null, 612 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 613 | }, 614 | "id": 10, 615 | "isNew": true, 616 | "legend": { 617 | "avg": false, 618 | "current": false, 619 | "max": false, 620 | "min": false, 621 | "show": false, 622 | "total": false, 623 | "values": false 624 | }, 625 | "lines": false, 626 | "linewidth": 2, 627 | "links": [], 628 | "nullPointMode": "connected", 629 | "percentage": false, 630 | "pointradius": 5, 631 | "points": false, 632 | "renderer": "flot", 633 | "seriesOverrides": [ 634 | { 635 | "alias": "load 1m", 636 | "color": "#BF1B00" 637 | } 638 | ], 639 | "span": 4, 640 | "stack": false, 641 | "steppedLine": false, 642 | "targets": [ 643 | { 644 | "expr": "node_load1", 645 | "interval": "", 646 | "intervalFactor": 2, 647 | "legendFormat": "load 1m", 648 | "metric": "node_load1", 649 | "refId": "A", 650 | "step": 2 651 | } 652 | ], 653 | "timeFrom": null, 654 | "timeShift": null, 655 | "title": "System Load", 656 | "tooltip": { 657 | "msResolution": true, 658 | "shared": true, 659 | "sort": 0, 660 | "value_type": "cumulative" 661 | }, 662 | "type": "graph", 663 | "xaxis": { 664 | "show": true 665 | }, 666 | "yaxes": [ 667 | { 668 | "format": "short", 669 | "label": null, 670 | "logBase": 1, 671 | "max": null, 672 | "min": 0, 673 | "show": true 674 | }, 675 | { 676 | "format": "short", 677 | "label": null, 678 | "logBase": 1, 679 | "max": null, 680 | "min": null, 681 | "show": false 682 | } 683 | ] 684 | }, 685 | { 686 | "aliasColors": {}, 687 | "bars": false, 688 | "datasource": "Prometheus", 689 | "editable": true, 690 | "error": false, 691 | "fill": 1, 692 | "grid": { 693 | "threshold1": null, 694 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 695 | "threshold2": null, 696 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 697 | }, 698 | "id": 15, 699 | "isNew": true, 700 | "legend": { 701 | "alignAsTable": true, 702 | "avg": true, 703 | "current": false, 704 | "max": true, 705 | "min": true, 706 | "rightSide": true, 707 | "show": false, 708 | "total": false, 709 | "values": true 710 | }, 711 | "lines": true, 712 | "linewidth": 2, 713 | "links": [], 714 | "nullPointMode": "connected", 715 | "percentage": false, 716 | "pointradius": 5, 717 | "points": false, 718 | "renderer": "flot", 719 | "seriesOverrides": [ 720 | { 721 | "alias": "read", 722 | "yaxis": 1 723 | }, 724 | { 725 | "alias": "written", 726 | "yaxis": 1 727 | }, 728 | { 729 | "alias": "io time", 730 | "yaxis": 2 731 | } 732 | ], 733 | "span": 4, 734 | "stack": false, 735 | "steppedLine": false, 736 | "targets": [ 737 | { 738 | "expr": "sum(irate(node_disk_read_bytes_total[5m]))", 739 | "interval": "2s", 740 | "intervalFactor": 4, 741 | "legendFormat": "read", 742 | "metric": "", 743 | "refId": "A", 744 | "step": 8 745 | }, 746 | { 747 | "expr": "sum(irate(node_disk_written_bytes_total[5m]))", 748 | "interval": "2s", 749 | "intervalFactor": 4, 750 | "legendFormat": "written", 751 | "metric": "", 752 | "refId": "B", 753 | "step": 8 754 | }, 755 | { 756 | "expr": "sum(irate(node_disk_io_time_seconds_total[5m]))", 757 | "interval": "2s", 758 | "intervalFactor": 4, 759 | "legendFormat": "io time", 760 | "metric": "", 761 | "refId": "C", 762 | "step": 8 763 | } 764 | ], 765 | "timeFrom": null, 766 | "timeShift": null, 767 | "title": "I/O Usage", 768 | "tooltip": { 769 | "msResolution": true, 770 | "shared": true, 771 | "sort": 0, 772 | "value_type": "cumulative" 773 | }, 774 | "type": "graph", 775 | "xaxis": { 776 | "show": true 777 | }, 778 | "yaxes": [ 779 | { 780 | "format": "bytes", 781 | "label": null, 782 | "logBase": 1, 783 | "max": null, 784 | "min": null, 785 | "show": true 786 | }, 787 | { 788 | "format": "ms", 789 | "label": null, 790 | "logBase": 1, 791 | "max": null, 792 | "min": null, 793 | "show": true 794 | } 795 | ] 796 | } 797 | ], 798 | "title": "Host stats" 799 | }, 800 | { 801 | "collapse": false, 802 | "editable": true, 803 | "height": "250px", 804 | "panels": [ 805 | { 806 | "aliasColors": {}, 807 | "bars": false, 808 | "datasource": "Prometheus", 809 | "decimals": 2, 810 | "editable": true, 811 | "error": false, 812 | "fill": 1, 813 | "grid": { 814 | "threshold1": null, 815 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 816 | "threshold2": null, 817 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 818 | }, 819 | "id": 8, 820 | "isNew": true, 821 | "legend": { 822 | "alignAsTable": true, 823 | "avg": true, 824 | "current": false, 825 | "max": true, 826 | "min": true, 827 | "rightSide": true, 828 | "show": true, 829 | "total": false, 830 | "values": true 831 | }, 832 | "lines": true, 833 | "linewidth": 2, 834 | "links": [], 835 | "nullPointMode": "connected", 836 | "percentage": false, 837 | "pointradius": 5, 838 | "points": false, 839 | "renderer": "flot", 840 | "seriesOverrides": [], 841 | "span": 12, 842 | "stack": false, 843 | "steppedLine": false, 844 | "targets": [ 845 | { 846 | "expr": "sum by (name) (rate(container_cpu_usage_seconds_total{image!=\"\",container_label_org_label_schema_group=\"\"}[1m])) / scalar(count(node_cpu_seconds_total{mode=\"user\"})) * 100", 847 | "intervalFactor": 10, 848 | "legendFormat": "{{ name }}", 849 | "metric": "container_cpu_user_seconds_total", 850 | "refId": "A", 851 | "step": 10 852 | } 853 | ], 854 | "timeFrom": null, 855 | "timeShift": null, 856 | "title": "Container CPU Usage", 857 | "tooltip": { 858 | "msResolution": true, 859 | "shared": true, 860 | "sort": 2, 861 | "value_type": "cumulative" 862 | }, 863 | "type": "graph", 864 | "xaxis": { 865 | "show": true 866 | }, 867 | "yaxes": [ 868 | { 869 | "format": "percent", 870 | "label": null, 871 | "logBase": 1, 872 | "max": null, 873 | "min": 0, 874 | "show": true 875 | }, 876 | { 877 | "format": "short", 878 | "label": null, 879 | "logBase": 1, 880 | "max": null, 881 | "min": null, 882 | "show": false 883 | } 884 | ] 885 | } 886 | ], 887 | "title": "CPU" 888 | }, 889 | { 890 | "collapse": false, 891 | "editable": true, 892 | "height": "250px", 893 | "panels": [ 894 | { 895 | "aliasColors": {}, 896 | "bars": false, 897 | "datasource": "Prometheus", 898 | "decimals": 2, 899 | "editable": true, 900 | "error": false, 901 | "fill": 1, 902 | "grid": { 903 | "threshold1": null, 904 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 905 | "threshold2": null, 906 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 907 | }, 908 | "id": 11, 909 | "isNew": true, 910 | "legend": { 911 | "alignAsTable": true, 912 | "avg": true, 913 | "current": false, 914 | "max": true, 915 | "min": true, 916 | "rightSide": true, 917 | "show": true, 918 | "total": false, 919 | "values": true 920 | }, 921 | "lines": true, 922 | "linewidth": 2, 923 | "links": [], 924 | "nullPointMode": "connected", 925 | "percentage": false, 926 | "pointradius": 5, 927 | "points": false, 928 | "renderer": "flot", 929 | "seriesOverrides": [], 930 | "span": 12, 931 | "stack": false, 932 | "steppedLine": false, 933 | "targets": [ 934 | { 935 | "expr": "sum by (name)(container_memory_usage_bytes{image!=\"\",container_label_org_label_schema_group=\"\"})", 936 | "intervalFactor": 1, 937 | "legendFormat": "{{ name }}", 938 | "metric": "container_memory_usage", 939 | "refId": "A", 940 | "step": 1 941 | } 942 | ], 943 | "timeFrom": null, 944 | "timeShift": null, 945 | "title": "Container Memory Usage", 946 | "tooltip": { 947 | "msResolution": true, 948 | "shared": true, 949 | "sort": 0, 950 | "value_type": "cumulative" 951 | }, 952 | "type": "graph", 953 | "xaxis": { 954 | "show": true 955 | }, 956 | "yaxes": [ 957 | { 958 | "format": "bytes", 959 | "label": null, 960 | "logBase": 1, 961 | "max": null, 962 | "min": 0, 963 | "show": true 964 | }, 965 | { 966 | "format": "short", 967 | "label": null, 968 | "logBase": 1, 969 | "max": null, 970 | "min": null, 971 | "show": false 972 | } 973 | ] 974 | }, 975 | { 976 | "aliasColors": {}, 977 | "bars": false, 978 | "datasource": "Prometheus", 979 | "decimals": 2, 980 | "editable": true, 981 | "error": false, 982 | "fill": 1, 983 | "grid": { 984 | "threshold1": null, 985 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 986 | "threshold2": null, 987 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 988 | }, 989 | "id": 12, 990 | "isNew": true, 991 | "legend": { 992 | "alignAsTable": true, 993 | "avg": true, 994 | "current": false, 995 | "max": true, 996 | "min": true, 997 | "rightSide": true, 998 | "show": true, 999 | "total": false, 1000 | "values": true 1001 | }, 1002 | "lines": true, 1003 | "linewidth": 2, 1004 | "links": [], 1005 | "nullPointMode": "connected", 1006 | "percentage": false, 1007 | "pointradius": 5, 1008 | "points": false, 1009 | "renderer": "flot", 1010 | "seriesOverrides": [], 1011 | "span": 12, 1012 | "stack": false, 1013 | "steppedLine": false, 1014 | "targets": [ 1015 | { 1016 | "expr": "sum by (name) (container_memory_cache{image!=\"\",container_label_org_label_schema_group=\"\"})", 1017 | "intervalFactor": 2, 1018 | "legendFormat": "{{name}}", 1019 | "metric": "container_memory_cache", 1020 | "refId": "A", 1021 | "step": 2 1022 | } 1023 | ], 1024 | "timeFrom": null, 1025 | "timeShift": null, 1026 | "title": "Container Cached Memory Usage", 1027 | "tooltip": { 1028 | "msResolution": true, 1029 | "shared": true, 1030 | "sort": 0, 1031 | "value_type": "cumulative" 1032 | }, 1033 | "type": "graph", 1034 | "xaxis": { 1035 | "show": true 1036 | }, 1037 | "yaxes": [ 1038 | { 1039 | "format": "bytes", 1040 | "label": null, 1041 | "logBase": 1, 1042 | "max": null, 1043 | "min": 0, 1044 | "show": true 1045 | }, 1046 | { 1047 | "format": "short", 1048 | "label": null, 1049 | "logBase": 1, 1050 | "max": null, 1051 | "min": null, 1052 | "show": false 1053 | } 1054 | ] 1055 | } 1056 | ], 1057 | "title": "Memory" 1058 | }, 1059 | { 1060 | "collapse": false, 1061 | "editable": true, 1062 | "height": "250px", 1063 | "panels": [ 1064 | { 1065 | "aliasColors": {}, 1066 | "bars": false, 1067 | "datasource": "Prometheus", 1068 | "decimals": 2, 1069 | "editable": true, 1070 | "error": false, 1071 | "fill": 1, 1072 | "grid": { 1073 | "threshold1": null, 1074 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 1075 | "threshold2": null, 1076 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 1077 | }, 1078 | "id": 13, 1079 | "isNew": true, 1080 | "legend": { 1081 | "alignAsTable": true, 1082 | "avg": true, 1083 | "current": false, 1084 | "max": true, 1085 | "min": true, 1086 | "rightSide": true, 1087 | "show": true, 1088 | "total": false, 1089 | "values": true 1090 | }, 1091 | "lines": true, 1092 | "linewidth": 2, 1093 | "links": [], 1094 | "nullPointMode": "connected", 1095 | "percentage": false, 1096 | "pointradius": 5, 1097 | "points": false, 1098 | "renderer": "flot", 1099 | "seriesOverrides": [], 1100 | "span": 12, 1101 | "stack": false, 1102 | "steppedLine": false, 1103 | "targets": [ 1104 | { 1105 | "expr": "sum by (name) (rate(container_network_receive_bytes_total{image!=\"\",container_label_org_label_schema_group=\"\"}[1m]))", 1106 | "intervalFactor": 10, 1107 | "legendFormat": "{{ name }}", 1108 | "metric": "container_network_receive_bytes_total", 1109 | "refId": "A", 1110 | "step": 10 1111 | } 1112 | ], 1113 | "timeFrom": null, 1114 | "timeShift": null, 1115 | "title": "Container Network Input", 1116 | "tooltip": { 1117 | "msResolution": true, 1118 | "shared": true, 1119 | "sort": 2, 1120 | "value_type": "cumulative" 1121 | }, 1122 | "type": "graph", 1123 | "xaxis": { 1124 | "show": true 1125 | }, 1126 | "yaxes": [ 1127 | { 1128 | "format": "bytes", 1129 | "label": null, 1130 | "logBase": 1, 1131 | "max": null, 1132 | "min": 0, 1133 | "show": true 1134 | }, 1135 | { 1136 | "format": "short", 1137 | "label": null, 1138 | "logBase": 1, 1139 | "max": null, 1140 | "min": null, 1141 | "show": false 1142 | } 1143 | ] 1144 | }, 1145 | { 1146 | "aliasColors": {}, 1147 | "bars": false, 1148 | "datasource": "Prometheus", 1149 | "decimals": 2, 1150 | "editable": true, 1151 | "error": false, 1152 | "fill": 1, 1153 | "grid": { 1154 | "threshold1": null, 1155 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 1156 | "threshold2": null, 1157 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 1158 | }, 1159 | "id": 14, 1160 | "isNew": true, 1161 | "legend": { 1162 | "alignAsTable": true, 1163 | "avg": true, 1164 | "current": false, 1165 | "max": true, 1166 | "min": true, 1167 | "rightSide": true, 1168 | "show": true, 1169 | "total": false, 1170 | "values": true 1171 | }, 1172 | "lines": true, 1173 | "linewidth": 2, 1174 | "links": [], 1175 | "nullPointMode": "connected", 1176 | "percentage": false, 1177 | "pointradius": 5, 1178 | "points": false, 1179 | "renderer": "flot", 1180 | "seriesOverrides": [], 1181 | "span": 12, 1182 | "stack": false, 1183 | "steppedLine": false, 1184 | "targets": [ 1185 | { 1186 | "expr": "sum by (name) (rate(container_network_transmit_bytes_total{image!=\"\",container_label_org_label_schema_group=\"\"}[1m]))", 1187 | "intervalFactor": 10, 1188 | "legendFormat": "{{ name }}", 1189 | "metric": "container_network_transmit_bytes_total", 1190 | "refId": "A", 1191 | "step": 10 1192 | } 1193 | ], 1194 | "timeFrom": null, 1195 | "timeShift": null, 1196 | "title": "Container Network Output", 1197 | "tooltip": { 1198 | "msResolution": true, 1199 | "shared": true, 1200 | "sort": 2, 1201 | "value_type": "cumulative" 1202 | }, 1203 | "type": "graph", 1204 | "xaxis": { 1205 | "show": true 1206 | }, 1207 | "yaxes": [ 1208 | { 1209 | "format": "bytes", 1210 | "label": null, 1211 | "logBase": 1, 1212 | "max": null, 1213 | "min": 0, 1214 | "show": true 1215 | }, 1216 | { 1217 | "format": "short", 1218 | "label": null, 1219 | "logBase": 1, 1220 | "max": null, 1221 | "min": null, 1222 | "show": false 1223 | } 1224 | ] 1225 | } 1226 | ], 1227 | "title": "Network" 1228 | } 1229 | ], 1230 | "time": { 1231 | "from": "now-15m", 1232 | "to": "now" 1233 | }, 1234 | "timepicker": { 1235 | "refresh_intervals": [ 1236 | "5s", 1237 | "10s", 1238 | "30s", 1239 | "1m", 1240 | "5m", 1241 | "15m", 1242 | "30m", 1243 | "1h", 1244 | "2h", 1245 | "1d" 1246 | ], 1247 | "time_options": [ 1248 | "5m", 1249 | "15m", 1250 | "1h", 1251 | "6h", 1252 | "12h", 1253 | "24h", 1254 | "2d", 1255 | "7d", 1256 | "30d" 1257 | ] 1258 | }, 1259 | "templating": { 1260 | "list": [] 1261 | }, 1262 | "annotations": { 1263 | "list": [] 1264 | }, 1265 | "refresh": "10s", 1266 | "schemaVersion": 12, 1267 | "version": 8, 1268 | "links": [], 1269 | "gnetId": null 1270 | } -------------------------------------------------------------------------------- /monitoring/grafana/provisioning/dashboards/docker_host.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": null, 3 | "title": "Docker Host", 4 | "description": "Docker host metrics", 5 | "tags": [ 6 | "system" 7 | ], 8 | "style": "dark", 9 | "timezone": "browser", 10 | "editable": true, 11 | "hideControls": false, 12 | "sharedCrosshair": true, 13 | "rows": [ 14 | { 15 | "collapse": false, 16 | "editable": true, 17 | "height": "100px", 18 | "panels": [ 19 | { 20 | "cacheTimeout": null, 21 | "colorBackground": false, 22 | "colorValue": false, 23 | "colors": [ 24 | "rgba(245, 54, 54, 0.9)", 25 | "rgba(237, 129, 40, 0.89)", 26 | "rgba(50, 172, 45, 0.97)" 27 | ], 28 | "datasource": "Prometheus", 29 | "decimals": 1, 30 | "editable": true, 31 | "error": false, 32 | "format": "s", 33 | "gauge": { 34 | "maxValue": 100, 35 | "minValue": 0, 36 | "show": false, 37 | "thresholdLabels": false, 38 | "thresholdMarkers": true 39 | }, 40 | "id": 1, 41 | "interval": null, 42 | "isNew": true, 43 | "links": [], 44 | "mappingType": 1, 45 | "mappingTypes": [ 46 | { 47 | "name": "value to text", 48 | "value": 1 49 | }, 50 | { 51 | "name": "range to text", 52 | "value": 2 53 | } 54 | ], 55 | "maxDataPoints": 100, 56 | "nullPointMode": "connected", 57 | "nullText": null, 58 | "postfix": "s", 59 | "postfixFontSize": "80%", 60 | "prefix": "", 61 | "prefixFontSize": "50%", 62 | "rangeMaps": [ 63 | { 64 | "from": "null", 65 | "text": "N/A", 66 | "to": "null" 67 | } 68 | ], 69 | "span": 2, 70 | "sparkline": { 71 | "fillColor": "rgba(31, 118, 189, 0.18)", 72 | "full": false, 73 | "lineColor": "rgb(31, 120, 193)", 74 | "show": false 75 | }, 76 | "targets": [ 77 | { 78 | "expr": "node_time_seconds - node_boot_time_seconds", 79 | "interval": "30s", 80 | "intervalFactor": 1, 81 | "refId": "A", 82 | "step": 30 83 | } 84 | ], 85 | "thresholds": "", 86 | "title": "Uptime", 87 | "type": "singlestat", 88 | "valueFontSize": "80%", 89 | "valueMaps": [ 90 | { 91 | "op": "=", 92 | "text": "N/A", 93 | "value": "null" 94 | } 95 | ], 96 | "valueName": "avg", 97 | "timeFrom": "10s", 98 | "hideTimeOverride": true 99 | }, 100 | { 101 | "cacheTimeout": null, 102 | "colorBackground": false, 103 | "colorValue": false, 104 | "colors": [ 105 | "rgba(245, 54, 54, 0.9)", 106 | "rgba(237, 129, 40, 0.89)", 107 | "rgba(50, 172, 45, 0.97)" 108 | ], 109 | "datasource": "Prometheus", 110 | "editable": true, 111 | "error": false, 112 | "format": "percent", 113 | "gauge": { 114 | "maxValue": 100, 115 | "minValue": 0, 116 | "show": false, 117 | "thresholdLabels": false, 118 | "thresholdMarkers": true 119 | }, 120 | "id": 13, 121 | "interval": null, 122 | "isNew": true, 123 | "links": [], 124 | "mappingType": 1, 125 | "mappingTypes": [ 126 | { 127 | "name": "value to text", 128 | "value": 1 129 | }, 130 | { 131 | "name": "range to text", 132 | "value": 2 133 | } 134 | ], 135 | "maxDataPoints": 100, 136 | "nullPointMode": "connected", 137 | "nullText": null, 138 | "postfix": "", 139 | "postfixFontSize": "50%", 140 | "prefix": "", 141 | "prefixFontSize": "50%", 142 | "rangeMaps": [ 143 | { 144 | "from": "null", 145 | "text": "N/A", 146 | "to": "null" 147 | } 148 | ], 149 | "span": 2, 150 | "sparkline": { 151 | "fillColor": "rgba(31, 118, 189, 0.18)", 152 | "full": false, 153 | "lineColor": "rgb(31, 120, 193)", 154 | "show": false 155 | }, 156 | "targets": [ 157 | { 158 | "expr": "sum(rate(node_cpu_seconds_total{mode=\"idle\"}[1m])) * 100 / scalar(count(node_cpu_seconds_total{mode=\"user\"}))", 159 | "interval": "10s", 160 | "intervalFactor": 2, 161 | "legendFormat": "", 162 | "refId": "A", 163 | "step": 20 164 | } 165 | ], 166 | "thresholds": "", 167 | "title": "CPU Idle", 168 | "type": "singlestat", 169 | "valueFontSize": "80%", 170 | "valueMaps": [ 171 | { 172 | "op": "=", 173 | "text": "N/A", 174 | "value": "null" 175 | } 176 | ], 177 | "valueName": "avg", 178 | "timeFrom": "10s", 179 | "hideTimeOverride": true 180 | }, 181 | { 182 | "cacheTimeout": null, 183 | "colorBackground": false, 184 | "colorValue": false, 185 | "colors": [ 186 | "rgba(245, 54, 54, 0.9)", 187 | "rgba(237, 129, 40, 0.89)", 188 | "rgba(50, 172, 45, 0.97)" 189 | ], 190 | "datasource": "Prometheus", 191 | "editable": true, 192 | "error": false, 193 | "format": "none", 194 | "gauge": { 195 | "maxValue": 100, 196 | "minValue": 0, 197 | "show": false, 198 | "thresholdLabels": false, 199 | "thresholdMarkers": true 200 | }, 201 | "id": 12, 202 | "interval": null, 203 | "isNew": true, 204 | "links": [], 205 | "mappingType": 1, 206 | "mappingTypes": [ 207 | { 208 | "name": "value to text", 209 | "value": 1 210 | }, 211 | { 212 | "name": "range to text", 213 | "value": 2 214 | } 215 | ], 216 | "maxDataPoints": 100, 217 | "nullPointMode": "connected", 218 | "nullText": null, 219 | "postfix": "", 220 | "postfixFontSize": "50%", 221 | "prefix": "", 222 | "prefixFontSize": "50%", 223 | "rangeMaps": [ 224 | { 225 | "from": "null", 226 | "text": "N/A", 227 | "to": "null" 228 | } 229 | ], 230 | "span": 2, 231 | "sparkline": { 232 | "fillColor": "rgba(31, 118, 189, 0.18)", 233 | "full": false, 234 | "lineColor": "rgb(31, 120, 193)", 235 | "show": false 236 | }, 237 | "targets": [ 238 | { 239 | "expr": "machine_cpu_cores", 240 | "intervalFactor": 2, 241 | "metric": "machine_cpu_cores", 242 | "refId": "A", 243 | "step": 2 244 | } 245 | ], 246 | "thresholds": "", 247 | "title": "CPU Cores", 248 | "type": "singlestat", 249 | "valueFontSize": "80%", 250 | "valueMaps": [ 251 | { 252 | "op": "=", 253 | "text": "N/A", 254 | "value": "null" 255 | } 256 | ], 257 | "valueName": "avg", 258 | "timeFrom": "10s", 259 | "hideTimeOverride": true 260 | }, 261 | { 262 | "cacheTimeout": null, 263 | "colorBackground": false, 264 | "colorValue": false, 265 | "colors": [ 266 | "rgba(245, 54, 54, 0.9)", 267 | "rgba(237, 129, 40, 0.89)", 268 | "rgba(50, 172, 45, 0.97)" 269 | ], 270 | "datasource": "Prometheus", 271 | "editable": true, 272 | "error": false, 273 | "format": "bytes", 274 | "gauge": { 275 | "maxValue": 100, 276 | "minValue": 0, 277 | "show": false, 278 | "thresholdLabels": false, 279 | "thresholdMarkers": true 280 | }, 281 | "id": 2, 282 | "interval": null, 283 | "isNew": true, 284 | "links": [], 285 | "mappingType": 1, 286 | "mappingTypes": [ 287 | { 288 | "name": "value to text", 289 | "value": 1 290 | }, 291 | { 292 | "name": "range to text", 293 | "value": 2 294 | } 295 | ], 296 | "maxDataPoints": 100, 297 | "nullPointMode": "connected", 298 | "nullText": null, 299 | "postfix": "", 300 | "postfixFontSize": "50%", 301 | "prefix": "", 302 | "prefixFontSize": "50%", 303 | "rangeMaps": [ 304 | { 305 | "from": "null", 306 | "text": "N/A", 307 | "to": "null" 308 | } 309 | ], 310 | "span": 2, 311 | "sparkline": { 312 | "fillColor": "rgba(31, 118, 189, 0.18)", 313 | "full": false, 314 | "lineColor": "rgb(31, 120, 193)", 315 | "show": false 316 | }, 317 | "targets": [ 318 | { 319 | "expr": "node_memory_MemAvailable_bytes", 320 | "interval": "30s", 321 | "intervalFactor": 2, 322 | "legendFormat": "", 323 | "refId": "A", 324 | "step": 60 325 | } 326 | ], 327 | "thresholds": "", 328 | "title": "Available Memory", 329 | "type": "singlestat", 330 | "valueFontSize": "80%", 331 | "valueMaps": [ 332 | { 333 | "op": "=", 334 | "text": "N/A", 335 | "value": "null" 336 | } 337 | ], 338 | "valueName": "avg", 339 | "timeFrom": "10s", 340 | "hideTimeOverride": true 341 | }, 342 | { 343 | "cacheTimeout": null, 344 | "colorBackground": false, 345 | "colorValue": false, 346 | "colors": [ 347 | "rgba(245, 54, 54, 0.9)", 348 | "rgba(237, 129, 40, 0.89)", 349 | "rgba(50, 172, 45, 0.97)" 350 | ], 351 | "datasource": "Prometheus", 352 | "editable": true, 353 | "error": false, 354 | "format": "bytes", 355 | "gauge": { 356 | "maxValue": 100, 357 | "minValue": 0, 358 | "show": false, 359 | "thresholdLabels": false, 360 | "thresholdMarkers": true 361 | }, 362 | "id": 3, 363 | "interval": null, 364 | "isNew": true, 365 | "links": [], 366 | "mappingType": 1, 367 | "mappingTypes": [ 368 | { 369 | "name": "value to text", 370 | "value": 1 371 | }, 372 | { 373 | "name": "range to text", 374 | "value": 2 375 | } 376 | ], 377 | "maxDataPoints": 100, 378 | "nullPointMode": "connected", 379 | "nullText": null, 380 | "postfix": "", 381 | "postfixFontSize": "50%", 382 | "prefix": "", 383 | "prefixFontSize": "50%", 384 | "rangeMaps": [ 385 | { 386 | "from": "null", 387 | "text": "N/A", 388 | "to": "null" 389 | } 390 | ], 391 | "span": 2, 392 | "sparkline": { 393 | "fillColor": "rgba(31, 118, 189, 0.18)", 394 | "full": false, 395 | "lineColor": "rgb(31, 120, 193)", 396 | "show": false 397 | }, 398 | "targets": [ 399 | { 400 | "expr": "node_memory_SwapFree_bytes", 401 | "interval": "30s", 402 | "intervalFactor": 2, 403 | "refId": "A", 404 | "step": 60 405 | } 406 | ], 407 | "thresholds": "", 408 | "title": "Free Swap", 409 | "type": "singlestat", 410 | "valueFontSize": "80%", 411 | "valueMaps": [ 412 | { 413 | "op": "=", 414 | "text": "N/A", 415 | "value": "null" 416 | } 417 | ], 418 | "valueName": "avg", 419 | "timeFrom": "10s", 420 | "hideTimeOverride": true 421 | }, 422 | { 423 | "cacheTimeout": null, 424 | "colorBackground": false, 425 | "colorValue": false, 426 | "colors": [ 427 | "rgba(245, 54, 54, 0.9)", 428 | "rgba(237, 129, 40, 0.89)", 429 | "rgba(50, 172, 45, 0.97)" 430 | ], 431 | "datasource": "Prometheus", 432 | "editable": true, 433 | "error": false, 434 | "format": "bytes", 435 | "gauge": { 436 | "maxValue": 100, 437 | "minValue": 0, 438 | "show": false, 439 | "thresholdLabels": false, 440 | "thresholdMarkers": true 441 | }, 442 | "id": 4, 443 | "interval": null, 444 | "isNew": true, 445 | "links": [], 446 | "mappingType": 1, 447 | "mappingTypes": [ 448 | { 449 | "name": "value to text", 450 | "value": 1 451 | }, 452 | { 453 | "name": "range to text", 454 | "value": 2 455 | } 456 | ], 457 | "maxDataPoints": 100, 458 | "nullPointMode": "connected", 459 | "nullText": null, 460 | "postfix": "", 461 | "postfixFontSize": "50%", 462 | "prefix": "", 463 | "prefixFontSize": "50%", 464 | "rangeMaps": [ 465 | { 466 | "from": "null", 467 | "text": "N/A", 468 | "to": "null" 469 | } 470 | ], 471 | "span": 2, 472 | "sparkline": { 473 | "fillColor": "rgba(31, 118, 189, 0.18)", 474 | "full": false, 475 | "lineColor": "rgb(31, 120, 193)", 476 | "show": false 477 | }, 478 | "targets": [ 479 | { 480 | "expr": "sum(node_filesystem_free_bytes{fstype=\"aufs\"})", 481 | "interval": "30s", 482 | "intervalFactor": 1, 483 | "legendFormat": "", 484 | "refId": "A", 485 | "step": 30 486 | } 487 | ], 488 | "thresholds": "", 489 | "title": "Free Storage", 490 | "type": "singlestat", 491 | "valueFontSize": "80%", 492 | "valueMaps": [ 493 | { 494 | "op": "=", 495 | "text": "N/A", 496 | "value": "null" 497 | } 498 | ], 499 | "valueName": "avg", 500 | "timeFrom": "10s", 501 | "hideTimeOverride": true 502 | } 503 | ], 504 | "title": "Available resources" 505 | }, 506 | { 507 | "collapse": false, 508 | "editable": true, 509 | "height": "150px", 510 | "panels": [ 511 | { 512 | "aliasColors": {}, 513 | "bars": true, 514 | "datasource": "Prometheus", 515 | "decimals": 2, 516 | "editable": true, 517 | "error": false, 518 | "fill": 1, 519 | "grid": { 520 | "threshold1": null, 521 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 522 | "threshold2": null, 523 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 524 | }, 525 | "id": 9, 526 | "isNew": true, 527 | "legend": { 528 | "avg": false, 529 | "current": false, 530 | "max": false, 531 | "min": false, 532 | "show": false, 533 | "total": false, 534 | "values": false 535 | }, 536 | "lines": false, 537 | "linewidth": 2, 538 | "links": [], 539 | "nullPointMode": "connected", 540 | "percentage": false, 541 | "pointradius": 5, 542 | "points": false, 543 | "renderer": "flot", 544 | "seriesOverrides": [ 545 | { 546 | "alias": "load 1m", 547 | "color": "#1F78C1" 548 | } 549 | ], 550 | "span": 4, 551 | "stack": false, 552 | "steppedLine": false, 553 | "targets": [ 554 | { 555 | "expr": "node_load1", 556 | "interval": "10s", 557 | "intervalFactor": 1, 558 | "legendFormat": "load 1m", 559 | "refId": "A", 560 | "step": 10 561 | } 562 | ], 563 | "timeFrom": null, 564 | "timeShift": null, 565 | "title": "Load Average 1m", 566 | "tooltip": { 567 | "msResolution": true, 568 | "shared": true, 569 | "sort": 0, 570 | "value_type": "cumulative" 571 | }, 572 | "type": "graph", 573 | "xaxis": { 574 | "show": true 575 | }, 576 | "yaxes": [ 577 | { 578 | "format": "short", 579 | "label": null, 580 | "logBase": 1, 581 | "max": null, 582 | "min": 0, 583 | "show": true 584 | }, 585 | { 586 | "format": "short", 587 | "label": null, 588 | "logBase": 1, 589 | "max": null, 590 | "min": null, 591 | "show": false 592 | } 593 | ] 594 | }, 595 | { 596 | "aliasColors": {}, 597 | "bars": true, 598 | "datasource": "Prometheus", 599 | "editable": true, 600 | "error": false, 601 | "fill": 1, 602 | "grid": { 603 | "threshold1": null, 604 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 605 | "threshold2": null, 606 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 607 | }, 608 | "id": 10, 609 | "isNew": true, 610 | "legend": { 611 | "avg": false, 612 | "current": false, 613 | "max": false, 614 | "min": false, 615 | "show": false, 616 | "total": false, 617 | "values": false 618 | }, 619 | "lines": false, 620 | "linewidth": 2, 621 | "links": [], 622 | "nullPointMode": "connected", 623 | "percentage": false, 624 | "pointradius": 5, 625 | "points": false, 626 | "renderer": "flot", 627 | "seriesOverrides": [ 628 | { 629 | "alias": "blocked by I/O", 630 | "color": "#58140C" 631 | } 632 | ], 633 | "span": 4, 634 | "stack": true, 635 | "steppedLine": false, 636 | "targets": [ 637 | { 638 | "expr": "node_procs_running", 639 | "interval": "10s", 640 | "intervalFactor": 1, 641 | "legendFormat": "running", 642 | "metric": "node_procs_running", 643 | "refId": "A", 644 | "step": 10 645 | }, 646 | { 647 | "expr": "node_procs_blocked", 648 | "interval": "10s", 649 | "intervalFactor": 1, 650 | "legendFormat": "blocked by I/O", 651 | "metric": "node_procs_blocked", 652 | "refId": "B", 653 | "step": 10 654 | } 655 | ], 656 | "timeFrom": null, 657 | "timeShift": null, 658 | "title": "Processes", 659 | "tooltip": { 660 | "msResolution": true, 661 | "shared": true, 662 | "sort": 2, 663 | "value_type": "individual" 664 | }, 665 | "type": "graph", 666 | "xaxis": { 667 | "show": true 668 | }, 669 | "yaxes": [ 670 | { 671 | "format": "short", 672 | "label": null, 673 | "logBase": 1, 674 | "max": null, 675 | "min": 0, 676 | "show": true 677 | }, 678 | { 679 | "format": "short", 680 | "label": null, 681 | "logBase": 1, 682 | "max": null, 683 | "min": null, 684 | "show": false 685 | } 686 | ] 687 | }, 688 | { 689 | "aliasColors": {}, 690 | "bars": true, 691 | "datasource": "Prometheus", 692 | "editable": true, 693 | "error": false, 694 | "fill": 1, 695 | "grid": { 696 | "threshold1": null, 697 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 698 | "threshold2": null, 699 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 700 | }, 701 | "id": 11, 702 | "isNew": true, 703 | "legend": { 704 | "avg": false, 705 | "current": false, 706 | "max": false, 707 | "min": false, 708 | "show": false, 709 | "total": false, 710 | "values": false 711 | }, 712 | "lines": false, 713 | "linewidth": 2, 714 | "links": [], 715 | "nullPointMode": "connected", 716 | "percentage": false, 717 | "pointradius": 5, 718 | "points": false, 719 | "renderer": "flot", 720 | "seriesOverrides": [ 721 | { 722 | "alias": "interrupts", 723 | "color": "#806EB7" 724 | } 725 | ], 726 | "span": 4, 727 | "stack": false, 728 | "steppedLine": false, 729 | "targets": [ 730 | { 731 | "expr": " irate(node_intr_total[5m])", 732 | "interval": "10s", 733 | "intervalFactor": 1, 734 | "legendFormat": "interrupts", 735 | "metric": "node_intr_total", 736 | "refId": "A", 737 | "step": 10 738 | } 739 | ], 740 | "timeFrom": null, 741 | "timeShift": null, 742 | "title": "Interrupts", 743 | "tooltip": { 744 | "msResolution": true, 745 | "shared": true, 746 | "sort": 0, 747 | "value_type": "cumulative" 748 | }, 749 | "type": "graph", 750 | "xaxis": { 751 | "show": true 752 | }, 753 | "yaxes": [ 754 | { 755 | "format": "short", 756 | "label": null, 757 | "logBase": 1, 758 | "max": null, 759 | "min": null, 760 | "show": true 761 | }, 762 | { 763 | "format": "short", 764 | "label": null, 765 | "logBase": 1, 766 | "max": null, 767 | "min": null, 768 | "show": false 769 | } 770 | ] 771 | } 772 | ], 773 | "title": "Load" 774 | }, 775 | { 776 | "collapse": false, 777 | "editable": true, 778 | "height": "250px", 779 | "panels": [ 780 | { 781 | "aliasColors": {}, 782 | "bars": false, 783 | "datasource": "Prometheus", 784 | "decimals": 2, 785 | "editable": true, 786 | "error": false, 787 | "fill": 4, 788 | "grid": { 789 | "threshold1": null, 790 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 791 | "threshold2": null, 792 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 793 | }, 794 | "id": 5, 795 | "isNew": true, 796 | "legend": { 797 | "alignAsTable": true, 798 | "avg": true, 799 | "current": false, 800 | "max": true, 801 | "min": true, 802 | "rightSide": true, 803 | "show": true, 804 | "total": false, 805 | "values": true 806 | }, 807 | "lines": true, 808 | "linewidth": 2, 809 | "links": [], 810 | "nullPointMode": "connected", 811 | "percentage": false, 812 | "pointradius": 5, 813 | "points": false, 814 | "renderer": "flot", 815 | "seriesOverrides": [], 816 | "span": 12, 817 | "stack": true, 818 | "steppedLine": false, 819 | "targets": [ 820 | { 821 | "expr": "sum(rate(node_cpu_seconds_total[1m])) by (mode) * 100 / scalar(count(node_cpu_seconds_total{mode=\"user\"}))", 822 | "intervalFactor": 10, 823 | "legendFormat": "{{ mode }}", 824 | "metric": "node_cpu_seconds_total", 825 | "refId": "A", 826 | "step": 10 827 | } 828 | ], 829 | "timeFrom": null, 830 | "timeShift": null, 831 | "title": "CPU Usage", 832 | "tooltip": { 833 | "msResolution": true, 834 | "shared": true, 835 | "sort": 2, 836 | "value_type": "individual" 837 | }, 838 | "type": "graph", 839 | "xaxis": { 840 | "show": true 841 | }, 842 | "yaxes": [ 843 | { 844 | "format": "percent", 845 | "label": null, 846 | "logBase": 1, 847 | "max": 100, 848 | "min": 0, 849 | "show": true 850 | }, 851 | { 852 | "format": "short", 853 | "label": null, 854 | "logBase": 1, 855 | "max": null, 856 | "min": 0, 857 | "show": true 858 | } 859 | ] 860 | } 861 | ], 862 | "title": "CPU" 863 | }, 864 | { 865 | "collapse": false, 866 | "editable": true, 867 | "height": "250px", 868 | "panels": [ 869 | { 870 | "aliasColors": {}, 871 | "bars": false, 872 | "datasource": "Prometheus", 873 | "decimals": 2, 874 | "editable": true, 875 | "error": false, 876 | "fill": 4, 877 | "grid": { 878 | "threshold1": null, 879 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 880 | "threshold2": null, 881 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 882 | }, 883 | "id": 6, 884 | "isNew": true, 885 | "legend": { 886 | "alignAsTable": true, 887 | "avg": true, 888 | "current": false, 889 | "max": true, 890 | "min": true, 891 | "rightSide": true, 892 | "show": true, 893 | "total": false, 894 | "values": true 895 | }, 896 | "lines": true, 897 | "linewidth": 2, 898 | "links": [], 899 | "nullPointMode": "null", 900 | "percentage": false, 901 | "pointradius": 5, 902 | "points": false, 903 | "renderer": "flot", 904 | "seriesOverrides": [ 905 | { 906 | "alias": "Used", 907 | "color": "#BF1B00" 908 | }, 909 | { 910 | "alias": "Free", 911 | "color": "#7EB26D" 912 | }, 913 | { 914 | "alias": "Buffers", 915 | "color": "#6ED0E0" 916 | }, 917 | { 918 | "alias": "Cached", 919 | "color": "#EF843C" 920 | } 921 | ], 922 | "span": 12, 923 | "stack": true, 924 | "steppedLine": false, 925 | "targets": [ 926 | { 927 | "expr": "node_memory_MemTotal_bytes - (node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes)", 928 | "intervalFactor": 1, 929 | "legendFormat": "Used", 930 | "refId": "A", 931 | "step": 1 932 | }, 933 | { 934 | "expr": "node_memory_MemFree_bytes", 935 | "intervalFactor": 1, 936 | "legendFormat": "Free", 937 | "refId": "B", 938 | "step": 1 939 | }, 940 | { 941 | "expr": "node_memory_Buffers_bytes", 942 | "intervalFactor": 1, 943 | "legendFormat": "Buffers", 944 | "refId": "C", 945 | "step": 1 946 | }, 947 | { 948 | "expr": "node_memory_Cached_bytes", 949 | "intervalFactor": 1, 950 | "legendFormat": "Cached", 951 | "refId": "D", 952 | "step": 1 953 | } 954 | ], 955 | "timeFrom": null, 956 | "timeShift": null, 957 | "title": "Memory Usage", 958 | "tooltip": { 959 | "msResolution": true, 960 | "shared": true, 961 | "sort": 2, 962 | "value_type": "individual" 963 | }, 964 | "type": "graph", 965 | "xaxis": { 966 | "show": true 967 | }, 968 | "yaxes": [ 969 | { 970 | "format": "bytes", 971 | "label": null, 972 | "logBase": 1, 973 | "max": null, 974 | "min": null, 975 | "show": true 976 | }, 977 | { 978 | "format": "short", 979 | "label": null, 980 | "logBase": 1, 981 | "max": null, 982 | "min": null, 983 | "show": true 984 | } 985 | ] 986 | } 987 | ], 988 | "title": "Memory" 989 | }, 990 | { 991 | "collapse": false, 992 | "editable": true, 993 | "height": "250px", 994 | "panels": [ 995 | { 996 | "aliasColors": {}, 997 | "bars": false, 998 | "datasource": "Prometheus", 999 | "decimals": 2, 1000 | "editable": true, 1001 | "error": false, 1002 | "fill": 1, 1003 | "grid": { 1004 | "threshold1": null, 1005 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 1006 | "threshold2": null, 1007 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 1008 | }, 1009 | "id": 7, 1010 | "isNew": true, 1011 | "legend": { 1012 | "alignAsTable": true, 1013 | "avg": true, 1014 | "current": false, 1015 | "max": true, 1016 | "min": true, 1017 | "rightSide": true, 1018 | "show": true, 1019 | "total": false, 1020 | "values": true 1021 | }, 1022 | "lines": true, 1023 | "linewidth": 2, 1024 | "links": [], 1025 | "nullPointMode": "connected", 1026 | "percentage": false, 1027 | "pointradius": 5, 1028 | "points": false, 1029 | "renderer": "flot", 1030 | "seriesOverrides": [ 1031 | { 1032 | "alias": "read", 1033 | "yaxis": 1 1034 | }, 1035 | { 1036 | "alias": "written", 1037 | "yaxis": 1 1038 | }, 1039 | { 1040 | "alias": "io time", 1041 | "yaxis": 2 1042 | } 1043 | ], 1044 | "span": 12, 1045 | "stack": false, 1046 | "steppedLine": false, 1047 | "targets": [ 1048 | { 1049 | "expr": "sum(irate(node_disk_read_bytes_total[1m]))", 1050 | "interval": "", 1051 | "intervalFactor": 1, 1052 | "legendFormat": "read", 1053 | "metric": "node_disk_read_bytes_total", 1054 | "refId": "A", 1055 | "step": 1 1056 | }, 1057 | { 1058 | "expr": "sum(irate(node_disk_written_bytes_total[1m]))", 1059 | "intervalFactor": 1, 1060 | "legendFormat": "written", 1061 | "metric": "node_disk_written_bytes_total", 1062 | "refId": "B", 1063 | "step": 1 1064 | }, 1065 | { 1066 | "expr": "sum(irate(node_disk_io_time_seconds_total[1m]))", 1067 | "intervalFactor": 1, 1068 | "legendFormat": "io time", 1069 | "metric": "node_disk_io_time_seconds_total", 1070 | "refId": "C", 1071 | "step": 1 1072 | } 1073 | ], 1074 | "timeFrom": null, 1075 | "timeShift": null, 1076 | "title": "I/O Usage", 1077 | "tooltip": { 1078 | "msResolution": true, 1079 | "shared": true, 1080 | "sort": 0, 1081 | "value_type": "cumulative" 1082 | }, 1083 | "type": "graph", 1084 | "xaxis": { 1085 | "show": true 1086 | }, 1087 | "yaxes": [ 1088 | { 1089 | "format": "Bps", 1090 | "label": null, 1091 | "logBase": 1, 1092 | "max": null, 1093 | "min": 0, 1094 | "show": true 1095 | }, 1096 | { 1097 | "format": "ms", 1098 | "label": null, 1099 | "logBase": 1, 1100 | "max": null, 1101 | "min": null, 1102 | "show": true 1103 | } 1104 | ] 1105 | } 1106 | ], 1107 | "title": "I/O" 1108 | }, 1109 | { 1110 | "collapse": false, 1111 | "editable": true, 1112 | "height": "250px", 1113 | "panels": [ 1114 | { 1115 | "aliasColors": {}, 1116 | "bars": false, 1117 | "datasource": "Prometheus", 1118 | "decimals": 2, 1119 | "editable": true, 1120 | "error": false, 1121 | "fill": 4, 1122 | "grid": { 1123 | "threshold1": null, 1124 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 1125 | "threshold2": null, 1126 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 1127 | }, 1128 | "id": 8, 1129 | "isNew": true, 1130 | "legend": { 1131 | "alignAsTable": true, 1132 | "avg": true, 1133 | "current": false, 1134 | "max": true, 1135 | "min": true, 1136 | "rightSide": true, 1137 | "show": true, 1138 | "total": false, 1139 | "values": true 1140 | }, 1141 | "lines": true, 1142 | "linewidth": 2, 1143 | "links": [], 1144 | "nullPointMode": "connected", 1145 | "percentage": false, 1146 | "pointradius": 5, 1147 | "points": false, 1148 | "renderer": "flot", 1149 | "seriesOverrides": [], 1150 | "span": 12, 1151 | "stack": true, 1152 | "steppedLine": false, 1153 | "targets": [ 1154 | { 1155 | "expr": "irate(node_network_receive_bytes_total{device!=\"lo\"}[1m])", 1156 | "intervalFactor": 1, 1157 | "legendFormat": "In: {{ device }}", 1158 | "metric": "node_network_receive_bytes_total", 1159 | "refId": "A", 1160 | "step": 1 1161 | }, 1162 | { 1163 | "expr": "irate(node_network_transmit_bytes_total{device!=\"lo\"}[1m])", 1164 | "intervalFactor": 1, 1165 | "legendFormat": "Out: {{ device }}", 1166 | "metric": "node_network_transmit_bytes_total", 1167 | "refId": "B", 1168 | "step": 1 1169 | } 1170 | ], 1171 | "timeFrom": null, 1172 | "timeShift": null, 1173 | "title": "Network Usage", 1174 | "tooltip": { 1175 | "msResolution": true, 1176 | "shared": true, 1177 | "sort": 2, 1178 | "value_type": "individual" 1179 | }, 1180 | "type": "graph", 1181 | "xaxis": { 1182 | "show": true 1183 | }, 1184 | "yaxes": [ 1185 | { 1186 | "format": "Bps", 1187 | "label": null, 1188 | "logBase": 1, 1189 | "max": null, 1190 | "min": 0, 1191 | "show": true 1192 | }, 1193 | { 1194 | "format": "short", 1195 | "label": null, 1196 | "logBase": 1, 1197 | "max": null, 1198 | "min": null, 1199 | "show": false 1200 | } 1201 | ] 1202 | } 1203 | ], 1204 | "title": "Network" 1205 | }, 1206 | { 1207 | "collapse": false, 1208 | "editable": true, 1209 | "height": "250px", 1210 | "panels": [ 1211 | { 1212 | "aliasColors": {}, 1213 | "bars": false, 1214 | "datasource": "Prometheus", 1215 | "decimals": 2, 1216 | "editable": true, 1217 | "error": false, 1218 | "fill": 4, 1219 | "grid": { 1220 | "threshold1": null, 1221 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 1222 | "threshold2": null, 1223 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 1224 | }, 1225 | "id": 14, 1226 | "isNew": true, 1227 | "legend": { 1228 | "alignAsTable": true, 1229 | "avg": true, 1230 | "current": false, 1231 | "max": true, 1232 | "min": true, 1233 | "rightSide": false, 1234 | "show": true, 1235 | "total": false, 1236 | "values": true 1237 | }, 1238 | "lines": true, 1239 | "linewidth": 2, 1240 | "links": [], 1241 | "nullPointMode": "connected", 1242 | "percentage": false, 1243 | "pointradius": 5, 1244 | "points": false, 1245 | "renderer": "flot", 1246 | "seriesOverrides": [ 1247 | { 1248 | "alias": "Used", 1249 | "color": "#890F02" 1250 | }, 1251 | { 1252 | "alias": "Free", 1253 | "color": "#7EB26D" 1254 | } 1255 | ], 1256 | "span": 6, 1257 | "stack": true, 1258 | "steppedLine": false, 1259 | "targets": [ 1260 | { 1261 | "expr": "node_memory_SwapTotal_bytes - node_memory_SwapFree_bytes", 1262 | "interval": "10s", 1263 | "intervalFactor": 1, 1264 | "legendFormat": "Used", 1265 | "refId": "A", 1266 | "step": 10 1267 | }, 1268 | { 1269 | "expr": "node_memory_SwapFree_bytes", 1270 | "interval": "10s", 1271 | "intervalFactor": 1, 1272 | "legendFormat": "Free", 1273 | "refId": "B", 1274 | "step": 10 1275 | } 1276 | ], 1277 | "timeFrom": null, 1278 | "timeShift": null, 1279 | "title": "Swap Usage", 1280 | "tooltip": { 1281 | "msResolution": true, 1282 | "shared": true, 1283 | "sort": 2, 1284 | "value_type": "individual" 1285 | }, 1286 | "type": "graph", 1287 | "xaxis": { 1288 | "show": true 1289 | }, 1290 | "yaxes": [ 1291 | { 1292 | "format": "bytes", 1293 | "label": null, 1294 | "logBase": 1, 1295 | "max": null, 1296 | "min": 0, 1297 | "show": true 1298 | }, 1299 | { 1300 | "format": "short", 1301 | "label": null, 1302 | "logBase": 1, 1303 | "max": null, 1304 | "min": null, 1305 | "show": false 1306 | } 1307 | ] 1308 | }, 1309 | { 1310 | "aliasColors": {}, 1311 | "bars": false, 1312 | "datasource": "Prometheus", 1313 | "decimals": 2, 1314 | "editable": true, 1315 | "error": false, 1316 | "fill": 1, 1317 | "grid": { 1318 | "threshold1": null, 1319 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 1320 | "threshold2": null, 1321 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 1322 | }, 1323 | "id": 15, 1324 | "isNew": true, 1325 | "legend": { 1326 | "alignAsTable": true, 1327 | "avg": true, 1328 | "current": false, 1329 | "max": true, 1330 | "min": true, 1331 | "show": true, 1332 | "total": false, 1333 | "values": true 1334 | }, 1335 | "lines": true, 1336 | "linewidth": 2, 1337 | "links": [], 1338 | "nullPointMode": "connected", 1339 | "percentage": false, 1340 | "pointradius": 5, 1341 | "points": false, 1342 | "renderer": "flot", 1343 | "seriesOverrides": [], 1344 | "span": 6, 1345 | "stack": false, 1346 | "steppedLine": false, 1347 | "targets": [ 1348 | { 1349 | "expr": "rate(node_vmstat_pswpin[1m]) * 4096 or irate(node_vmstat_pswpin[5m]) * 4096", 1350 | "interval": "10s", 1351 | "intervalFactor": 1, 1352 | "legendFormat": "In", 1353 | "refId": "A", 1354 | "step": 10 1355 | }, 1356 | { 1357 | "expr": "rate(node_vmstat_pswpout[1m]) * 4096 or irate(node_vmstat_pswpout[5m]) * 4096", 1358 | "interval": "10s", 1359 | "intervalFactor": 1, 1360 | "legendFormat": "Out", 1361 | "refId": "B", 1362 | "step": 10 1363 | } 1364 | ], 1365 | "timeFrom": null, 1366 | "timeShift": null, 1367 | "title": "Swap I/O", 1368 | "tooltip": { 1369 | "msResolution": true, 1370 | "shared": true, 1371 | "sort": 0, 1372 | "value_type": "cumulative" 1373 | }, 1374 | "type": "graph", 1375 | "xaxis": { 1376 | "show": true 1377 | }, 1378 | "yaxes": [ 1379 | { 1380 | "format": "Bps", 1381 | "label": null, 1382 | "logBase": 1, 1383 | "max": null, 1384 | "min": 0, 1385 | "show": true 1386 | }, 1387 | { 1388 | "format": "short", 1389 | "label": null, 1390 | "logBase": 1, 1391 | "max": null, 1392 | "min": null, 1393 | "show": false 1394 | } 1395 | ] 1396 | } 1397 | ], 1398 | "title": "New row" 1399 | } 1400 | ], 1401 | "time": { 1402 | "from": "now-15m", 1403 | "to": "now" 1404 | }, 1405 | "timepicker": { 1406 | "refresh_intervals": [ 1407 | "5s", 1408 | "10s", 1409 | "30s", 1410 | "1m", 1411 | "5m", 1412 | "15m", 1413 | "30m", 1414 | "1h", 1415 | "2h", 1416 | "1d" 1417 | ], 1418 | "time_options": [ 1419 | "5m", 1420 | "15m", 1421 | "1h", 1422 | "6h", 1423 | "12h", 1424 | "24h", 1425 | "2d", 1426 | "7d", 1427 | "30d" 1428 | ] 1429 | }, 1430 | "templating": { 1431 | "list": [] 1432 | }, 1433 | "annotations": { 1434 | "list": [] 1435 | }, 1436 | "refresh": "10s", 1437 | "schemaVersion": 12, 1438 | "version": 2, 1439 | "links": [], 1440 | "gnetId": null 1441 | } -------------------------------------------------------------------------------- /monitoring/grafana/provisioning/dashboards/liquidsoap.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "builtIn": 1, 6 | "datasource": "-- Grafana --", 7 | "enable": true, 8 | "hide": true, 9 | "iconColor": "rgba(0, 211, 255, 1)", 10 | "name": "Annotations & Alerts", 11 | "type": "dashboard" 12 | } 13 | ] 14 | }, 15 | "editable": true, 16 | "gnetId": null, 17 | "graphTooltip": 1, 18 | "id": 5, 19 | "iteration": 1575897465236, 20 | "links": [], 21 | "panels": [ 22 | { 23 | "cacheTimeout": null, 24 | "colorBackground": true, 25 | "colorPrefix": false, 26 | "colorValue": false, 27 | "colors": [ 28 | "#C4162A", 29 | "#C4162A", 30 | "#37872D" 31 | ], 32 | "datasource": null, 33 | "decimals": null, 34 | "description": "Is source $name ready to play", 35 | "format": "none", 36 | "gauge": { 37 | "maxValue": 100, 38 | "minValue": 0, 39 | "show": false, 40 | "thresholdLabels": false, 41 | "thresholdMarkers": true 42 | }, 43 | "gridPos": { 44 | "h": 3, 45 | "w": 8, 46 | "x": 0, 47 | "y": 0 48 | }, 49 | "id": 6, 50 | "interval": null, 51 | "links": [], 52 | "mappingType": 1, 53 | "mappingTypes": [ 54 | { 55 | "name": "value to text", 56 | "value": 1 57 | }, 58 | { 59 | "name": "range to text", 60 | "value": 2 61 | } 62 | ], 63 | "maxDataPoints": 100, 64 | "maxPerRow": 24, 65 | "nullPointMode": "connected", 66 | "nullText": null, 67 | "options": {}, 68 | "postfix": "", 69 | "postfixFontSize": "50%", 70 | "prefix": "", 71 | "prefixFontSize": "50%", 72 | "rangeMaps": [ 73 | { 74 | "from": "null", 75 | "text": "N/A", 76 | "to": "null" 77 | } 78 | ], 79 | "repeat": "name", 80 | "repeatDirection": "h", 81 | "scopedVars": { 82 | "name": { 83 | "selected": false, 84 | "text": "radio_prod", 85 | "value": "radio_prod" 86 | } 87 | }, 88 | "sparkline": { 89 | "fillColor": "rgba(31, 118, 189, 0.18)", 90 | "full": true, 91 | "lineColor": "rgb(31, 120, 193)", 92 | "show": false, 93 | "ymax": null, 94 | "ymin": null 95 | }, 96 | "tableColumn": "", 97 | "targets": [ 98 | { 99 | "expr": "liquidsoap_is_ready{radio=~\"$radio\",type=~\"$type\",name=~\"$name\"}", 100 | "instant": true, 101 | "legendFormat": "{{name}}", 102 | "refId": "A" 103 | } 104 | ], 105 | "thresholds": "0,1", 106 | "timeFrom": null, 107 | "timeShift": null, 108 | "title": "$name Is Ready", 109 | "transparent": true, 110 | "type": "singlestat", 111 | "valueFontSize": "100%", 112 | "valueMaps": [ 113 | { 114 | "op": "=", 115 | "text": "yes", 116 | "value": "1" 117 | }, 118 | { 119 | "op": "=", 120 | "text": "no", 121 | "value": "0" 122 | } 123 | ], 124 | "valueName": "current" 125 | }, 126 | { 127 | "cacheTimeout": null, 128 | "colorBackground": true, 129 | "colorPrefix": false, 130 | "colorValue": false, 131 | "colors": [ 132 | "#C4162A", 133 | "#C4162A", 134 | "#37872D" 135 | ], 136 | "datasource": null, 137 | "decimals": null, 138 | "description": "Is source $name ready to play", 139 | "format": "none", 140 | "gauge": { 141 | "maxValue": 100, 142 | "minValue": 0, 143 | "show": false, 144 | "thresholdLabels": false, 145 | "thresholdMarkers": true 146 | }, 147 | "gridPos": { 148 | "h": 3, 149 | "w": 8, 150 | "x": 8, 151 | "y": 0 152 | }, 153 | "id": 13, 154 | "interval": null, 155 | "links": [], 156 | "mappingType": 1, 157 | "mappingTypes": [ 158 | { 159 | "name": "value to text", 160 | "value": 1 161 | }, 162 | { 163 | "name": "range to text", 164 | "value": 2 165 | } 166 | ], 167 | "maxDataPoints": 100, 168 | "maxPerRow": 24, 169 | "nullPointMode": "connected", 170 | "nullText": null, 171 | "options": {}, 172 | "postfix": "", 173 | "postfixFontSize": "50%", 174 | "prefix": "", 175 | "prefixFontSize": "50%", 176 | "rangeMaps": [ 177 | { 178 | "from": "null", 179 | "text": "N/A", 180 | "to": "null" 181 | } 182 | ], 183 | "repeat": null, 184 | "repeatDirection": "h", 185 | "repeatIteration": 1575897465236, 186 | "repeatPanelId": 6, 187 | "scopedVars": { 188 | "name": { 189 | "selected": false, 190 | "text": "srt1", 191 | "value": "srt1" 192 | } 193 | }, 194 | "sparkline": { 195 | "fillColor": "rgba(31, 118, 189, 0.18)", 196 | "full": true, 197 | "lineColor": "rgb(31, 120, 193)", 198 | "show": false, 199 | "ymax": null, 200 | "ymin": null 201 | }, 202 | "tableColumn": "", 203 | "targets": [ 204 | { 205 | "expr": "liquidsoap_is_ready{radio=~\"$radio\",type=~\"$type\",name=~\"$name\"}", 206 | "instant": true, 207 | "legendFormat": "{{name}}", 208 | "refId": "A" 209 | } 210 | ], 211 | "thresholds": "0,1", 212 | "timeFrom": null, 213 | "timeShift": null, 214 | "title": "$name Is Ready", 215 | "transparent": true, 216 | "type": "singlestat", 217 | "valueFontSize": "100%", 218 | "valueMaps": [ 219 | { 220 | "op": "=", 221 | "text": "yes", 222 | "value": "1" 223 | }, 224 | { 225 | "op": "=", 226 | "text": "no", 227 | "value": "0" 228 | } 229 | ], 230 | "valueName": "current" 231 | }, 232 | { 233 | "cacheTimeout": null, 234 | "colorBackground": true, 235 | "colorPrefix": false, 236 | "colorValue": false, 237 | "colors": [ 238 | "#C4162A", 239 | "#C4162A", 240 | "#37872D" 241 | ], 242 | "datasource": null, 243 | "decimals": null, 244 | "description": "Is source $name ready to play", 245 | "format": "none", 246 | "gauge": { 247 | "maxValue": 100, 248 | "minValue": 0, 249 | "show": false, 250 | "thresholdLabels": false, 251 | "thresholdMarkers": true 252 | }, 253 | "gridPos": { 254 | "h": 3, 255 | "w": 8, 256 | "x": 16, 257 | "y": 0 258 | }, 259 | "id": 14, 260 | "interval": null, 261 | "links": [], 262 | "mappingType": 1, 263 | "mappingTypes": [ 264 | { 265 | "name": "value to text", 266 | "value": 1 267 | }, 268 | { 269 | "name": "range to text", 270 | "value": 2 271 | } 272 | ], 273 | "maxDataPoints": 100, 274 | "maxPerRow": 24, 275 | "nullPointMode": "connected", 276 | "nullText": null, 277 | "options": {}, 278 | "postfix": "", 279 | "postfixFontSize": "50%", 280 | "prefix": "", 281 | "prefixFontSize": "50%", 282 | "rangeMaps": [ 283 | { 284 | "from": "null", 285 | "text": "N/A", 286 | "to": "null" 287 | } 288 | ], 289 | "repeat": null, 290 | "repeatDirection": "h", 291 | "repeatIteration": 1575897465236, 292 | "repeatPanelId": 6, 293 | "scopedVars": { 294 | "name": { 295 | "selected": false, 296 | "text": "srt2", 297 | "value": "srt2" 298 | } 299 | }, 300 | "sparkline": { 301 | "fillColor": "rgba(31, 118, 189, 0.18)", 302 | "full": true, 303 | "lineColor": "rgb(31, 120, 193)", 304 | "show": false, 305 | "ymax": null, 306 | "ymin": null 307 | }, 308 | "tableColumn": "", 309 | "targets": [ 310 | { 311 | "expr": "liquidsoap_is_ready{radio=~\"$radio\",type=~\"$type\",name=~\"$name\"}", 312 | "instant": true, 313 | "legendFormat": "{{name}}", 314 | "refId": "A" 315 | } 316 | ], 317 | "thresholds": "0,1", 318 | "timeFrom": null, 319 | "timeShift": null, 320 | "title": "$name Is Ready", 321 | "transparent": true, 322 | "type": "singlestat", 323 | "valueFontSize": "100%", 324 | "valueMaps": [ 325 | { 326 | "op": "=", 327 | "text": "yes", 328 | "value": "1" 329 | }, 330 | { 331 | "op": "=", 332 | "text": "no", 333 | "value": "0" 334 | } 335 | ], 336 | "valueName": "current" 337 | }, 338 | { 339 | "cacheTimeout": null, 340 | "colorBackground": false, 341 | "colorPrefix": false, 342 | "colorValue": false, 343 | "colors": [ 344 | "#299c46", 345 | "rgba(237, 129, 40, 0.89)", 346 | "#d44a3a" 347 | ], 348 | "datasource": null, 349 | "decimals": null, 350 | "description": "The real live source playing", 351 | "format": "none", 352 | "gauge": { 353 | "maxValue": 100, 354 | "minValue": 0, 355 | "show": false, 356 | "thresholdLabels": false, 357 | "thresholdMarkers": true 358 | }, 359 | "gridPos": { 360 | "h": 3, 361 | "w": 5, 362 | "x": 0, 363 | "y": 3 364 | }, 365 | "id": 3, 366 | "interval": null, 367 | "links": [], 368 | "mappingType": 1, 369 | "mappingTypes": [ 370 | { 371 | "name": "value to text", 372 | "value": 1 373 | }, 374 | { 375 | "name": "range to text", 376 | "value": 2 377 | } 378 | ], 379 | "maxDataPoints": 100, 380 | "nullPointMode": "connected", 381 | "nullText": null, 382 | "options": {}, 383 | "postfix": "", 384 | "postfixFontSize": "50%", 385 | "prefix": "", 386 | "prefixFontSize": "50%", 387 | "rangeMaps": [ 388 | { 389 | "from": "null", 390 | "text": "N/A", 391 | "to": "null" 392 | } 393 | ], 394 | "sparkline": { 395 | "fillColor": "rgba(31, 118, 189, 0.18)", 396 | "full": true, 397 | "lineColor": "rgb(31, 120, 193)", 398 | "show": false, 399 | "ymax": null, 400 | "ymin": null 401 | }, 402 | "tableColumn": "", 403 | "targets": [ 404 | { 405 | "expr": "liquidsoap_is_playing{radio=~\"$radio\"} > 0", 406 | "instant": true, 407 | "legendFormat": "{{name}}", 408 | "refId": "A" 409 | } 410 | ], 411 | "thresholds": "", 412 | "timeFrom": null, 413 | "timeShift": null, 414 | "title": "Now playing", 415 | "type": "singlestat", 416 | "valueFontSize": "100%", 417 | "valueMaps": [], 418 | "valueName": "name" 419 | }, 420 | { 421 | "cacheTimeout": null, 422 | "colorBackground": false, 423 | "colorPrefix": false, 424 | "colorValue": false, 425 | "colors": [ 426 | "#299c46", 427 | "rgba(237, 129, 40, 0.89)", 428 | "#d44a3a" 429 | ], 430 | "datasource": null, 431 | "decimals": null, 432 | "description": "The preferred live source to play", 433 | "format": "none", 434 | "gauge": { 435 | "maxValue": 100, 436 | "minValue": 0, 437 | "show": false, 438 | "thresholdLabels": false, 439 | "thresholdMarkers": true 440 | }, 441 | "gridPos": { 442 | "h": 3, 443 | "w": 5, 444 | "x": 5, 445 | "y": 3 446 | }, 447 | "id": 12, 448 | "interval": null, 449 | "links": [], 450 | "mappingType": 1, 451 | "mappingTypes": [ 452 | { 453 | "name": "value to text", 454 | "value": 1 455 | }, 456 | { 457 | "name": "range to text", 458 | "value": 2 459 | } 460 | ], 461 | "maxDataPoints": 100, 462 | "nullPointMode": "connected", 463 | "nullText": null, 464 | "options": {}, 465 | "postfix": "", 466 | "postfixFontSize": "50%", 467 | "prefix": "", 468 | "prefixFontSize": "50%", 469 | "rangeMaps": [ 470 | { 471 | "from": "null", 472 | "text": "N/A", 473 | "to": "null" 474 | } 475 | ], 476 | "sparkline": { 477 | "fillColor": "rgba(31, 118, 189, 0.18)", 478 | "full": true, 479 | "lineColor": "rgb(31, 120, 193)", 480 | "show": false, 481 | "ymax": null, 482 | "ymin": null 483 | }, 484 | "tableColumn": "", 485 | "targets": [ 486 | { 487 | "expr": "liquidsoap_is_preferred_livesource{radio=~\"$radio\"} > 0", 488 | "instant": true, 489 | "legendFormat": "{{name}}", 490 | "refId": "A" 491 | } 492 | ], 493 | "thresholds": "", 494 | "timeFrom": null, 495 | "timeShift": null, 496 | "title": "Preferred Live Source", 497 | "type": "singlestat", 498 | "valueFontSize": "100%", 499 | "valueMaps": [], 500 | "valueName": "name" 501 | }, 502 | { 503 | "cacheTimeout": null, 504 | "colorBackground": true, 505 | "colorPrefix": false, 506 | "colorValue": false, 507 | "colors": [ 508 | "#37872D", 509 | "#C4162A", 510 | "#C4162A" 511 | ], 512 | "datasource": null, 513 | "decimals": null, 514 | "description": "Is the output brodcasting blank audio", 515 | "format": "none", 516 | "gauge": { 517 | "maxValue": 100, 518 | "minValue": 0, 519 | "show": false, 520 | "thresholdLabels": false, 521 | "thresholdMarkers": true 522 | }, 523 | "gridPos": { 524 | "h": 3, 525 | "w": 5, 526 | "x": 10, 527 | "y": 3 528 | }, 529 | "id": 9, 530 | "interval": null, 531 | "links": [], 532 | "mappingType": 1, 533 | "mappingTypes": [ 534 | { 535 | "name": "value to text", 536 | "value": 1 537 | }, 538 | { 539 | "name": "range to text", 540 | "value": 2 541 | } 542 | ], 543 | "maxDataPoints": 100, 544 | "nullPointMode": "connected", 545 | "nullText": null, 546 | "options": {}, 547 | "postfix": "", 548 | "postfixFontSize": "50%", 549 | "prefix": "", 550 | "prefixFontSize": "50%", 551 | "rangeMaps": [ 552 | { 553 | "from": "null", 554 | "text": "N/A", 555 | "to": "null" 556 | } 557 | ], 558 | "sparkline": { 559 | "fillColor": "rgba(31, 118, 189, 0.18)", 560 | "full": true, 561 | "lineColor": "rgb(31, 120, 193)", 562 | "show": false, 563 | "ymax": null, 564 | "ymin": null 565 | }, 566 | "tableColumn": "", 567 | "targets": [ 568 | { 569 | "expr": "liquidsoap_is_blank{radio=~\"$radio\"}", 570 | "instant": true, 571 | "legendFormat": "{{name}}", 572 | "refId": "A" 573 | } 574 | ], 575 | "thresholds": "0.1,0.2", 576 | "timeFrom": null, 577 | "timeShift": null, 578 | "title": "Is output blank", 579 | "transparent": true, 580 | "type": "singlestat", 581 | "valueFontSize": "100%", 582 | "valueMaps": [ 583 | { 584 | "op": "=", 585 | "text": "no", 586 | "value": "0" 587 | }, 588 | { 589 | "op": "=", 590 | "text": "yes", 591 | "value": "1" 592 | } 593 | ], 594 | "valueName": "current" 595 | }, 596 | { 597 | "aliasColors": {}, 598 | "bars": true, 599 | "dashLength": 10, 600 | "dashes": false, 601 | "datasource": null, 602 | "decimals": 0, 603 | "description": "0 = source is not playling\n1 = source is playling", 604 | "fill": 1, 605 | "fillGradient": 0, 606 | "gridPos": { 607 | "h": 8, 608 | "w": 24, 609 | "x": 0, 610 | "y": 6 611 | }, 612 | "hiddenSeries": false, 613 | "id": 2, 614 | "legend": { 615 | "alignAsTable": true, 616 | "avg": false, 617 | "current": false, 618 | "hideEmpty": false, 619 | "hideZero": false, 620 | "max": false, 621 | "min": false, 622 | "rightSide": true, 623 | "show": true, 624 | "total": false, 625 | "values": false 626 | }, 627 | "lines": false, 628 | "linewidth": 1, 629 | "nullPointMode": "null", 630 | "options": { 631 | "dataLinks": [] 632 | }, 633 | "percentage": false, 634 | "pointradius": 2, 635 | "points": false, 636 | "renderer": "flot", 637 | "seriesOverrides": [], 638 | "spaceLength": 10, 639 | "stack": false, 640 | "steppedLine": false, 641 | "targets": [ 642 | { 643 | "expr": "liquidsoap_is_playing{radio=~\"$radio\"}", 644 | "legendFormat": "{{type}} {{name}}", 645 | "refId": "A" 646 | } 647 | ], 648 | "thresholds": [], 649 | "timeFrom": null, 650 | "timeRegions": [], 651 | "timeShift": null, 652 | "title": "Output source playing history", 653 | "tooltip": { 654 | "shared": true, 655 | "sort": 0, 656 | "value_type": "individual" 657 | }, 658 | "transparent": true, 659 | "type": "graph", 660 | "xaxis": { 661 | "buckets": null, 662 | "mode": "time", 663 | "name": null, 664 | "show": true, 665 | "values": [] 666 | }, 667 | "yaxes": [ 668 | { 669 | "decimals": 0, 670 | "format": "short", 671 | "label": "", 672 | "logBase": 1, 673 | "max": "1", 674 | "min": "0", 675 | "show": true 676 | }, 677 | { 678 | "format": "short", 679 | "label": "", 680 | "logBase": 1, 681 | "max": null, 682 | "min": null, 683 | "show": true 684 | } 685 | ], 686 | "yaxis": { 687 | "align": false, 688 | "alignLevel": null 689 | } 690 | }, 691 | { 692 | "aliasColors": {}, 693 | "bars": false, 694 | "dashLength": 10, 695 | "dashes": false, 696 | "datasource": null, 697 | "decimals": 0, 698 | "description": "0 = source unready\n1 = source ready", 699 | "fill": 1, 700 | "fillGradient": 0, 701 | "gridPos": { 702 | "h": 7, 703 | "w": 24, 704 | "x": 0, 705 | "y": 14 706 | }, 707 | "hiddenSeries": false, 708 | "id": 4, 709 | "legend": { 710 | "alignAsTable": true, 711 | "avg": false, 712 | "current": false, 713 | "hideEmpty": false, 714 | "hideZero": false, 715 | "max": false, 716 | "min": false, 717 | "rightSide": true, 718 | "show": true, 719 | "total": false, 720 | "values": false 721 | }, 722 | "lines": true, 723 | "linewidth": 1, 724 | "nullPointMode": "null", 725 | "options": { 726 | "dataLinks": [] 727 | }, 728 | "percentage": false, 729 | "pointradius": 2, 730 | "points": false, 731 | "renderer": "flot", 732 | "seriesOverrides": [], 733 | "spaceLength": 10, 734 | "stack": false, 735 | "steppedLine": false, 736 | "targets": [ 737 | { 738 | "expr": "liquidsoap_is_ready{radio=~\"$radio\",type=~\"$type\",name=~\"$name\"}", 739 | "legendFormat": "{{type}} {{name}}", 740 | "refId": "A" 741 | } 742 | ], 743 | "thresholds": [], 744 | "timeFrom": null, 745 | "timeRegions": [], 746 | "timeShift": null, 747 | "title": "Input / Output Ready", 748 | "tooltip": { 749 | "shared": true, 750 | "sort": 0, 751 | "value_type": "individual" 752 | }, 753 | "transparent": true, 754 | "type": "graph", 755 | "xaxis": { 756 | "buckets": null, 757 | "mode": "time", 758 | "name": null, 759 | "show": true, 760 | "values": [] 761 | }, 762 | "yaxes": [ 763 | { 764 | "decimals": 0, 765 | "format": "short", 766 | "label": "", 767 | "logBase": 1, 768 | "max": "1", 769 | "min": "0", 770 | "show": true 771 | }, 772 | { 773 | "decimals": null, 774 | "format": "short", 775 | "label": "", 776 | "logBase": 1, 777 | "max": null, 778 | "min": null, 779 | "show": true 780 | } 781 | ], 782 | "yaxis": { 783 | "align": false, 784 | "alignLevel": null 785 | } 786 | }, 787 | { 788 | "aliasColors": {}, 789 | "bars": false, 790 | "dashLength": 10, 791 | "dashes": false, 792 | "datasource": null, 793 | "decimals": 0, 794 | "description": "0 = source unready\n1 = source ready", 795 | "fill": 1, 796 | "fillGradient": 0, 797 | "gridPos": { 798 | "h": 7, 799 | "w": 24, 800 | "x": 0, 801 | "y": 21 802 | }, 803 | "hiddenSeries": false, 804 | "id": 5, 805 | "legend": { 806 | "alignAsTable": true, 807 | "avg": false, 808 | "current": false, 809 | "hideEmpty": false, 810 | "hideZero": false, 811 | "max": false, 812 | "min": false, 813 | "rightSide": true, 814 | "show": true, 815 | "total": false, 816 | "values": false 817 | }, 818 | "lines": true, 819 | "linewidth": 1, 820 | "nullPointMode": "null", 821 | "options": { 822 | "dataLinks": [] 823 | }, 824 | "percentage": false, 825 | "pointradius": 2, 826 | "points": false, 827 | "renderer": "flot", 828 | "seriesOverrides": [], 829 | "spaceLength": 10, 830 | "stack": false, 831 | "steppedLine": false, 832 | "targets": [ 833 | { 834 | "expr": "rate(liquidsoap_duration_unready_seconds{radio=~\"$radio\",type=~\"$type\",name=~\"$name\"}[1m])", 835 | "legendFormat": "{{type}} {{name}}", 836 | "refId": "A" 837 | } 838 | ], 839 | "thresholds": [], 840 | "timeFrom": null, 841 | "timeRegions": [], 842 | "timeShift": null, 843 | "title": "Input / Output Duration Unready per second", 844 | "tooltip": { 845 | "shared": true, 846 | "sort": 0, 847 | "value_type": "individual" 848 | }, 849 | "transparent": true, 850 | "type": "graph", 851 | "xaxis": { 852 | "buckets": null, 853 | "mode": "time", 854 | "name": null, 855 | "show": true, 856 | "values": [] 857 | }, 858 | "yaxes": [ 859 | { 860 | "decimals": null, 861 | "format": "short", 862 | "label": "", 863 | "logBase": 1, 864 | "max": null, 865 | "min": null, 866 | "show": true 867 | }, 868 | { 869 | "decimals": null, 870 | "format": "short", 871 | "label": "", 872 | "logBase": 1, 873 | "max": null, 874 | "min": null, 875 | "show": true 876 | } 877 | ], 878 | "yaxis": { 879 | "align": false, 880 | "alignLevel": null 881 | } 882 | } 883 | ], 884 | "refresh": "5s", 885 | "schemaVersion": 21, 886 | "style": "dark", 887 | "tags": [], 888 | "templating": { 889 | "list": [ 890 | { 891 | "allValue": ".*", 892 | "current": { 893 | "text": "All", 894 | "value": [ 895 | "$__all" 896 | ] 897 | }, 898 | "datasource": "Prometheus", 899 | "definition": "label_values(liquidsoap_is_ready,radio)", 900 | "hide": 0, 901 | "includeAll": true, 902 | "label": "Radio", 903 | "multi": true, 904 | "name": "radio", 905 | "options": [], 906 | "query": "label_values(liquidsoap_is_ready,radio)", 907 | "refresh": 1, 908 | "regex": "", 909 | "skipUrlSync": false, 910 | "sort": 1, 911 | "tagValuesQuery": "", 912 | "tags": [], 913 | "tagsQuery": "", 914 | "type": "query", 915 | "useTags": false 916 | }, 917 | { 918 | "allValue": ".*", 919 | "current": { 920 | "text": "All", 921 | "value": [ 922 | "$__all" 923 | ] 924 | }, 925 | "datasource": "Prometheus", 926 | "definition": "label_values(liquidsoap_is_ready,type)", 927 | "hide": 0, 928 | "includeAll": true, 929 | "label": "Type", 930 | "multi": true, 931 | "name": "type", 932 | "options": [], 933 | "query": "label_values(liquidsoap_is_ready,type)", 934 | "refresh": 1, 935 | "regex": "", 936 | "skipUrlSync": false, 937 | "sort": 1, 938 | "tagValuesQuery": "", 939 | "tags": [], 940 | "tagsQuery": "", 941 | "type": "query", 942 | "useTags": false 943 | }, 944 | { 945 | "allValue": ".*", 946 | "current": { 947 | "selected": false, 948 | "tags": [], 949 | "text": "All", 950 | "value": "$__all" 951 | }, 952 | "datasource": "Prometheus", 953 | "definition": "label_values(liquidsoap_is_ready,name)", 954 | "hide": 0, 955 | "includeAll": true, 956 | "label": "Name", 957 | "multi": false, 958 | "name": "name", 959 | "options": [], 960 | "query": "label_values(liquidsoap_is_ready,name)", 961 | "refresh": 1, 962 | "regex": "", 963 | "skipUrlSync": false, 964 | "sort": 1, 965 | "tagValuesQuery": "", 966 | "tags": [], 967 | "tagsQuery": "", 968 | "type": "query", 969 | "useTags": false 970 | } 971 | ] 972 | }, 973 | "time": { 974 | "from": "now-1h", 975 | "to": "now" 976 | }, 977 | "timepicker": { 978 | "refresh_intervals": [ 979 | "5s", 980 | "10s", 981 | "30s", 982 | "1m", 983 | "5m", 984 | "15m", 985 | "30m", 986 | "1h", 987 | "2h", 988 | "1d" 989 | ] 990 | }, 991 | "timezone": "", 992 | "title": "Liquidsoap", 993 | "uid": "JmOXCPaWz", 994 | "version": 3 995 | } -------------------------------------------------------------------------------- /monitoring/grafana/provisioning/datasources/datasource.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | datasources: 4 | - name: Prometheus 5 | type: prometheus 6 | access: proxy 7 | orgId: 1 8 | url: http://prometheus:9090 9 | basicAuth: false 10 | isDefault: true 11 | editable: true -------------------------------------------------------------------------------- /monitoring/prometheus/alert.rules: -------------------------------------------------------------------------------- 1 | groups: 2 | - name: targets 3 | rules: 4 | - alert: monitor_service_down 5 | expr: up == 0 6 | for: 30s 7 | labels: 8 | severity: critical 9 | annotations: 10 | summary: "Monitor service non-operational" 11 | description: "Service {{ $labels.instance }} is down." 12 | 13 | - name: host 14 | rules: 15 | - alert: high_cpu_load 16 | expr: node_load1 > 1.5 17 | for: 30s 18 | labels: 19 | severity: warning 20 | annotations: 21 | summary: "Server under high load" 22 | description: "Docker host is under high load, the avg load 1m is at {{ $value}}. Reported by instance {{ $labels.instance }} of job {{ $labels.job }}." 23 | 24 | - alert: high_memory_load 25 | expr: (sum(node_memory_MemTotal_bytes) - sum(node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes) ) / sum(node_memory_MemTotal_bytes) * 100 > 85 26 | for: 30s 27 | labels: 28 | severity: warning 29 | annotations: 30 | summary: "Server memory is almost full" 31 | description: "Docker host memory usage is {{ humanize $value}}%. Reported by instance {{ $labels.instance }} of job {{ $labels.job }}." 32 | 33 | - alert: high_storage_load 34 | expr: (node_filesystem_size_bytes{fstype="aufs"} - node_filesystem_free_bytes{fstype="aufs"}) / node_filesystem_size_bytes{fstype="aufs"} * 100 > 85 35 | for: 30s 36 | labels: 37 | severity: warning 38 | annotations: 39 | summary: "Server storage is almost full" 40 | description: "Docker host storage usage is {{ humanize $value}}%. Reported by instance {{ $labels.instance }} of job {{ $labels.job }}." 41 | -------------------------------------------------------------------------------- /monitoring/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s 3 | evaluation_interval: 15s 4 | 5 | rule_files: 6 | - "alert.rules" 7 | 8 | scrape_configs: 9 | - job_name: 'liquidsoap' 10 | scrape_interval: 5s 11 | static_configs: 12 | - targets: ['liquidsoap:9090'] 13 | 14 | - job_name: 'cadvisor' 15 | scrape_interval: 5s 16 | static_configs: 17 | - targets: ['cadvisor:8080'] 18 | 19 | - job_name: 'prometheus' 20 | scrape_interval: 10s 21 | static_configs: 22 | - targets: ['localhost:9090'] 23 | 24 | - job_name: 'nodeexporter' 25 | scrape_interval: 5s 26 | static_configs: 27 | - targets: ['nodeexporter:9100'] 28 | 29 | alerting: 30 | alertmanagers: 31 | - scheme: http 32 | static_configs: 33 | - targets: 34 | - 'alertmanager:9093' 35 | -------------------------------------------------------------------------------- /nginxhls/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:buster-slim 2 | 3 | RUN apt-get update \ 4 | && apt-get install -y \ 5 | nginx-extras \ 6 | dumb-init \ 7 | && rm -rf /var/lib/apt/lists/* 8 | 9 | COPY nginx.conf /etc/nginx/nginx.conf 10 | 11 | ENTRYPOINT ["/usr/bin/dumb-init", "--"] 12 | 13 | CMD ["nginx"] 14 | -------------------------------------------------------------------------------- /nginxhls/nginx.conf: -------------------------------------------------------------------------------- 1 | user www-data; 2 | worker_processes auto; 3 | pid /run/nginx.pid; 4 | error_log stderr info; 5 | daemon off; 6 | 7 | load_module modules/ndk_http_module.so; 8 | 9 | events { 10 | worker_connections 4096; 11 | multi_accept on; 12 | use epoll; 13 | } 14 | 15 | http { 16 | 17 | ## 18 | # Basic Settings 19 | ## 20 | 21 | sendfile on; 22 | tcp_nopush on; 23 | tcp_nodelay on; 24 | keepalive_timeout 60; 25 | types_hash_max_size 2048; 26 | server_tokens off; 27 | ## 28 | # Adjust client timeouts 29 | ## 30 | 31 | client_body_buffer_size 1m; 32 | client_body_timeout 15; 33 | client_header_timeout 15; 34 | send_timeout 15; 35 | 36 | include /etc/nginx/mime.types; 37 | default_type application/octet-stream; 38 | 39 | ## 40 | # Logging Settings 41 | ## 42 | 43 | log_format json_combined escape=json 44 | '{' 45 | '"time_local":"$time_local",' 46 | '"remote_addr":"$remote_addr",' 47 | '"remote_user":"$remote_user",' 48 | '"request":"$request",' 49 | '"status": "$status",' 50 | '"body_bytes_sent":"$body_bytes_sent",' 51 | '"request_time":"$request_time",' 52 | '"http_referrer":"$http_referer",' 53 | '"http_user_agent":"$http_user_agent"' 54 | '}'; 55 | 56 | access_log /proc/self/fd/1 json_combined; 57 | error_log /proc/self/fd/2; 58 | 59 | gzip on; 60 | gzip_vary on; 61 | gzip_proxied any; 62 | gzip_types application/vnd.apple.mpegurl video/mp2t; 63 | 64 | include conf.d/*.conf; 65 | 66 | } -------------------------------------------------------------------------------- /nginxhls/stream.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | server_name _; 5 | 6 | location /healthz { 7 | access_log off; 8 | return 200; 9 | } 10 | 11 | location /api { 12 | add_header Allow "GET" always; 13 | if ( $request_method !~ ^(GET)$ ) { 14 | return 405; 15 | } 16 | rewrite /api/(.*) /$1 break; 17 | proxy_pass http://liquidsoap:8081; 18 | proxy_redirect off; 19 | proxy_set_header Host $host; 20 | } 21 | 22 | types { 23 | application/vnd.apple.mpegurl m3u8; 24 | video/mp2t ts; 25 | } 26 | 27 | location ~ \.(ts|m3u8)$ { 28 | add_header Allow "GET, HEAD" always; 29 | if ( $request_method !~ ^(GET|HEAD)$ ) { 30 | return 405; 31 | } 32 | 33 | root /hls; 34 | 35 | add_header 'Access-Control-Allow-Origin' '*'; 36 | add_header 'Access-Control-Allow-Methods' 'GET'; 37 | add_header 'Access-Control-Allow-Headers' '*'; 38 | 39 | location ~ \.(ts)$ { 40 | add_header 'Cache-Control' 'public, max-age=31536000'; 41 | } 42 | 43 | location ~ (lofi|midfi|hifi)\.(m3u8)$ { 44 | add_header 'Cache-Control' 'max-age=1'; 45 | } 46 | 47 | location ~ \.(m3u8)$ { 48 | add_header 'Cache-Control' 'max-age=600'; 49 | } 50 | } 51 | 52 | location / { 53 | return 404; 54 | } 55 | } -------------------------------------------------------------------------------- /radio.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import argparse 4 | import sys 5 | import telnetlib 6 | 7 | 8 | def remove_last_line_from_string(s): 9 | return s[:s.rfind('\n')] 10 | 11 | 12 | def send_tn_command(port, command, parameters=""): 13 | try: 14 | tn = telnetlib.Telnet(host="127.0.0.1", port=port) 15 | except Exception: 16 | sys.exit("Failed to connect to telnet server, is liquidsoap running ?") 17 | 18 | tn.write((command + " " + parameters + "\n").encode('ascii')) 19 | tn.write(b"exit\n") 20 | 21 | return remove_last_line_from_string(tn.read_until(b"\nEND").decode('ascii')) 22 | 23 | 24 | if __name__ == '__main__': 25 | parser = argparse.ArgumentParser() 26 | parser.add_argument("port", help="telnet port") 27 | parser.add_argument("command", help="") 28 | parser.add_argument("parameter", nargs='?', default="", help="command parameter") 29 | 30 | args = parser.parse_args() 31 | 32 | print(send_tn_command(args.port, args.command, args.parameter)) 33 | -------------------------------------------------------------------------------- /radio/live.liq: -------------------------------------------------------------------------------- 1 | #!/usr/bin/liquidsoap 2 | 3 | # General settings 4 | settings.log.level.set(3) 5 | settings.log.stdout.set(true) 6 | 7 | # Telnet server settings 8 | 9 | settings.server.telnet.bind_addr.set("0.0.0.0") 10 | settings.server.telnet.port.set(8500) 11 | settings.server.telnet.set(true) 12 | 13 | # Harbor HTTP server settings 14 | settings.harbor.bind_addrs.set(["0.0.0.0"]) 15 | settings.harbor.max_connections.set(10) 16 | settings.harbor.timeout.set(10.) 17 | settings.harbor.verbose.set(false) 18 | 19 | # Prometheus settings 20 | settings.prometheus.server.set(true) 21 | settings.prometheus.server.port.set(9090) 22 | 23 | # Audio settings 24 | 25 | settings.frame.audio.samplerate.set(44100) 26 | settings.frame.audio.channels.set(2) 27 | settings.audio.converter.samplerate.libsamplerate.quality.set("fast") 28 | 29 | # Clocks settings 30 | settings.root.max_latency.set(5.) 31 | settings.clock.allow_streaming_errors.set(false) 32 | 33 | # Retrieve configuration from environment 34 | 35 | hlspath = ref(getenv("HLSPATH")) 36 | 37 | if !hlspath == "" then 38 | hlspath := "/hls" 39 | end 40 | 41 | ### Define Prometheus metrics 42 | 43 | latency_metric = prometheus.latency(labels=["radio","type","name"]) 44 | is_ready_metric = prometheus.gauge(labels=["radio","type","name"],help="is source ready?","liquidsoap_is_ready") 45 | is_playing_metric = prometheus.gauge(labels=["radio","type","name"],help="is source playing?","liquidsoap_is_playing") 46 | is_preferred_livesource_metric = prometheus.gauge(labels=["radio","type","name"],help="is source is the preferred livesource?","liquidsoap_is_preferred_livesource") 47 | duration_unready_seconds_metric = prometheus.counter(labels=["radio","type","name"],help="Cumulative duration in seconds of the source in unreadystate","liquidsoap_duration_unready_seconds") 48 | is_blank_metric = prometheus.gauge(labels=["radio","type","name"],help="is source blank?","liquidsoap_is_blank") 49 | 50 | # Prometheus metrics helpers 51 | def check_if_ready(set_is_ready, increase_duration_unready_seconds, s) = 52 | def callback() = 53 | if s.is_ready() then 54 | set_is_ready(1.) 55 | else 56 | set_is_ready(0.) 57 | increase_duration_unready_seconds(0.1) 58 | end 59 | 0.1 60 | end 61 | callback 62 | end 63 | 64 | def source_tag(s,tag) = 65 | def f(_) 66 | [("source_tag",tag)] 67 | end 68 | map_metadata(insert_missing=true,f,s) 69 | end 70 | 71 | ### END Define Prometheus metrics 72 | 73 | ### Inputs 74 | 75 | preferred_live_source = ref("srt1") 76 | 77 | def check_if_preferred_livesource(set_is_preferred_livesource, source) = 78 | def callback() = 79 | if !preferred_live_source == source then 80 | set_is_preferred_livesource(1.) 81 | else 82 | set_is_preferred_livesource(0.) 83 | end 84 | 0.1 85 | end 86 | callback 87 | end 88 | 89 | srt1 = input.srt(id="input_srt1", 90 | port=10000) 91 | 92 | # Get metrics 93 | latency_metric(label_values=["default","input","srt1"],srt1) 94 | set_is_ready = is_ready_metric(label_values=["default","input","srt1"]) 95 | increase_duration_unready_seconds = duration_unready_seconds_metric(label_values=["default","input","srt1"]) 96 | thread.run.recurrent(delay=0.,check_if_ready(set_is_ready, increase_duration_unready_seconds, srt1)) 97 | set_is_playing_srt1 = is_playing_metric(label_values=["default","input","srt1"]) 98 | set_is_preferred_livesource = is_preferred_livesource_metric(label_values=["default","input","srt1"]) 99 | thread.run.recurrent(delay=0.,check_if_preferred_livesource(set_is_preferred_livesource,"srt1")) 100 | 101 | # Wrap input in a buffer 102 | srt1 = buffer(id="buffer_srt1", 103 | fallible=true, 104 | max=3.0, 105 | srt1) 106 | 107 | # Tag source with it's name in metadata 108 | srt1 = source_tag(srt1, "srt1") 109 | 110 | srt2 = input.srt(id="input_srt2", 111 | port=10001) 112 | 113 | # Get metrics 114 | latency_metric(label_values=["default","input","srt2"],srt2) 115 | set_is_ready = is_ready_metric(label_values=["default","input","srt2"]) 116 | increase_duration_unready_seconds = duration_unready_seconds_metric(label_values=["default","input","srt2"]) 117 | thread.run.recurrent(delay=0.,check_if_ready(set_is_ready, increase_duration_unready_seconds, srt2)) 118 | set_is_playing_srt2 = is_playing_metric(label_values=["default","input","srt2"]) 119 | set_is_preferred_livesource = is_preferred_livesource_metric(label_values=["default","input","srt2"]) 120 | thread.run.recurrent(delay=0.,check_if_preferred_livesource(set_is_preferred_livesource,"srt2")) 121 | 122 | # Wrap input in a buffer 123 | srt2 = buffer(id="buffer_srt2", 124 | fallible=true, 125 | max=3.0, 126 | srt2) 127 | 128 | # Tag source with it's name in metadata 129 | srt2 = source_tag(srt2, "srt2") 130 | 131 | # define safe blank source 132 | safe_blank = blank(id="safe_blank") 133 | safe_blank = source_tag(safe_blank, "safe_blank") 134 | set_is_playing_safe_blank = is_playing_metric(label_values=["default","input","safe_blank"]) 135 | 136 | live_input_list = ["srt1", "srt2"] 137 | 138 | ### END Inputs 139 | 140 | ### Radio logic 141 | 142 | def is_playing(n) = 143 | fun () -> n == !preferred_live_source 144 | end 145 | 146 | live = switch(id="switch_live", 147 | track_sensitive=false, 148 | [(is_playing("srt1"), srt1), 149 | (is_playing("srt2"), srt2)]) 150 | 151 | radio_prod = fallback(id="fallback_prod", 152 | track_sensitive=false, 153 | [live, srt1, srt2, safe_blank]) 154 | 155 | # Get metrics on output 156 | latency_metric(label_values=["default","output","radio_prod"],radio_prod) 157 | set_is_ready = is_ready_metric(label_values=["default","output","radio_prod"]) 158 | increase_duration_unready_seconds = duration_unready_seconds_metric(label_values=["default","output","radio_prod"]) 159 | thread.run.recurrent(delay=0.,check_if_ready(set_is_ready, increase_duration_unready_seconds, radio_prod)) 160 | 161 | def check_is_playing(metadata) = 162 | source_tag = list.assoc(default="", "source_tag", metadata) 163 | 164 | if source_tag == "srt1" then 165 | set_is_playing_srt1(1.) 166 | else 167 | set_is_playing_srt1(0.) 168 | end 169 | if source_tag == "srt2" then 170 | set_is_playing_srt2(1.) 171 | else 172 | set_is_playing_srt2(0.) 173 | end 174 | if source_tag == "safe_blank" then 175 | set_is_playing_safe_blank(1.) 176 | else 177 | set_is_playing_safe_blank(0.) 178 | end 179 | end 180 | 181 | # Check output metadata to set is_playing metric 182 | radio_prod.on_metadata(check_is_playing) 183 | 184 | # Detect blank before output 185 | 186 | set_is_blank = is_blank_metric(label_values=["default","output","radio_prod"]) 187 | 188 | def noise_detect_handler() = 189 | set_is_blank(0.0) 190 | end 191 | 192 | def blank_detect_handler() = 193 | set_is_blank(1.0) 194 | end 195 | 196 | radio_prod = blank.detect(id="on_blank_radio_prod", 197 | max_blank=1.0, 198 | min_noise=0.0, 199 | on_noise=noise_detect_handler, 200 | start_blank=false, 201 | threshold=-40.0, 202 | track_sensitive=true, 203 | blank_detect_handler, 204 | radio_prod) 205 | 206 | 207 | ### END Radio logic 208 | 209 | ### HTTP API 210 | 211 | # Define default http response 212 | def http_response(level="error",msg="Unknow error",code=500) = 213 | log.important(label="httplog", "#{level} #{msg} #{code}") 214 | http.response(code=code, 215 | headers=[("Content-Type","application/json")], 216 | data='{"level": #{json.stringify(level)}, "msg": #{json.stringify(msg)},"code": #{json.stringify(code)}}') 217 | end 218 | 219 | # Handle /get arguments 220 | def getarghandler(arg) = 221 | let (key, _) = arg 222 | if key == "livesource" then 223 | value = !preferred_live_source 224 | ("info", "Preferred live source is set to #{value}", 200) 225 | else 226 | ("error", "Unrecognized argument #{key}", 400) 227 | end 228 | end 229 | 230 | # Handle /set arguments 231 | def setarghandler(arg) = 232 | let (key, value) = arg 233 | if key == "livesource" then 234 | if not list.mem(value,live_input_list) then 235 | ("error", "Source #{value} does not exist", 400) 236 | else 237 | preferred_live_source := value 238 | ("info", "Preferred Live source set to #{value}", 200) 239 | end 240 | else 241 | ("error", "Unrecognized argument #{key}", 400) 242 | end 243 | end 244 | 245 | # Handle /list arguments 246 | def listarghandler(arg) = 247 | let (key, _) = arg 248 | if key == "livesource" then 249 | list = string.concat(separator=", ",live_input_list) 250 | ("info", "Available live source are: #{list}", 200) 251 | else 252 | ("error", "Unrecognized argument #{key}", 400) 253 | end 254 | end 255 | 256 | # Define routes 257 | def routehandler(req, args) = 258 | if req == "/set" then 259 | if list.length(args) == 1 then 260 | setarghandler(list.hd(default=("none",""), args)) 261 | else 262 | ("error","Route #{req} only support 1 argument",400) 263 | end 264 | elsif req == "/get" then 265 | getarghandler(list.hd(default=("none",""), args)) 266 | elsif req == "/list" then 267 | listarghandler(list.hd(default=("none",""), args)) 268 | else 269 | ("error","Route #{req} does not exist",404) 270 | end 271 | end 272 | 273 | # Default httphandler 274 | def httphandler(~protocol,~data,~headers,uri) = 275 | let (req, args) = url.split(uri) 276 | let (level, msg, code) = routehandler(req, args) 277 | http_response(level, msg, code) 278 | end 279 | 280 | harbor.http.register(port=8081,method="GET","^/",httphandler) 281 | 282 | ### END HTTP API 283 | 284 | ### Outputs 285 | 286 | # Define outputs formats 287 | 288 | aac_lofi = 289 | %ffmpeg( 290 | format="mpegts", 291 | %audio( 292 | channels=2, 293 | samplerate=44100, 294 | codec="aac", 295 | b="32k", 296 | profile="aac_low" 297 | ) 298 | ) 299 | 300 | aac_midfi = 301 | %ffmpeg( 302 | format="mpegts", 303 | %audio( 304 | channels=2, 305 | samplerate=44100, 306 | codec="aac", 307 | b="96k", 308 | profile="aac_low" 309 | ) 310 | ) 311 | 312 | aac_hifi = 313 | %ffmpeg( 314 | format="mpegts", 315 | %audio( 316 | channels=2, 317 | samplerate=44100, 318 | codec="aac", 319 | b="196k", 320 | profile="aac_low" 321 | ) 322 | ) 323 | 324 | # Output to HLS 325 | 326 | def segment_name(~position,~extname,stream_name) = 327 | timestamp = int_of_float(time()) 328 | duration = 2 329 | "#{stream_name}_#{duration}_#{timestamp}_#{position}.ts" 330 | end 331 | 332 | def on_file_change(~state,fname) = 333 | if state == "closed" and file.extension(fname) != '.m3u8' then 334 | log.important(label="hls", "Segment #{fname} created") 335 | end 336 | end 337 | 338 | output.file.hls(id="output_hls", 339 | playlist="live.m3u8", 340 | segment_duration=2.0, 341 | segments=5, 342 | segments_overhead=5, 343 | segment_name=segment_name, 344 | on_file_change=on_file_change, 345 | persist_at="state.config", 346 | !hlspath, 347 | [("aac_lofi",aac_lofi), 348 | ("aac_midfi", aac_midfi), 349 | ("aac_hifi", aac_hifi)], 350 | radio_prod) 351 | 352 | ### END Outputs 353 | --------------------------------------------------------------------------------