├── .gitignore ├── LICENSE ├── README.md ├── docker-compose.yml ├── fakenet.sh ├── package.json ├── releases ├── dev │ ├── Dockerfile.build │ ├── Dockerfile.run │ └── Makefile ├── latest │ ├── Dockerfile │ ├── git-tag │ └── scripts │ │ ├── build.sh │ │ └── run.sh ├── v1.10.0 │ ├── Dockerfile │ ├── README.md │ ├── git-tag │ └── scripts │ │ ├── build.sh │ │ └── run.sh ├── v1.4.0 │ ├── Dockerfile │ ├── git-tag │ └── scripts │ │ ├── build.sh │ │ └── run.sh ├── v1.5.0 │ ├── Dockerfile │ ├── git-tag │ └── scripts │ │ ├── build.sh │ │ └── run.sh ├── v1.6.0 │ ├── Dockerfile │ ├── git-tag │ └── scripts │ │ ├── build.sh │ │ └── run.sh ├── v1.7.0 │ ├── Dockerfile │ ├── git-tag │ └── scripts │ │ ├── build.sh │ │ └── run.sh ├── v1.8.0 │ ├── Dockerfile │ ├── git-tag │ └── scripts │ │ ├── build.sh │ │ └── run.sh └── v1.9.0 │ ├── Dockerfile │ ├── git-tag │ └── scripts │ ├── build.sh │ └── run.sh └── update-releases.sh /.gitignore: -------------------------------------------------------------------------------- 1 | /update-releases.json -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # netdata 2 | 3 | Dockerfile for building and running a netdata deamon for your host instance. 4 | 5 | Netdata monitors your server with thoughts of performance and memory usage, providing detailed insight into very recent server metrics. It's nice, and now it's also dockerized. 6 | 7 | More info about project: https://github.com/firehol/netdata 8 | 9 | > **Note**: the netdata project includes telemetry. Google Analytics is used to aggregate telemetry data, with IP anonymisation turned on. There is currently 10 | > no way to opt out, until such a mechanism can be provided at runtime instead of compile time. You can track the upstream [issue #7404](https://github.com/netdata/netdata/issues/7404) if 11 | > you have privacy concerns. GDPR explicitly allows [processing for statistical purposes, without requiring opt-in](https://github.com/netdata/netdata/issues/7366#issuecomment-560363265) in 12 | > it's Article 6, and related Article 89(1). Currently, you can only opt out if you build netdata without telemetry. 13 | > 14 | > More info about the original telemetry implementation in netdata is on [issue #4735](https://github.com/netdata/netdata/issues/4735), and instructions 15 | > / documentation, including a way to opt out of telemetry is available here: [anonymous statistics docs page](https://docs.netdata.cloud/docs/anonymous-statistics/). 16 | 17 | # More info about me 18 | 19 | I'm primarily a full-stack web developer with strong knowledge of Docker, APIs, AWS, PHP, Go, Nginx+LUA, SQL and NoSQL databases, Video Streaming (Wowza Media Server), and handle DevOps/automation for several large scale international clients (High traffic/HA deployments). 20 | 21 | If you need someone with this skillset, please contact me at black@scene-si.org. 22 | 23 | I'm also the author of the following books: 24 | 25 | * [Advent of Go Microservices](https://leanpub.com/go-microservices) 26 | * [API Foundations in Go](https://leanpub.com/api-foundations) 27 | * [12 Factor Applications with Docker and Go](https://leanpub.com/12fa-docker-golang) 28 | 29 | Consider buying the books to learn something new and support my open source work. 30 | 31 | For more information, I also write a development-themed blog at [scene-si.org](https://scene-si.org/). 32 | I occasionally tweet my pursuits (sometimes in Slovenian) on [@TitPetric](https://twitter.com/TitPetric). 33 | 34 | # Using 35 | 36 | ## Statring the container 37 | 38 | ### Docker CLI 39 | 40 | ``` 41 | docker run -d --cap-add SYS_PTRACE \ 42 | -v /proc:/host/proc:ro \ 43 | -v /sys:/host/sys:ro \ 44 | -p 19999:19999 \ 45 | --restart unless-stopped \ 46 | titpetric/netdata 47 | ``` 48 | 49 | > **Note:** Remove the `--restart unless-stopped` [parameter](https://docs.docker.com/config/containers/start-containers-automatically/#use-a-restart-policy) if you don't need the netdata container to start automatically on boot. 50 | 51 | ### Docker Compose 52 | 53 | Use the sample [docker-compose.yml](docker-compose.yml) file. 54 | 55 | > **Note:** Remove the `restart: unless-stopped` [option](https://docs.docker.com/compose/compose-file/#restart) if you don't need the netdata container to start automatically on boot. 56 | 57 | ``` 58 | mkdir netdata && cd netdata && wget https://raw.githubusercontent.com/titpetric/netdata/master/docker-compose.yml 59 | docker-compose up -d 60 | ``` 61 | 62 | ## Accessing the data 63 | 64 | Open a browser on http://server:19999/ and watch how your server is doing. 65 | 66 | # Supported tags and respective Dockerfile links 67 | 68 | Check out for [Docker Hub Tags page for titpetric/netdata](https://cloud.docker.com/repository/docker/titpetric/netdata/tags) if you 69 | need to grab an older version. There's an archive of versions going back from 1.4 to the current version. 70 | 71 | The `latest` tag is in line with the upstream and is occasionally prone to failure. As far as older tags go - 72 | they will inevitably lack some new features but should provide a more stable version to run. 73 | 74 | > Developers note: new tags are not added automatically which means there might be some delay between when a new 75 | > release of netdata is available and when a new tag is available on docker hub; open an issue if that happens. 76 | 77 | # Limiting IP netdata listens to 78 | 79 | By default netdata listens to 0.0.0.0 (any address). You might want to change this if you're running netdata in `--net=host` mode. You can pass the following environment variable: 80 | 81 | - NETDATA_IP - the IP that netdata should listen to, e.g. `127.0.0.1` for localhost only. 82 | 83 | # Passing custom netdata options 84 | 85 | If you need to pass some custom options to netdata, you can pass the following environment variable: 86 | 87 | - NETDATA_ARGS - for example if you don't want to use NETDATA_IP above, you can pass `-e NETDATA_ARGS="-i 127.0.0.1"` for same effect. 88 | 89 | # Getting emails on alarms 90 | 91 | Netdata supports forwarding alarms to an email address. You can set up msmtp by setting the following ENV variables: 92 | 93 | - SMTP_TO - This is the address alarms will be delivered to. 94 | - SMTP_FROM - This is the address the emails will be from. Defaults to localhost. 95 | - SMTP_SERVER - This is your SMTP server. Defaults to smtp.gmail.com. 96 | - SMTP_PORT - This is the SMTP server port. Defaults to 587. 97 | - SMTP_USER - This is your username for the SMTP server. 98 | - SMTP_PASS - This is your password for the SMTP server. Use an app password if using Gmail. 99 | - SMTP_TLS - Use TLS for the connection. Defaults to `on`. 100 | - SMTP_STARTTLS - Use STARTTLS for the connection. Defaults to `on`. 101 | 102 | For example, using gmail: 103 | 104 | ``` 105 | -e SMTP_TO=user@gmail.com -e SMTP_USER=user -e SMTP_PASS=password 106 | ``` 107 | 108 | Alternatively, if you already have s msmtp config, you can use that config with: 109 | 110 | ~~~ 111 | -v /path/to/msmtprc:/etc/msmtprc:ro 112 | ~~~ 113 | 114 | See the following link for details on setting up msmtp: [MSMTP - ArchWiki](https://wiki.archlinux.org/index.php/Msmtp) 115 | 116 | > Note: email settings up to version v0.10.0 were different. You can get the [old documentation](https://github.com/titpetric/netdata/blob/master/releases/v0.10.0/README.md) is the corresponding release subfolder. 117 | 118 | # Adding custom alarms, charts and configuration overrides 119 | 120 | To add custom alarms, charts or to override any default configuration file, mount a volume to the container to /etc/netdata/override, like `-v /opt/netdata/override:/etc/netdata/override:ro`. Then, place your config files in the directory as if it was /etc/netdata/. 121 | 122 | For example to create a custom alarm for system temperature, create a `health.d` folder in your local directory (`/opt/netdata/override` in the example above) and place a `sensors.conf` file with your alarm configuration inside the `health.d` directory. 123 | 124 | # Getting alarms in Slack 125 | 126 | Netdata supports sending alerts to slack via webhooks. You can set that up by setting the following ENV variables: 127 | 128 | - SLACK_WEBHOOK_URL - This is your incoming slack webhook 129 | - SLACK_CHANNEL - This is the default channel that alerts will get sent to 130 | 131 | For example: 132 | 133 | ``` 134 | -e SLACK_WEBHOOK_URL=https://hooks.slack.com/services/XXXX -e SLACK_CHANNEL=alerts 135 | ``` 136 | 137 | # Getting alarms in Discord 138 | 139 | Netdata supports sending alerts to Discord via webhooks. You can set that up by setting the following ENV variables: 140 | 141 | - DISCORD_WEBHOOK_URL - This is your incoming Discord webhook 142 | - DISCORD_RECIPIENT - This is the default channel that alerts will get sent to 143 | 144 | For example: 145 | 146 | ``` 147 | -e DISCORD_WEBHOOK_URL=https://discordapp.com/api/webhooks/XXXX -e DISCORD_RECIPIENT=alerts 148 | ``` 149 | 150 | # Getting alarms in Telegram 151 | 152 | Netdata supports sending alerts to Telegram via token and chat ID. You can set that up by setting the following ENV variables: 153 | 154 | - TELEGRAM_BOT_TOKEN - This is your bot token 155 | - TELEGRAM_CHAT_ID - This is the chat ID 156 | 157 | For example: 158 | 159 | ``` 160 | -e TELEGRAM_BOT_TOKEN=22624413:AAGy12TkSMBYVBTe4lQt3BfUYvUs5h7I1jn -e TELEGRAM_CHAT_ID=137165138 161 | ``` 162 | 163 | For more details about Telegram alerts, see [this page - GitHub](https://github.com/firehol/netdata/wiki/health-monitoring#telegramorg-messages) 164 | 165 | # Getting alarms in Pushbullet 166 | 167 | Netdata supports sending alerts to Pushbullet via API token. You can set that up by setting the following ENV variables: 168 | 169 | - PUSHBULLET_ACCESS_TOKEN - This is your API token 170 | - PUSHBULLET_DEFAULT_EMAIL - This is the default email that alerts will get sent to if there is not a Pushbullet account attached to it 171 | 172 | For example: 173 | 174 | ``` 175 | -e PUSHBULLET_ACCESS_TOKEN=o.l8VuizWhXgbERf2Q78ghtzb1LDCYvbSD -e PUSHBULLET_DEFAULT_EMAIL=your.email@gmail.com 176 | ``` 177 | 178 | More details about Pushbullet alerts are provided [here - GitHub](https://github.com/firehol/netdata/wiki/health-monitoring#pushbulletcom-push-notifications) 179 | 180 | # Setting up streaming 181 | 182 | On a client netdata set this destination to be the HOST[:PORT] of the 183 | central netdata, and give an `API_KEY` that is secret and only known internally 184 | to the netdata clients, and netdata central. See [this page - GitHub](https://github.com/firehol/netdata/wiki/Replication-Overview#options-for-the-sending-node) 185 | 186 | - NETDATA_STREAM_DESTINATION - `HOST[:PORT]` to stream to 187 | - NETDATA_STREAM_API_KEY - `API_KEY` to send to central net data 188 | 189 | ``` 190 | -e NETDATA_STREAM_DESTINATION=netdata.service:19999 -e NETDATA_STREAM_API_KEY=1h213ch12h3rc1289e 191 | ``` 192 | 193 | On the central netdata set 1 or more `NETADATA_API_KEY_ENABLE` env variables that matches the `API_KEY` 194 | that you used on the client above, this will enable the netdata client node to communicate with the netdata central 195 | 196 | - NETADATA_API_KEY_ENABLE_{API_KEY}=1 197 | 198 | ``` 199 | -e NETDATA_API_KEY_ENABLE_1h213ch12h3rc1289e=1 200 | ``` 201 | 202 | # Monitoring docker container metrics 203 | 204 | Netdata supports fetching container data from `docker.sock`. You can forward it to the netdata container with: 205 | 206 | ~~~ 207 | -v /var/run/docker.sock:/var/run/docker.sock:ro 208 | ~~~ 209 | 210 | This will allow netdata to resolve container names. 211 | 212 | > Note: forwarding docker.sock exposes the administrative docker API. If due to some security issue access has been obtained to the container, it will expose full docker API, allowing to stop, create or delete containers, as well as download new images in the host. 213 | > 214 | > TL;DR If you care about security, consider forwarding a secure docker socket with [docker-proxy-acl](https://github.com/titpetric/docker-proxy-acl) 215 | 216 | # Monitoring docker notes on some systems (Debian jessie) 217 | 218 | On debian jessie only 'cpu' and 'disk' metrics show up under individual docker containers. To get the memory metric, you will have to add `cgroup_enable=memory swapaccount=1` to `/etc/default/grub`, appending the `GRUB_CMDLINE_LINUX_DEFAULT` variable: 219 | 220 | ~~~ 221 | $ cat /etc/default/grub | grep GRUB_CMDLINE_LINUX_DEFAULT 222 | GRUB_CMDLINE_LINUX_DEFAULT="quiet cgroup_enable=memory swapaccount=1" 223 | ~~~ 224 | 225 | After rebooting your linux instance, the memory accounting subsystem of the kernel will be enabled. Netdata will pick up additional metrics for the containers when it starts. 226 | 227 | # Environment variables 228 | 229 | It's possible to pass a NETDATA_PORT environment variable with -e, to start up netdata on a different port. 230 | 231 | ``` 232 | docker run -e NETDATA_PORT=80 [...] 233 | ``` 234 | 235 | # Some explanation is in order 236 | 237 | Docker needs to run with the SYS_PTRACE capability. Without it, the mapped host/proc filesystem is not fully readable to the netdata deamon, more specifically the "apps" plugin: 238 | 239 | ``` 240 | 16-01-12 07:58:16: ERROR: apps.plugin: Cannot process /host/proc/1/io (errno 13, Permission denied) 241 | ``` 242 | 243 | See the following link for more details: [/proc/1/environ is unavailable in a container that is not priviledged](https://github.com/docker/docker/issues/6607) 244 | 245 | # Limitations 246 | 247 | In addition to the above requirements and limitations, monitoring the complete network interface list of the host is not possible from within the Docker container. If you're running netdata and want to graph all the interfaces available on the host, you will have to use `--net=host` mode. 248 | 249 | See the following link for more details: [network interfaces missing when mounting proc inside a container](https://github.com/docker/docker/issues/13398) 250 | 251 | ## Work-around 252 | 253 | I provided a script called `fakenet.sh` which provides a copy of the `/proc/net` filesystem. You should start this script before you start the netdata container. You can do it like this: 254 | 255 | ~~~ 256 | wget https://raw.githubusercontent.com/titpetric/netdata/master/fakenet.sh 257 | chmod a+x fakenet.sh 258 | nohup ./fakenet.sh >/dev/null 2>&1 & 259 | ~~~ 260 | 261 | Using the above command, the fakenet script will start in the background and will keep running there. You can use other tools like `screen` or `tmux` to provide similar capability. 262 | 263 | The script fills out the `/dev/shm/fakenet` location, which you must mount into the container. You *must* mount it into `/fakenet/proc/net` exactly with the option like this: 264 | 265 | ~~~ 266 | -v /dev/shm/fakenet:/fakenet/proc/net 267 | ~~~ 268 | 269 | The script refreshes network information about every 250ms (four times per second). The interval may be increased to give better accuracy of netdata, but CPU usage will also increase. Because of this, the data is not very accurate and some spikes and valleys will occur because of a shifting window between when the reading was taken (fakeproc) and between when the reading was read by netdata. This means the margin for error is whatever data can be collected in ~250ms. 270 | 271 | While the solution might not fit everybody, it's security-positive because the netdata container can only inspect the fake proc/net location, and can't actually access any of the networks because it runs on a private LAN / custom network which is managed and firewalled by docker. You may even open access via application, like a nginx reverse proxy where you can add authentication etc. 272 | 273 | Pro/con list: 274 | 275 | * + network isolation stays in tact 276 | * + all network device metrics are available 277 | * - one more service to provide fakenet 278 | * - accuracy vs. cpu use is a trade-off 279 | 280 | # Additional notes 281 | 282 | Netdata provides monitoring via a plugin architecture. This plugin supports many projects that don't provide data over the `/proc` filesystem. When you're running netdata in the container, you will have difficulty providing many of these paths to the netdata container. 283 | 284 | What you do get (even with the docker version) is: 285 | 286 | * Host CPU statististics 287 | * Host Network I/O, QoS 288 | * Host Disk I/O 289 | * Applications monitoring 290 | * Container surface metrics (cpu/disk per name) 291 | 292 | You will not get detailed application metrics (mysql, ups, etc.) from other containers or from the host if running netdata in a container. It may be possible to get *some* of those metrics, but it might not be easy, and most likely not worth it. For most detailed metrics, netdata needs to share the same environment as the application server it monitors. This means it would need to run either in the same container (not even remotely practical), or in the same virtual machine (no containers). 293 | 294 | > Note: if you have some custom hardware like a UPS which is monitored via USB and netdata supports it, you will most likely need to add new software to the netdata docker image to support it. The correct way to do it is to create your own Dockerfile, start with "FROM titpetric/netdata" and then add all your installation commands to build your own image which will support your hardware setup. Most likely if it's not a very common setup (i.e. available on most machines), the software will not be added to `titpetric/netdata` - that being said, your use case might be useful for others so feel free to submit issues with your extensions or feature requests in terms of new software. I'll gladly add your project/extension to the README here. 295 | 296 | # Changelog 297 | 298 | ### v1.10.0 -> Latest 299 | 300 | * Replaced sSMTP with msmtp, renamed `SSMTP_*` settings as `SMTP_*`, removed `SSMTP_HOSTNAME` setting, renamed `SSMTP_TLS` to `SMTP_STARTTLS` and added `SMTP_TLS`. 301 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | services: 4 | netdata: 5 | restart: always 6 | hostname: netdata 7 | image: titpetric/netdata 8 | cap_add: 9 | - SYS_PTRACE 10 | security_opt: 11 | - apparmor:unconfined 12 | ports: 13 | - 19999:19999 14 | volumes: 15 | - /proc:/host/proc:ro 16 | - /sys:/host/sys:ro 17 | - /var/run/docker.sock:/var/run/docker.sock:ro 18 | -------------------------------------------------------------------------------- /fakenet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # generate a fake /proc/net with a limited set of files 3 | # which are used for netdata metrics collection 4 | OUTPUT="/dev/shm/fakenet/"; 5 | 6 | if [ ! -d "$OUTPUT" ]; then 7 | mkdir -p $OUTPUT/{rpc,stat,ip_vs} 8 | fi 9 | 10 | SOURCES="/proc/net/dev 11 | /proc/net/ip_vs_stats 12 | /proc/net/ip_vs/stats 13 | /proc/net/netstat 14 | /proc/net/rpc/nfs 15 | /proc/net/rpc/nfsd 16 | /proc/net/snmp 17 | /proc/net/snmp6 18 | /proc/net/softnet_stat 19 | /proc/net/stat/conntrack 20 | /proc/net/stat/nf_conntrack 21 | /proc/net/stat/synproxy" 22 | 23 | NETFILES="" 24 | for SOURCE in $SOURCES; do 25 | if [ -f "$SOURCE" ]; then 26 | NETFILES="$NETFILES $SOURCE" 27 | fi 28 | done 29 | 30 | while [ true ]; do 31 | for NETFILE in $NETFILES; do 32 | OUTFILE="${NETFILE:10}" 33 | echo "$(<$NETFILE)" > $OUTPUT$OUTFILE 34 | done 35 | ##date +%s.%N 36 | sleep 0.23 37 | done 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "netdata", 3 | "version": "0.0.10", 4 | "description": "Netdata monitors your server with thoughts of performance and memory usage, providing detailed insight into very recent server metrics.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/titpetric/netdata.git" 12 | }, 13 | "keywords": [ 14 | "netdata", 15 | "monitoring", 16 | "statistics", 17 | "graphs", 18 | "ganglia", 19 | "cacti", 20 | "munin" 21 | ], 22 | "author": "Tit Petric", 23 | "license": "GPL3 or later", 24 | "bugs": { 25 | "url": "https://github.com/titpetric/netdata/issues" 26 | }, 27 | "homepage": "https://github.com/titpetric/netdata" 28 | } 29 | -------------------------------------------------------------------------------- /releases/dev/Dockerfile.build: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | ADD scripts/build.sh /build.sh 4 | RUN chmod +x /build.sh && sync && sleep 1 && /build.sh 5 | 6 | WORKDIR / -------------------------------------------------------------------------------- /releases/dev/Dockerfile.run: -------------------------------------------------------------------------------- 1 | FROM titpetric/netdata-build 2 | 3 | ADD scripts/run.sh /run.sh 4 | 5 | RUN chmod +x /run.sh && sync && sleep 1 6 | 7 | WORKDIR / 8 | 9 | ENV NETDATA_PORT=19999 SSMTP_TLS=YES SSMTP_SERVER=smtp.gmail.com SSMTP_PORT=587 SSMTP_HOSTNAME=localhost 10 | EXPOSE $NETDATA_PORT 11 | 12 | ENTRYPOINT ["/run.sh"] 13 | -------------------------------------------------------------------------------- /releases/dev/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build --rm --no-cache=true -t titpetric/netdata-build -f Dockerfile.build . 3 | 4 | run: 5 | docker build --rm --no-cache=true -t titpetric/netdata -f Dockerfile.run . 6 | 7 | .PHONY: build run -------------------------------------------------------------------------------- /releases/latest/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:stretch 2 | 3 | ADD git-tag /git-tag 4 | 5 | ADD scripts/build.sh /build.sh 6 | ADD scripts/run.sh /run.sh 7 | 8 | RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh 9 | 10 | WORKDIR / 11 | 12 | ENV NETDATA_PORT=19999 SMTP_TLS=on SMTP_STARTTLS=on SMTP_SERVER=smtp.gmail.com SMTP_PORT=587 SMTP_FROM=localhost 13 | EXPOSE $NETDATA_PORT 14 | 15 | VOLUME /etc/netdata/override 16 | 17 | ENTRYPOINT ["/run.sh"] 18 | -------------------------------------------------------------------------------- /releases/latest/git-tag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/titpetric/netdata/0ce01519712df5ae56340835d38b7642854d21b7/releases/latest/git-tag -------------------------------------------------------------------------------- /releases/latest/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | DEBIAN_FRONTEND=noninteractive 4 | 5 | # some mirrors have issues, i skipped httpredir in favor of an eu mirror 6 | 7 | echo "deb http://ftp.nl.debian.org/debian/ stretch main" > /etc/apt/sources.list 8 | echo "deb http://security.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list 9 | 10 | # install dependencies for build 11 | 12 | apt-get -qq update 13 | apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq libuv1-dev liblz4-dev libjudy-dev libssl-dev 14 | apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml libjudydebian1 libuv1 liblz4-1 openssl 15 | apt-get -y install msmtp msmtp-mta apcupsd fping 16 | 17 | # fetch netdata 18 | 19 | git clone https://github.com/firehol/netdata.git /netdata.git 20 | cd /netdata.git 21 | TAG=$( /usr/share/netdata/web/version.txt 6 | 7 | # set up msmtp 8 | if [[ $SMTP_TO ]]; then 9 | cat << EOF > /etc/msmtprc 10 | account default 11 | aliases /etc/msmtp_aliases 12 | from $SMTP_FROM 13 | host $SMTP_SERVER 14 | port $SMTP_PORT 15 | tls $SMTP_TLS 16 | tls_starttls $SMTP_STARTTLS 17 | tls_certcheck off 18 | EOF 19 | 20 | cat << EOF > /etc/msmtp_aliases 21 | netdata: $SMTP_TO 22 | root: $SMTP_TO 23 | EOF 24 | fi 25 | 26 | if [[ $SMTP_USER ]]; then 27 | cat << EOF >> /etc/msmtprc 28 | auth on 29 | user $SMTP_USER 30 | EOF 31 | fi 32 | 33 | if [[ $SMTP_PASS ]]; then 34 | cat << EOF >> /etc/msmtprc 35 | password $SMTP_PASS 36 | EOF 37 | fi 38 | 39 | # copy conf from NETDATA_STOCK_CONFIG_DIR (normally under /usr/lib/netdata/conf.d) to NETDATA_USER_CONFIG_DIR (normally under /etc/netdata) 40 | cp /usr/lib/netdata/conf.d/health_alarm_notify.conf /etc/netdata 41 | 42 | if [[ $SLACK_WEBHOOK_URL ]]; then 43 | sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 44 | fi 45 | 46 | if [[ $SLACK_CHANNEL ]]; then 47 | sed -i -e "s@DEFAULT_RECIPIENT_SLACK=\"\"@DEFAULT_RECIPIENT_SLACK=\"${SLACK_CHANNEL}\"@" /etc/netdata/health_alarm_notify.conf 48 | fi 49 | 50 | if [[ $DISCORD_WEBHOOK_URL ]]; then 51 | sed -i -e "s@DISCORD_WEBHOOK_URL=\"\"@DISCORD_WEBHOOK_URL=\"${DISCORD_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 52 | fi 53 | 54 | if [[ $DISCORD_RECIPIENT ]]; then 55 | sed -i -e "s@DEFAULT_RECIPIENT_DISCORD=\"\"@DEFAULT_RECIPIENT_DISCORD=\"${DISCORD_RECIPIENT}\"@" /etc/netdata/health_alarm_notify.conf 56 | fi 57 | 58 | if [[ $TELEGRAM_BOT_TOKEN ]]; then 59 | sed -i -e "s@TELEGRAM_BOT_TOKEN=\"\"@TELEGRAM_BOT_TOKEN=\"${TELEGRAM_BOT_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 60 | fi 61 | 62 | if [[ $TELEGRAM_CHAT_ID ]]; then 63 | sed -i -e "s@DEFAULT_RECIPIENT_TELEGRAM=\"\"@DEFAULT_RECIPIENT_TELEGRAM=\"${TELEGRAM_CHAT_ID}\"@" /etc/netdata/health_alarm_notify.conf 64 | fi 65 | 66 | if [[ $PUSHBULLET_ACCESS_TOKEN ]]; then 67 | sed -i -e "s@PUSHBULLET_ACCESS_TOKEN=\"\"@PUSHBULLET_ACCESS_TOKEN=\"${PUSHBULLET_ACCESS_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 68 | fi 69 | 70 | if [[ $PUSHBULLET_DEFAULT_EMAIL ]]; then 71 | sed -i -e "s#DEFAULT_RECIPIENT_PUSHBULLET=\"\"#DEFAULT_RECIPIENT_PUSHBULLET=\"${PUSHBULLET_DEFAULT_EMAIL}\"#" /etc/netdata/health_alarm_notify.conf 72 | fi 73 | 74 | if [[ $NETDATA_IP ]]; then 75 | NETDATA_ARGS="${NETDATA_ARGS} -i ${NETDATA_IP}" 76 | fi 77 | 78 | # on a client netdata set this destination to be the [PROTOCOL:]HOST[:PORT] of the 79 | # central netdata, and give an API_KEY that is secret and only known internally 80 | # to the netdata clients, and netdata central 81 | if [[ $NETDATA_STREAM_DESTINATION ]] && [[ $NETDATA_STREAM_API_KEY ]]; then 82 | cat << EOF > /etc/netdata/stream.conf 83 | [stream] 84 | enabled = yes 85 | destination = $NETDATA_STREAM_DESTINATION 86 | api key = $NETDATA_STREAM_API_KEY 87 | EOF 88 | fi 89 | 90 | # set 1 or more NETADATA_API_KEY_ENABLE env variables, such as NETDATA_API_KEY_ENABLE_1h213ch12h3rc1289e=1 91 | # that matches the API_KEY that you used on the client above, this will enable the netdata client 92 | # node to communicate with the netdata central 93 | if printenv | grep -q 'NETDATA_API_KEY_ENABLE_'; then 94 | printenv | grep -oe 'NETDATA_API_KEY_ENABLE_[^=]\+' | sed 's/NETDATA_API_KEY_ENABLE_//' | xargs -n1 -I{} echo '['{}$']\n\tenabled = yes' >> /etc/netdata/stream.conf 95 | fi 96 | 97 | # exec custom command 98 | if [[ $# -gt 0 ]] ; then 99 | exec "$@" 100 | exit 101 | fi 102 | 103 | if [[ -d "/fakenet/" ]]; then 104 | echo "Running fakenet config reload in background" 105 | ( sleep 10 ; curl -s http://localhost:${NETDATA_PORT}/netdata.conf | sed -e 's/# filename/filename/g' | sed -e 's/\/host\/proc\/net/\/fakenet\/proc\/net/g' > /etc/netdata/netdata.conf ; pkill -9 netdata ) & 106 | /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} 107 | # add some artificial sleep because netdata might think it can't bind to $NETDATA_PORT 108 | # and report things like "netdata: FATAL: Cannot listen on any socket. Exiting..." 109 | sleep 1 110 | fi 111 | 112 | for f in /etc/netdata/override/*; do 113 | cp -a $f /etc/netdata/ 114 | done 115 | 116 | # main entrypoint 117 | touch /etc/netdata/python.d.conf 118 | exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} "$@" 119 | -------------------------------------------------------------------------------- /releases/v1.10.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | ADD git-tag /git-tag 4 | 5 | ADD scripts/build.sh /build.sh 6 | ADD scripts/run.sh /run.sh 7 | 8 | RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh 9 | 10 | WORKDIR / 11 | 12 | ENV NETDATA_PORT=19999 SSMTP_TLS=YES SSMTP_SERVER=smtp.gmail.com SSMTP_PORT=587 SSMTP_HOSTNAME=localhost 13 | EXPOSE $NETDATA_PORT 14 | 15 | VOLUME /etc/netdata/override 16 | 17 | ENTRYPOINT ["/run.sh"] 18 | -------------------------------------------------------------------------------- /releases/v1.10.0/README.md: -------------------------------------------------------------------------------- 1 | # netdata 2 | 3 | Dockerfile for building and running a netdata deamon for your host instance. 4 | 5 | Netdata monitors your server with thoughts of performance and memory usage, providing detailed insight into very recent server metrics. It's nice, and now it's also dockerized. 6 | 7 | More info about project: https://github.com/firehol/netdata 8 | 9 | # More info about me 10 | 11 | I'm primarily a full-stack web developer with strong knowledge of Docker, APIs, AWS, PHP, Go, Nginx+LUA, SQL and NoSQL databases, Video Streaming (Wowza Media Server), and handle DevOps/automation for several large scale international clients (High traffic/HA deployments). 12 | 13 | If you need someone with this skillset, please contact me at black@scene-si.org. 14 | 15 | I'm also the author of the following books: 16 | 17 | * [API Foundations in Go](https://leanpub.com/api-foundations) 18 | * [12 Factor Applications with Docker and Go](https://leanpub.com/12fa-docker-golang) 19 | 20 | For more information, I also write a development-themed blog at [scene-si.org](https://scene-si.org/). 21 | I occasionally tweet my pursuits (sometimes in Slovenian) on [@TitPetric](https://twitter.com/TitPetric). 22 | 23 | # Using 24 | 25 | ``` 26 | docker run -d --cap-add SYS_PTRACE \ 27 | -v /proc:/host/proc:ro \ 28 | -v /sys:/host/sys:ro \ 29 | -p 19999:19999 titpetric/netdata 30 | ``` 31 | 32 | Open a browser on http://server:19999/ and watch how your server is doing. 33 | 34 | # Supported tags and respective Dockerfile links 35 | 36 | * `titpetric/netdata:latest` [releases/latest/Dockerfile](https://github.com/titpetric/netdata/tree/master/releases/latest) 37 | * `titpetric/netdata:1.8` [releases/v1.8.0/Dockerfile](https://github.com/titpetric/netdata/tree/master/releases/v1.8.0) 38 | * `titpetric/netdata:1.7` [releases/v1.7.0/Dockerfile](https://github.com/titpetric/netdata/tree/master/releases/v1.7.0) 39 | * `titpetric/netdata:1.6` [releases/v1.6.0/Dockerfile](https://github.com/titpetric/netdata/tree/master/releases/v1.6.0) 40 | * `titpetric/netdata:1.5` [releases/v1.5.0/Dockerfile](https://github.com/titpetric/netdata/tree/master/releases/v1.5.0) 41 | * `titpetric/netdata:1.4` [releases/v1.4.0/Dockerfile](https://github.com/titpetric/netdata/tree/master/releases/v1.4.0) 42 | 43 | The tags include builds of netdata, with the same tag in upstream. If there's some need to add older tags, you may 44 | use the provided `/releases` folder as reference, and add new tags as a PR. The `latest` tag is in line with the 45 | upstream and is occasionally prone to failure. As far as older tags go - they will inevitably lack some new features 46 | but should provide a more stable version to run. 47 | 48 | > Developers note: new tags are not added automatically which means there might be some delay between when a new 49 | > release of netdata is available and when a new tag is available on docker hub - to add a new release yourself, the procedure is as follows: 50 | > 51 | > 1. fork netdata repo, 52 | > 2. run /update-releases.sh, 53 | > 3. add, commit, push and submit a PR to `titpetric/netdata` 54 | > 55 | > When you will submit a PR, I will also add the new version to the docker hub and thank you profusely. 56 | 57 | # Limiting IP netdata listens to 58 | 59 | By default netdata listens to 0.0.0.0 (any address). You might want to change this if you're running netdata in `--net=host` mode. You can pass the following environment variable: 60 | 61 | - NETDATA_IP - the IP that netdata should listen to, e.g. `127.0.0.1` for localhost only. 62 | 63 | # Passing custom netdata options 64 | 65 | If you need to pass some custom options to netdata, you can pass the following environment variable: 66 | 67 | - NETDATA_ARGS - for example if you don't want to use NETDATA_IP above, you can pass `-e NETDATA_ARGS="-i 127.0.0.1"` for same effect. 68 | 69 | # Getting emails on alarms 70 | 71 | Netdata supports forwarding alarms to an email address. You can set up sSMTP by setting the following ENV variables: 72 | 73 | - SSMTP_TO - This is the address alarms will be delivered to. 74 | - SSMTP_SERVER - This is your SMTP server. Defaults to smtp.gmail.com. 75 | - SSMTP_PORT - This is the SMTP server port. Defaults to 587. 76 | - SSMTP_USER - This is your username for the SMTP server. 77 | - SSMTP_PASS - This is your password for the SMTP server. Use an app password if using Gmail. 78 | - SSMTP_TLS - Use TLS for the connection. Defaults to YES. 79 | - SSMTP_HOSTNAME - The hostname mail will come from. Defaults to localhost. 80 | 81 | For example, using gmail: 82 | 83 | ``` 84 | -e SSMTP_TO=user@gmail.com -e SSMTP_USER=user -e SSMTP_PASS=password 85 | ``` 86 | 87 | Alternatively, if you already have s sSMTP config, you can use that config with: 88 | 89 | ~~~ 90 | -v /path/to/config:/etc/ssmtp 91 | ~~~ 92 | 93 | See the following link for details on setting up sSMTP: [SSMTP - ArchWiki](https://wiki.archlinux.org/index.php/SSMTP) 94 | 95 | # Adding custom alarms, charts and configuration overrides 96 | 97 | To add custom alarms, charts or to override any default configuration file, mount a volume to the container to /etc/netdata/override, like `-v /opt/netdata/overrides:/etc/netdata/override`. Then, place your config files in the directory as if it was /etc/netdata/. 98 | 99 | For example to create a custom alarm for system temperature, create a `health.d` folder in your local directory (`/opt/netdata/override` in the example above) and place a `sensors.conf` file with your alarm configuration inside the `health.d` directory. 100 | 101 | # Getting alarms in Slack 102 | 103 | Netdata supports sending alerts to slack via webhooks. You can set that up by setting the following ENV variables: 104 | 105 | - SLACK_WEBHOOK_URL - This is your incoming slack webhook 106 | - SLACK_CHANNEL - This is the default channel that alerts will get sent to 107 | 108 | For example: 109 | 110 | ``` 111 | -e SLACK_WEBHOOK_URL=https://hooks.slack.com/services/XXXX -e SLACK_CHANNEL=alerts 112 | ``` 113 | 114 | # Getting alarms in Discord 115 | 116 | Netdata supports sending alerts to Discord via webhooks. You can set that up by setting the following ENV variables: 117 | 118 | - DISCORD_WEBHOOK_URL - This is your incoming Discord webhook 119 | - DISCORD_RECIPIENT - This is the default channel that alerts will get sent to 120 | 121 | For example: 122 | 123 | ``` 124 | -e DISCORD_WEBHOOK_URL=https://discordapp.com/api/webhooks/XXXX -e DISCORD_RECIPIENT=alerts 125 | ``` 126 | 127 | # Getting alarms in Telegram 128 | 129 | Netdata supports sending alerts to Telegram via token and chat ID. You can set that up by setting the following ENV variables: 130 | 131 | - TELEGRAM_BOT_TOKEN - This is your bot token 132 | - TELEGRAM_CHAT_ID - This is the chat ID 133 | 134 | For example: 135 | 136 | ``` 137 | -e TELEGRAM_BOT_TOKEN=22624413:AAGy12TkSMBYVBTe4lQt3BfUYvUs5h7I1jn -e TELEGRAM_CHAT_ID=137165138 138 | ``` 139 | 140 | For more details about Telegram alerts, see [this page - GitHub](https://github.com/firehol/netdata/wiki/health-monitoring#telegramorg-messages) 141 | 142 | # Getting alarms in Pushbullet 143 | 144 | Netdata supports sending alerts to Pushbullet via API token. You can set that up by setting the following ENV variables: 145 | 146 | - PUSHBULLET_ACCESS_TOKEN - This is your API token 147 | - PUSHBULLET_DEFAULT_EMAIL - This is the default email that alerts will get sent to if there is not a Pushbullet account attached to it 148 | 149 | For example: 150 | 151 | ``` 152 | -e PUSHBULLET_ACCESS_TOKEN=o.l8VuizWhXgbERf2Q78ghtzb1LDCYvbSD -e PUSHBULLET_DEFAULT_EMAIL=your.email@gmail.com 153 | ``` 154 | 155 | More details about Pushbullet alerts are provided [here - GitHub](https://github.com/firehol/netdata/wiki/health-monitoring#pushbulletcom-push-notifications) 156 | 157 | # Setting up streaming 158 | 159 | On a client netdata set this destination to be the HOST[:PORT] of the 160 | central netdata, and give an `API_KEY` that is secret and only known internally 161 | to the netdata clients, and netdata central. See [this page - GitHub](https://github.com/firehol/netdata/wiki/Replication-Overview#options-for-the-sending-node) 162 | 163 | - NETDATA_STREAM_DESTINATION - `HOST[:PORT]` to stream to 164 | - NETDATA_STREAM_API_KEY - `API_KEY` to send to central net data 165 | 166 | ``` 167 | -e NETDATA_STREAM_DESTINATION=netdata.service:19999 -e NETDATA_STREAM_API_KEY=1h213ch12h3rc1289e 168 | ``` 169 | 170 | On the central netdata set 1 or more `NETADATA_API_KEY_ENABLE` env variables that matches the `API_KEY` 171 | that you used on the client above, this will enable the netdata client node to communicate with the netdata central 172 | 173 | - NETADATA_API_KEY_ENABLE_{API_KEY}=1 174 | 175 | ``` 176 | -e NETDATA_API_KEY_ENABLE_1h213ch12h3rc1289e=1 177 | ``` 178 | 179 | # Monitoring docker container metrics 180 | 181 | Netdata supports fetching container data from `docker.sock`. You can forward it to the netdata container with: 182 | 183 | ~~~ 184 | -v /var/run/docker.sock:/var/run/docker.sock 185 | ~~~ 186 | 187 | This will allow netdata to resolve container names. 188 | 189 | > Note: forwarding docker.sock exposes the administrative docker API. If due to some security issue access has been obtained to the container, it will expose full docker API, allowing to stop, create or delete containers, as well as download new images in the host. 190 | > 191 | > TL;DR If you care about security, consider forwarding a secure docker socket with [docker-proxy-acl](https://github.com/titpetric/docker-proxy-acl) 192 | 193 | # Monitoring docker notes on some systems (Debian jessie) 194 | 195 | On debian jessie only 'cpu' and 'disk' metrics show up under individual docker containers. To get the memory metric, you will have to add `cgroup_enable=memory swapaccount=1` to `/etc/default/grub`, appending the `GRUB_CMDLINE_LINUX_DEFAULT` variable: 196 | 197 | ~~~ 198 | $ cat /etc/default/grub | grep GRUB_CMDLINE_LINUX_DEFAULT 199 | GRUB_CMDLINE_LINUX_DEFAULT="quiet cgroup_enable=memory swapaccount=1" 200 | ~~~ 201 | 202 | After rebooting your linux instance, the memory accounting subsystem of the kernel will be enabled. Netdata will pick up additional metrics for the containers when it starts. 203 | 204 | # Environment variables 205 | 206 | It's possible to pass a NETDATA_PORT environment variable with -e, to start up netdata on a different port. 207 | 208 | ``` 209 | docker run -e NETDATA_PORT=80 [...] 210 | ``` 211 | 212 | # Some explanation is in order 213 | 214 | Docker needs to run with the SYS_PTRACE capability. Without it, the mapped host/proc filesystem is not fully readable to the netdata deamon, more specifically the "apps" plugin: 215 | 216 | ``` 217 | 16-01-12 07:58:16: ERROR: apps.plugin: Cannot process /host/proc/1/io (errno 13, Permission denied) 218 | ``` 219 | 220 | See the following link for more details: [/proc/1/environ is unavailable in a container that is not priviledged](https://github.com/docker/docker/issues/6607) 221 | 222 | # Limitations 223 | 224 | In addition to the above requirements and limitations, monitoring the complete network interface list of the host is not possible from within the Docker container. If you're running netdata and want to graph all the interfaces available on the host, you will have to use `--net=host` mode. 225 | 226 | See the following link for more details: [network interfaces missing when mounting proc inside a container](https://github.com/docker/docker/issues/13398) 227 | 228 | ## Work-around 229 | 230 | I provided a script called `fakenet.sh` which provides a copy of the `/proc/net` filesystem. You should start this script before you start the netdata container. You can do it like this: 231 | 232 | ~~~ 233 | wget https://raw.githubusercontent.com/titpetric/netdata/master/fakenet.sh 234 | chmod a+x fakenet.sh 235 | nohup ./fakenet.sh >/dev/null 2>&1 & 236 | ~~~ 237 | 238 | Using the above command, the fakenet script will start in the background and will keep running there. You can use other tools like `screen` or `tmux` to provide similar capability. 239 | 240 | The script fills out the `/dev/shm/fakenet` location, which you must mount into the container. You *must* mount it into `/fakenet/proc/net` exactly with the option like this: 241 | 242 | ~~~ 243 | -v /dev/shm/fakenet:/fakenet/proc/net 244 | ~~~ 245 | 246 | The script refreshes network information about every 250ms (four times per second). The interval may be increased to give better accuracy of netdata, but CPU usage will also increase. Because of this, the data is not very accurate and some spikes and valleys will occur because of a shifting window between when the reading was taken (fakeproc) and between when the reading was read by netdata. This means the margin for error is whatever data can be collected in ~250ms. 247 | 248 | While the solution might not fit everybody, it's security-positive because the netdata container can only inspect the fake proc/net location, and can't actually access any of the networks because it runs on a private LAN / custom network which is managed and firewalled by docker. You may even open access via application, like a nginx reverse proxy where you can add authentication etc. 249 | 250 | Pro/con list: 251 | 252 | * + network isolation stays in tact 253 | * + all network device metrics are available 254 | * - one more service to provide fakenet 255 | * - accuracy vs. cpu use is a trade-off 256 | 257 | # Additional notes 258 | 259 | Netdata provides monitoring via a plugin architecture. This plugin supports many projects that don't provide data over the `/proc` filesystem. When you're running netdata in the container, you will have difficulty providing many of these paths to the netdata container. 260 | 261 | What you do get (even with the docker version) is: 262 | 263 | * Host CPU statististics 264 | * Host Network I/O, QoS 265 | * Host Disk I/O 266 | * Applications monitoring 267 | * Container surface metrics (cpu/disk per name) 268 | 269 | You will not get detailed application metrics (mysql, ups, etc.) from other containers or from the host if running netdata in a container. It may be possible to get *some* of those metrics, but it might not be easy, and most likely not worth it. For most detailed metrics, netdata needs to share the same environment as the application server it monitors. This means it would need to run either in the same container (not even remotely practical), or in the same virtual machine (no containers). 270 | 271 | > Note: if you have some custom hardware like a UPS which is monitored via USB and netdata supports it, you will most likely need to add new software to the netdata docker image to support it. The correct way to do it is to create your own Dockerfile, start with "FROM titpetric/netdata" and then add all your installation commands to build your own image which will support your hardware setup. Most likely if it's not a very common setup (i.e. available on most machines), the software will not be added to `titpetric/netdata` - that being said, your use case might be useful for others so feel free to submit issues with your extensions or feature requests in terms of new software. I'll gladly add your project/extension to the README here. 272 | -------------------------------------------------------------------------------- /releases/v1.10.0/git-tag: -------------------------------------------------------------------------------- 1 | v1.10.0 2 | -------------------------------------------------------------------------------- /releases/v1.10.0/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | DEBIAN_FRONTEND=noninteractive 4 | 5 | # some mirrors have issues, i skipped httpredir in favor of an eu mirror 6 | 7 | echo "deb http://ftp.nl.debian.org/debian/ jessie main" > /etc/apt/sources.list 8 | echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list 9 | 10 | # install dependencies for build 11 | 12 | apt-get -qq update 13 | apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq 14 | apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml 15 | apt-get -y install ssmtp mailutils apcupsd fping 16 | 17 | # fetch netdata 18 | 19 | git clone https://github.com/firehol/netdata.git /netdata.git 20 | cd /netdata.git 21 | TAG=$( /usr/share/netdata/web/version.txt 6 | 7 | # set up ssmtp 8 | if [[ $SSMTP_TO ]]; then 9 | cat << EOF > /etc/ssmtp/ssmtp.conf 10 | root=$SSMTP_TO 11 | mailhub=$SSMTP_SERVER:$SSMTP_PORT 12 | UseSTARTTLS=$SSMTP_TLS 13 | hostname=$SSMTP_HOSTNAME 14 | FromLineOverride=NO 15 | EOF 16 | 17 | cat << EOF > /etc/ssmtp/revaliases 18 | netdata:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 19 | root:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 20 | EOF 21 | fi 22 | 23 | if [[ $SSMTP_USER ]]; then 24 | cat << EOF >> /etc/ssmtp/ssmtp.conf 25 | AuthUser=$SSMTP_USER 26 | EOF 27 | fi 28 | 29 | if [[ $SSMTP_PASS ]]; then 30 | cat << EOF >> /etc/ssmtp/ssmtp.conf 31 | AuthPass=$SSMTP_PASS 32 | EOF 33 | fi 34 | 35 | if [[ $SLACK_WEBHOOK_URL ]]; then 36 | sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 37 | fi 38 | 39 | if [[ $SLACK_CHANNEL ]]; then 40 | sed -i -e "s@DEFAULT_RECIPIENT_SLACK=\"\"@DEFAULT_RECIPIENT_SLACK=\"${SLACK_CHANNEL}\"@" /etc/netdata/health_alarm_notify.conf 41 | fi 42 | 43 | if [[ $DISCORD_WEBHOOK_URL ]]; then 44 | sed -i -e "s@DISCORD_WEBHOOK_URL=\"\"@DISCORD_WEBHOOK_URL=\"${DISCORD_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 45 | fi 46 | 47 | if [[ $DISCORD_RECIPIENT ]]; then 48 | sed -i -e "s@DEFAULT_RECIPIENT_DISCORD=\"\"@DEFAULT_RECIPIENT_DISCORD=\"${DISCORD_RECIPIENT}\"@" /etc/netdata/health_alarm_notify.conf 49 | fi 50 | 51 | if [[ $TELEGRAM_BOT_TOKEN ]]; then 52 | sed -i -e "s@TELEGRAM_BOT_TOKEN=\"\"@TELEGRAM_BOT_TOKEN=\"${TELEGRAM_BOT_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 53 | fi 54 | 55 | if [[ $TELEGRAM_CHAT_ID ]]; then 56 | sed -i -e "s@DEFAULT_RECIPIENT_TELEGRAM=\"\"@DEFAULT_RECIPIENT_TELEGRAM=\"${TELEGRAM_CHAT_ID}\"@" /etc/netdata/health_alarm_notify.conf 57 | fi 58 | 59 | if [[ $PUSHBULLET_ACCESS_TOKEN ]]; then 60 | sed -i -e "s@PUSHBULLET_ACCESS_TOKEN=\"\"@PUSHBULLET_ACCESS_TOKEN=\"${PUSHBULLET_ACCESS_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 61 | fi 62 | 63 | if [[ $PUSHBULLET_DEFAULT_EMAIL ]]; then 64 | sed -i -e "s#DEFAULT_RECIPIENT_PUSHBULLET=\"\"#DEFAULT_RECIPIENT_PUSHBULLET=\"${PUSHBULLET_DEFAULT_EMAIL}\"#" /etc/netdata/health_alarm_notify.conf 65 | fi 66 | 67 | if [[ $NETDATA_IP ]]; then 68 | NETDATA_ARGS="${NETDATA_ARGS} -i ${NETDATA_IP}" 69 | fi 70 | 71 | # on a client netdata set this destination to be the [PROTOCOL:]HOST[:PORT] of the 72 | # central netdata, and give an API_KEY that is secret and only known internally 73 | # to the netdata clients, and netdata central 74 | if [[ $NETDATA_STREAM_DESTINATION ]] && [[ $NETDATA_STREAM_API_KEY ]]; then 75 | cat << EOF > /etc/netdata/stream.conf 76 | [stream] 77 | enabled = yes 78 | destination = $NETDATA_STREAM_DESTINATION 79 | api key = $NETDATA_STREAM_API_KEY 80 | EOF 81 | fi 82 | 83 | # set 1 or more NETADATA_API_KEY_ENABLE env variables, such as NETDATA_API_KEY_ENABLE_1h213ch12h3rc1289e=1 84 | # that matches the API_KEY that you used on the client above, this will enable the netdata client 85 | # node to communicate with the netdata central 86 | if printenv | grep -q 'NETDATA_API_KEY_ENABLE_'; then 87 | printenv | grep -oe 'NETDATA_API_KEY_ENABLE_[^=]\+' | sed 's/NETDATA_API_KEY_ENABLE_//' | xargs -n1 -I{} echo '['{}$']\n\tenabled = yes' >> /etc/netdata/stream.conf 88 | fi 89 | 90 | # exec custom command 91 | if [[ $# -gt 0 ]] ; then 92 | exec "$@" 93 | exit 94 | fi 95 | 96 | if [[ -d "/fakenet/" ]]; then 97 | echo "Running fakenet config reload in background" 98 | ( sleep 10 ; curl -s http://localhost:${NETDATA_PORT}/netdata.conf | sed -e 's/# filename/filename/g' | sed -e 's/\/host\/proc\/net/\/fakenet\/proc\/net/g' > /etc/netdata/netdata.conf ; pkill -9 netdata ) & 99 | /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} 100 | # add some artificial sleep because netdata might think it can't bind to $NETDATA_PORT 101 | # and report things like "netdata: FATAL: Cannot listen on any socket. Exiting..." 102 | sleep 1 103 | fi 104 | 105 | for f in /etc/netdata/override/*; do 106 | cp -a $f /etc/netdata/ 107 | done 108 | 109 | # main entrypoint 110 | touch /etc/netdata/python.d.conf 111 | exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} "$@" 112 | -------------------------------------------------------------------------------- /releases/v1.4.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | ADD git-tag /git-tag 4 | 5 | ADD scripts/build.sh /build.sh 6 | ADD scripts/run.sh /run.sh 7 | 8 | RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh 9 | 10 | WORKDIR / 11 | 12 | ENV NETDATA_PORT=19999 SSMTP_TLS=YES SSMTP_SERVER=smtp.gmail.com SSMTP_PORT=587 SSMTP_HOSTNAME=localhost 13 | EXPOSE $NETDATA_PORT 14 | 15 | ENTRYPOINT ["/run.sh"] 16 | -------------------------------------------------------------------------------- /releases/v1.4.0/git-tag: -------------------------------------------------------------------------------- 1 | v1.4.0 2 | -------------------------------------------------------------------------------- /releases/v1.4.0/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | DEBIAN_FRONTEND=noninteractive 4 | 5 | # some mirrors have issues, i skipped httpredir in favor of an eu mirror 6 | 7 | echo "deb http://ftp.nl.debian.org/debian/ jessie main" > /etc/apt/sources.list 8 | echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list 9 | 10 | # install dependencies for build 11 | 12 | apt-get -qq update 13 | apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq 14 | apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml 15 | apt-get -y install ssmtp mailutils apcupsd 16 | 17 | # fetch netdata 18 | 19 | git clone https://github.com/firehol/netdata.git /netdata.git 20 | cd /netdata.git 21 | TAG=$( /usr/share/netdata/web/version.txt 6 | 7 | # set up ssmtp 8 | if [[ $SSMTP_TO ]] && [[ $SSMTP_USER ]] && [[ $SSMTP_PASS ]]; then 9 | cat << EOF > /etc/ssmtp/ssmtp.conf 10 | root=$SSMTP_TO 11 | mailhub=$SSMTP_SERVER:$SSMTP_PORT 12 | AuthUser=$SSMTP_USER 13 | AuthPass=$SSMTP_PASS 14 | UseSTARTTLS=$SSMTP_TLS 15 | hostname=$SSMTP_HOSTNAME 16 | FromLineOverride=NO 17 | EOF 18 | 19 | cat << EOF > /etc/ssmtp/revaliases 20 | netdata:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 21 | root:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 22 | EOF 23 | fi 24 | 25 | if [[ $SLACK_WEBHOOK_URL ]]; then 26 | sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 27 | fi 28 | 29 | if [[ $SLACK_CHANNEL ]]; then 30 | sed -i -e "s@DEFAULT_RECIPIENT_SLACK=\"\"@DEFAULT_RECIPIENT_SLACK=\"${SLACK_CHANNEL}\"@" /etc/netdata/health_alarm_notify.conf 31 | fi 32 | 33 | if [[ $TELEGRAM_BOT_TOKEN ]]; then 34 | sed -i -e "s@TELEGRAM_BOT_TOKEN=\"\"@TELEGRAM_BOT_TOKEN=\"${TELEGRAM_BOT_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 35 | fi 36 | 37 | if [[ $TELEGRAM_CHAT_ID ]]; then 38 | sed -i -e "s@DEFAULT_RECIPIENT_TELEGRAM=\"\"@DEFAULT_RECIPIENT_TELEGRAM=\"${TELEGRAM_CHAT_ID}\"@" /etc/netdata/health_alarm_notify.conf 39 | fi 40 | 41 | if [[ $PUSHBULLET_ACCESS_TOKEN ]]; then 42 | sed -i -e "s@PUSHBULLET_ACCESS_TOKEN=\"\"@PUSHBULLET_ACCESS_TOKEN=\"${PUSHBULLET_ACCESS_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 43 | fi 44 | 45 | if [[ $PUSHBULLET_DEFAULT_EMAIL ]]; then 46 | sed -i -e "s#DEFAULT_RECIPIENT_PUSHBULLET=\"\"#DEFAULT_RECIPIENT_PUSHBULLET=\"${PUSHBULLET_DEFAULT_EMAIL}\"#" /etc/netdata/health_alarm_notify.conf 47 | fi 48 | 49 | if [[ $NETDATA_IP ]]; then 50 | NETDATA_ARGS="${NETDATA_ARGS} -i ${NETDATA_IP}" 51 | fi 52 | 53 | # exec custom command 54 | if [[ $# -gt 0 ]] ; then 55 | exec "$@" 56 | exit 57 | fi 58 | 59 | if [[ -d "/fakenet/" ]]; then 60 | echo "Running fakenet config reload in background" 61 | ( sleep 10 ; curl -s http://localhost:${NETDATA_PORT}/netdata.conf | sed -e 's/# filename/filename/g' | sed -e 's/\/host\/proc\/net/\/fakenet\/proc\/net/g' > /etc/netdata/netdata.conf ; pkill -9 netdata ) & 62 | /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} 63 | # add some artificial sleep because netdata might think it can't bind to $NETDATA_PORT 64 | # and report things like "netdata: FATAL: Cannot listen on any socket. Exiting..." 65 | sleep 1 66 | fi 67 | 68 | # main entrypoint 69 | exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} 70 | -------------------------------------------------------------------------------- /releases/v1.5.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | ADD git-tag /git-tag 4 | 5 | ADD scripts/build.sh /build.sh 6 | ADD scripts/run.sh /run.sh 7 | 8 | RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh 9 | 10 | WORKDIR / 11 | 12 | ENV NETDATA_PORT=19999 SSMTP_TLS=YES SSMTP_SERVER=smtp.gmail.com SSMTP_PORT=587 SSMTP_HOSTNAME=localhost 13 | EXPOSE $NETDATA_PORT 14 | 15 | ENTRYPOINT ["/run.sh"] 16 | -------------------------------------------------------------------------------- /releases/v1.5.0/git-tag: -------------------------------------------------------------------------------- 1 | v1.5.0 2 | -------------------------------------------------------------------------------- /releases/v1.5.0/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | DEBIAN_FRONTEND=noninteractive 4 | 5 | # some mirrors have issues, i skipped httpredir in favor of an eu mirror 6 | 7 | echo "deb http://ftp.nl.debian.org/debian/ jessie main" > /etc/apt/sources.list 8 | echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list 9 | 10 | # install dependencies for build 11 | 12 | apt-get -qq update 13 | apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq 14 | apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml 15 | apt-get -y install ssmtp mailutils apcupsd 16 | 17 | # fetch netdata 18 | 19 | git clone https://github.com/firehol/netdata.git /netdata.git 20 | cd /netdata.git 21 | TAG=$( /usr/share/netdata/web/version.txt 6 | 7 | # set up ssmtp 8 | if [[ $SSMTP_TO ]] && [[ $SSMTP_USER ]] && [[ $SSMTP_PASS ]]; then 9 | cat << EOF > /etc/ssmtp/ssmtp.conf 10 | root=$SSMTP_TO 11 | mailhub=$SSMTP_SERVER:$SSMTP_PORT 12 | AuthUser=$SSMTP_USER 13 | AuthPass=$SSMTP_PASS 14 | UseSTARTTLS=$SSMTP_TLS 15 | hostname=$SSMTP_HOSTNAME 16 | FromLineOverride=NO 17 | EOF 18 | 19 | cat << EOF > /etc/ssmtp/revaliases 20 | netdata:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 21 | root:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 22 | EOF 23 | fi 24 | 25 | if [[ $SLACK_WEBHOOK_URL ]]; then 26 | sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 27 | fi 28 | 29 | if [[ $SLACK_CHANNEL ]]; then 30 | sed -i -e "s@DEFAULT_RECIPIENT_SLACK=\"\"@DEFAULT_RECIPIENT_SLACK=\"${SLACK_CHANNEL}\"@" /etc/netdata/health_alarm_notify.conf 31 | fi 32 | 33 | if [[ $TELEGRAM_BOT_TOKEN ]]; then 34 | sed -i -e "s@TELEGRAM_BOT_TOKEN=\"\"@TELEGRAM_BOT_TOKEN=\"${TELEGRAM_BOT_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 35 | fi 36 | 37 | if [[ $TELEGRAM_CHAT_ID ]]; then 38 | sed -i -e "s@DEFAULT_RECIPIENT_TELEGRAM=\"\"@DEFAULT_RECIPIENT_TELEGRAM=\"${TELEGRAM_CHAT_ID}\"@" /etc/netdata/health_alarm_notify.conf 39 | fi 40 | 41 | if [[ $PUSHBULLET_ACCESS_TOKEN ]]; then 42 | sed -i -e "s@PUSHBULLET_ACCESS_TOKEN=\"\"@PUSHBULLET_ACCESS_TOKEN=\"${PUSHBULLET_ACCESS_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 43 | fi 44 | 45 | if [[ $PUSHBULLET_DEFAULT_EMAIL ]]; then 46 | sed -i -e "s#DEFAULT_RECIPIENT_PUSHBULLET=\"\"#DEFAULT_RECIPIENT_PUSHBULLET=\"${PUSHBULLET_DEFAULT_EMAIL}\"#" /etc/netdata/health_alarm_notify.conf 47 | fi 48 | 49 | if [[ $NETDATA_IP ]]; then 50 | NETDATA_ARGS="${NETDATA_ARGS} -i ${NETDATA_IP}" 51 | fi 52 | 53 | # exec custom command 54 | if [[ $# -gt 0 ]] ; then 55 | exec "$@" 56 | exit 57 | fi 58 | 59 | if [[ -d "/fakenet/" ]]; then 60 | echo "Running fakenet config reload in background" 61 | ( sleep 10 ; curl -s http://localhost:${NETDATA_PORT}/netdata.conf | sed -e 's/# filename/filename/g' | sed -e 's/\/host\/proc\/net/\/fakenet\/proc\/net/g' > /etc/netdata/netdata.conf ; pkill -9 netdata ) & 62 | /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} 63 | # add some artificial sleep because netdata might think it can't bind to $NETDATA_PORT 64 | # and report things like "netdata: FATAL: Cannot listen on any socket. Exiting..." 65 | sleep 1 66 | fi 67 | 68 | # main entrypoint 69 | exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} 70 | -------------------------------------------------------------------------------- /releases/v1.6.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | ADD git-tag /git-tag 4 | 5 | ADD scripts/build.sh /build.sh 6 | ADD scripts/run.sh /run.sh 7 | 8 | RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh 9 | 10 | WORKDIR / 11 | 12 | ENV NETDATA_PORT=19999 SSMTP_TLS=YES SSMTP_SERVER=smtp.gmail.com SSMTP_PORT=587 SSMTP_HOSTNAME=localhost 13 | EXPOSE $NETDATA_PORT 14 | 15 | ENTRYPOINT ["/run.sh"] 16 | -------------------------------------------------------------------------------- /releases/v1.6.0/git-tag: -------------------------------------------------------------------------------- 1 | v1.6.0 2 | -------------------------------------------------------------------------------- /releases/v1.6.0/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | DEBIAN_FRONTEND=noninteractive 4 | 5 | # some mirrors have issues, i skipped httpredir in favor of an eu mirror 6 | 7 | echo "deb http://ftp.nl.debian.org/debian/ jessie main" > /etc/apt/sources.list 8 | echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list 9 | 10 | # install dependencies for build 11 | 12 | apt-get -qq update 13 | apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq 14 | apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml 15 | apt-get -y install ssmtp mailutils apcupsd 16 | 17 | # fetch netdata 18 | 19 | git clone https://github.com/firehol/netdata.git /netdata.git 20 | cd /netdata.git 21 | TAG=$( /usr/share/netdata/web/version.txt 6 | 7 | # set up ssmtp 8 | if [[ $SSMTP_TO ]] && [[ $SSMTP_USER ]] && [[ $SSMTP_PASS ]]; then 9 | cat << EOF > /etc/ssmtp/ssmtp.conf 10 | root=$SSMTP_TO 11 | mailhub=$SSMTP_SERVER:$SSMTP_PORT 12 | AuthUser=$SSMTP_USER 13 | AuthPass=$SSMTP_PASS 14 | UseSTARTTLS=$SSMTP_TLS 15 | hostname=$SSMTP_HOSTNAME 16 | FromLineOverride=NO 17 | EOF 18 | 19 | cat << EOF > /etc/ssmtp/revaliases 20 | netdata:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 21 | root:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 22 | EOF 23 | fi 24 | 25 | if [[ $SLACK_WEBHOOK_URL ]]; then 26 | sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 27 | fi 28 | 29 | if [[ $SLACK_CHANNEL ]]; then 30 | sed -i -e "s@DEFAULT_RECIPIENT_SLACK=\"\"@DEFAULT_RECIPIENT_SLACK=\"${SLACK_CHANNEL}\"@" /etc/netdata/health_alarm_notify.conf 31 | fi 32 | 33 | if [[ $TELEGRAM_BOT_TOKEN ]]; then 34 | sed -i -e "s@TELEGRAM_BOT_TOKEN=\"\"@TELEGRAM_BOT_TOKEN=\"${TELEGRAM_BOT_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 35 | fi 36 | 37 | if [[ $TELEGRAM_CHAT_ID ]]; then 38 | sed -i -e "s@DEFAULT_RECIPIENT_TELEGRAM=\"\"@DEFAULT_RECIPIENT_TELEGRAM=\"${TELEGRAM_CHAT_ID}\"@" /etc/netdata/health_alarm_notify.conf 39 | fi 40 | 41 | if [[ $PUSHBULLET_ACCESS_TOKEN ]]; then 42 | sed -i -e "s@PUSHBULLET_ACCESS_TOKEN=\"\"@PUSHBULLET_ACCESS_TOKEN=\"${PUSHBULLET_ACCESS_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 43 | fi 44 | 45 | if [[ $PUSHBULLET_DEFAULT_EMAIL ]]; then 46 | sed -i -e "s#DEFAULT_RECIPIENT_PUSHBULLET=\"\"#DEFAULT_RECIPIENT_PUSHBULLET=\"${PUSHBULLET_DEFAULT_EMAIL}\"#" /etc/netdata/health_alarm_notify.conf 47 | fi 48 | 49 | if [[ $NETDATA_IP ]]; then 50 | NETDATA_ARGS="${NETDATA_ARGS} -i ${NETDATA_IP}" 51 | fi 52 | 53 | # exec custom command 54 | if [[ $# -gt 0 ]] ; then 55 | exec "$@" 56 | exit 57 | fi 58 | 59 | if [[ -d "/fakenet/" ]]; then 60 | echo "Running fakenet config reload in background" 61 | ( sleep 10 ; curl -s http://localhost:${NETDATA_PORT}/netdata.conf | sed -e 's/# filename/filename/g' | sed -e 's/\/host\/proc\/net/\/fakenet\/proc\/net/g' > /etc/netdata/netdata.conf ; pkill -9 netdata ) & 62 | /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} 63 | # add some artificial sleep because netdata might think it can't bind to $NETDATA_PORT 64 | # and report things like "netdata: FATAL: Cannot listen on any socket. Exiting..." 65 | sleep 1 66 | fi 67 | 68 | # main entrypoint 69 | exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} 70 | -------------------------------------------------------------------------------- /releases/v1.7.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | ADD git-tag /git-tag 4 | 5 | ADD scripts/build.sh /build.sh 6 | ADD scripts/run.sh /run.sh 7 | 8 | RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh 9 | 10 | WORKDIR / 11 | 12 | ENV NETDATA_PORT=19999 SSMTP_TLS=YES SSMTP_SERVER=smtp.gmail.com SSMTP_PORT=587 SSMTP_HOSTNAME=localhost 13 | EXPOSE $NETDATA_PORT 14 | 15 | ENTRYPOINT ["/run.sh"] 16 | -------------------------------------------------------------------------------- /releases/v1.7.0/git-tag: -------------------------------------------------------------------------------- 1 | v1.7.0 2 | -------------------------------------------------------------------------------- /releases/v1.7.0/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | DEBIAN_FRONTEND=noninteractive 4 | 5 | # some mirrors have issues, i skipped httpredir in favor of an eu mirror 6 | 7 | echo "deb http://ftp.nl.debian.org/debian/ jessie main" > /etc/apt/sources.list 8 | echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list 9 | 10 | # install dependencies for build 11 | 12 | apt-get -qq update 13 | apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq 14 | apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml 15 | apt-get -y install ssmtp mailutils apcupsd 16 | 17 | # fetch netdata 18 | 19 | git clone https://github.com/firehol/netdata.git /netdata.git 20 | cd /netdata.git 21 | TAG=$( /usr/share/netdata/web/version.txt 6 | 7 | # set up ssmtp 8 | if [[ $SSMTP_TO ]]; then 9 | cat << EOF > /etc/ssmtp/ssmtp.conf 10 | root=$SSMTP_TO 11 | mailhub=$SSMTP_SERVER:$SSMTP_PORT 12 | UseSTARTTLS=$SSMTP_TLS 13 | hostname=$SSMTP_HOSTNAME 14 | FromLineOverride=NO 15 | EOF 16 | 17 | cat << EOF > /etc/ssmtp/revaliases 18 | netdata:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 19 | root:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 20 | EOF 21 | fi 22 | 23 | if [[ $SSMTP_USER ]]; then 24 | cat << EOF >> /etc/ssmtp/ssmtp.conf 25 | AuthUser=$SSMTP_USER 26 | EOF 27 | fi 28 | 29 | if [[ $SSMTP_PASS ]]; then 30 | cat << EOF >> /etc/ssmtp/ssmtp.conf 31 | AuthPass=$SSMTP_PASS 32 | EOF 33 | fi 34 | 35 | if [[ $SLACK_WEBHOOK_URL ]]; then 36 | sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 37 | fi 38 | 39 | if [[ $SLACK_CHANNEL ]]; then 40 | sed -i -e "s@DEFAULT_RECIPIENT_SLACK=\"\"@DEFAULT_RECIPIENT_SLACK=\"${SLACK_CHANNEL}\"@" /etc/netdata/health_alarm_notify.conf 41 | fi 42 | 43 | if [[ $DISCORD_WEBHOOK_URL ]]; then 44 | sed -i -e "s@DISCORD_WEBHOOK_URL=\"\"@DISCORD_WEBHOOK_URL=\"${DISCORD_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 45 | fi 46 | 47 | if [[ $DISCORD_RECIPIENT ]]; then 48 | sed -i -e "s@DEFAULT_RECIPIENT_DISCORD=\"\"@DEFAULT_RECIPIENT_DISCORD=\"${DISCORD_RECIPIENT}\"@" /etc/netdata/health_alarm_notify.conf 49 | fi 50 | 51 | if [[ $TELEGRAM_BOT_TOKEN ]]; then 52 | sed -i -e "s@TELEGRAM_BOT_TOKEN=\"\"@TELEGRAM_BOT_TOKEN=\"${TELEGRAM_BOT_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 53 | fi 54 | 55 | if [[ $TELEGRAM_CHAT_ID ]]; then 56 | sed -i -e "s@DEFAULT_RECIPIENT_TELEGRAM=\"\"@DEFAULT_RECIPIENT_TELEGRAM=\"${TELEGRAM_CHAT_ID}\"@" /etc/netdata/health_alarm_notify.conf 57 | fi 58 | 59 | if [[ $PUSHBULLET_ACCESS_TOKEN ]]; then 60 | sed -i -e "s@PUSHBULLET_ACCESS_TOKEN=\"\"@PUSHBULLET_ACCESS_TOKEN=\"${PUSHBULLET_ACCESS_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 61 | fi 62 | 63 | if [[ $PUSHBULLET_DEFAULT_EMAIL ]]; then 64 | sed -i -e "s#DEFAULT_RECIPIENT_PUSHBULLET=\"\"#DEFAULT_RECIPIENT_PUSHBULLET=\"${PUSHBULLET_DEFAULT_EMAIL}\"#" /etc/netdata/health_alarm_notify.conf 65 | fi 66 | 67 | if [[ $NETDATA_IP ]]; then 68 | NETDATA_ARGS="${NETDATA_ARGS} -i ${NETDATA_IP}" 69 | fi 70 | 71 | # on a client netdata set this destination to be the [PROTOCOL:]HOST[:PORT] of the 72 | # central netdata, and give an API_KEY that is secret and only known internally 73 | # to the netdata clients, and netdata central 74 | if [[ $NETDATA_STREAM_DESTINATION ]] && [[ $NETDATA_STREAM_API_KEY ]]; then 75 | cat << EOF > /etc/netdata/stream.conf 76 | [stream] 77 | enabled = yes 78 | destination = $NETDATA_STREAM_DESTINATION 79 | api key = $NETDATA_STREAM_API_KEY 80 | EOF 81 | fi 82 | 83 | # set 1 or more NETADATA_API_KEY_ENABLE env variables, such as NETDATA_API_KEY_ENABLE_1h213ch12h3rc1289e=1 84 | # that matches the API_KEY that you used on the client above, this will enable the netdata client 85 | # node to communicate with the netdata central 86 | if printenv | grep -q 'NETDATA_API_KEY_ENABLE_'; then 87 | printenv | grep -oe 'NETDATA_API_KEY_ENABLE_[^=]\+' | sed 's/NETDATA_API_KEY_ENABLE_//' | xargs -n1 -I{} echo '['{}$']\n\tenabled = yes' >> /etc/netdata/stream.conf 88 | fi 89 | 90 | # exec custom command 91 | if [[ $# -gt 0 ]] ; then 92 | exec "$@" 93 | exit 94 | fi 95 | 96 | if [[ -d "/fakenet/" ]]; then 97 | echo "Running fakenet config reload in background" 98 | ( sleep 10 ; curl -s http://localhost:${NETDATA_PORT}/netdata.conf | sed -e 's/# filename/filename/g' | sed -e 's/\/host\/proc\/net/\/fakenet\/proc\/net/g' > /etc/netdata/netdata.conf ; pkill -9 netdata ) & 99 | /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} 100 | # add some artificial sleep because netdata might think it can't bind to $NETDATA_PORT 101 | # and report things like "netdata: FATAL: Cannot listen on any socket. Exiting..." 102 | sleep 1 103 | fi 104 | 105 | for f in /etc/netdata/override/*; do 106 | cp -a $f /etc/netdata/ 107 | done 108 | 109 | # main entrypoint 110 | exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} "$@" 111 | -------------------------------------------------------------------------------- /releases/v1.8.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | ADD git-tag /git-tag 4 | 5 | ADD scripts/build.sh /build.sh 6 | ADD scripts/run.sh /run.sh 7 | 8 | RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh 9 | 10 | WORKDIR / 11 | 12 | ENV NETDATA_PORT=19999 SSMTP_TLS=YES SSMTP_SERVER=smtp.gmail.com SSMTP_PORT=587 SSMTP_HOSTNAME=localhost 13 | EXPOSE $NETDATA_PORT 14 | 15 | ENTRYPOINT ["/run.sh"] 16 | -------------------------------------------------------------------------------- /releases/v1.8.0/git-tag: -------------------------------------------------------------------------------- 1 | v1.8.0 2 | -------------------------------------------------------------------------------- /releases/v1.8.0/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | DEBIAN_FRONTEND=noninteractive 4 | 5 | # some mirrors have issues, i skipped httpredir in favor of an eu mirror 6 | 7 | echo "deb http://ftp.nl.debian.org/debian/ jessie main" > /etc/apt/sources.list 8 | echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list 9 | 10 | # install dependencies for build 11 | 12 | apt-get -qq update 13 | apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq 14 | apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml 15 | apt-get -y install ssmtp mailutils apcupsd 16 | 17 | # fetch netdata 18 | 19 | git clone https://github.com/firehol/netdata.git /netdata.git 20 | cd /netdata.git 21 | TAG=$( /usr/share/netdata/web/version.txt 6 | 7 | # set up ssmtp 8 | if [[ $SSMTP_TO ]]; then 9 | cat << EOF > /etc/ssmtp/ssmtp.conf 10 | root=$SSMTP_TO 11 | mailhub=$SSMTP_SERVER:$SSMTP_PORT 12 | UseSTARTTLS=$SSMTP_TLS 13 | hostname=$SSMTP_HOSTNAME 14 | FromLineOverride=NO 15 | EOF 16 | 17 | cat << EOF > /etc/ssmtp/revaliases 18 | netdata:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 19 | root:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 20 | EOF 21 | fi 22 | 23 | if [[ $SSMTP_USER ]]; then 24 | cat << EOF >> /etc/ssmtp/ssmtp.conf 25 | AuthUser=$SSMTP_USER 26 | EOF 27 | fi 28 | 29 | if [[ $SSMTP_PASS ]]; then 30 | cat << EOF >> /etc/ssmtp/ssmtp.conf 31 | AuthPass=$SSMTP_PASS 32 | EOF 33 | fi 34 | 35 | if [[ $SLACK_WEBHOOK_URL ]]; then 36 | sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 37 | fi 38 | 39 | if [[ $SLACK_CHANNEL ]]; then 40 | sed -i -e "s@DEFAULT_RECIPIENT_SLACK=\"\"@DEFAULT_RECIPIENT_SLACK=\"${SLACK_CHANNEL}\"@" /etc/netdata/health_alarm_notify.conf 41 | fi 42 | 43 | if [[ $DISCORD_WEBHOOK_URL ]]; then 44 | sed -i -e "s@DISCORD_WEBHOOK_URL=\"\"@DISCORD_WEBHOOK_URL=\"${DISCORD_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 45 | fi 46 | 47 | if [[ $DISCORD_RECIPIENT ]]; then 48 | sed -i -e "s@DEFAULT_RECIPIENT_DISCORD=\"\"@DEFAULT_RECIPIENT_DISCORD=\"${DISCORD_RECIPIENT}\"@" /etc/netdata/health_alarm_notify.conf 49 | fi 50 | 51 | if [[ $TELEGRAM_BOT_TOKEN ]]; then 52 | sed -i -e "s@TELEGRAM_BOT_TOKEN=\"\"@TELEGRAM_BOT_TOKEN=\"${TELEGRAM_BOT_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 53 | fi 54 | 55 | if [[ $TELEGRAM_CHAT_ID ]]; then 56 | sed -i -e "s@DEFAULT_RECIPIENT_TELEGRAM=\"\"@DEFAULT_RECIPIENT_TELEGRAM=\"${TELEGRAM_CHAT_ID}\"@" /etc/netdata/health_alarm_notify.conf 57 | fi 58 | 59 | if [[ $PUSHBULLET_ACCESS_TOKEN ]]; then 60 | sed -i -e "s@PUSHBULLET_ACCESS_TOKEN=\"\"@PUSHBULLET_ACCESS_TOKEN=\"${PUSHBULLET_ACCESS_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 61 | fi 62 | 63 | if [[ $PUSHBULLET_DEFAULT_EMAIL ]]; then 64 | sed -i -e "s#DEFAULT_RECIPIENT_PUSHBULLET=\"\"#DEFAULT_RECIPIENT_PUSHBULLET=\"${PUSHBULLET_DEFAULT_EMAIL}\"#" /etc/netdata/health_alarm_notify.conf 65 | fi 66 | 67 | if [[ $NETDATA_IP ]]; then 68 | NETDATA_ARGS="${NETDATA_ARGS} -i ${NETDATA_IP}" 69 | fi 70 | 71 | # on a client netdata set this destination to be the [PROTOCOL:]HOST[:PORT] of the 72 | # central netdata, and give an API_KEY that is secret and only known internally 73 | # to the netdata clients, and netdata central 74 | if [[ $NETDATA_STREAM_DESTINATION ]] && [[ $NETDATA_STREAM_API_KEY ]]; then 75 | cat << EOF > /etc/netdata/stream.conf 76 | [stream] 77 | enabled = yes 78 | destination = $NETDATA_STREAM_DESTINATION 79 | api key = $NETDATA_STREAM_API_KEY 80 | EOF 81 | fi 82 | 83 | # set 1 or more NETADATA_API_KEY_ENABLE env variables, such as NETDATA_API_KEY_ENABLE_1h213ch12h3rc1289e=1 84 | # that matches the API_KEY that you used on the client above, this will enable the netdata client 85 | # node to communicate with the netdata central 86 | if printenv | grep -q 'NETDATA_API_KEY_ENABLE_'; then 87 | printenv | grep -oe 'NETDATA_API_KEY_ENABLE_[^=]\+' | sed 's/NETDATA_API_KEY_ENABLE_//' | xargs -n1 -I{} echo '['{}$']\n\tenabled = yes' >> /etc/netdata/stream.conf 88 | fi 89 | 90 | # exec custom command 91 | if [[ $# -gt 0 ]] ; then 92 | exec "$@" 93 | exit 94 | fi 95 | 96 | if [[ -d "/fakenet/" ]]; then 97 | echo "Running fakenet config reload in background" 98 | ( sleep 10 ; curl -s http://localhost:${NETDATA_PORT}/netdata.conf | sed -e 's/# filename/filename/g' | sed -e 's/\/host\/proc\/net/\/fakenet\/proc\/net/g' > /etc/netdata/netdata.conf ; pkill -9 netdata ) & 99 | /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} 100 | # add some artificial sleep because netdata might think it can't bind to $NETDATA_PORT 101 | # and report things like "netdata: FATAL: Cannot listen on any socket. Exiting..." 102 | sleep 1 103 | fi 104 | 105 | for f in /etc/netdata/override/*; do 106 | cp -a $f /etc/netdata/ 107 | done 108 | 109 | # main entrypoint 110 | exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} "$@" 111 | -------------------------------------------------------------------------------- /releases/v1.9.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | ADD git-tag /git-tag 4 | 5 | ADD scripts/build.sh /build.sh 6 | ADD scripts/run.sh /run.sh 7 | 8 | RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh 9 | 10 | WORKDIR / 11 | 12 | ENV NETDATA_PORT=19999 SSMTP_TLS=YES SSMTP_SERVER=smtp.gmail.com SSMTP_PORT=587 SSMTP_HOSTNAME=localhost 13 | EXPOSE $NETDATA_PORT 14 | 15 | VOLUME /etc/netdata/override 16 | 17 | ENTRYPOINT ["/run.sh"] 18 | -------------------------------------------------------------------------------- /releases/v1.9.0/git-tag: -------------------------------------------------------------------------------- 1 | v1.9.0 2 | -------------------------------------------------------------------------------- /releases/v1.9.0/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | DEBIAN_FRONTEND=noninteractive 4 | 5 | # some mirrors have issues, i skipped httpredir in favor of an eu mirror 6 | 7 | echo "deb http://ftp.nl.debian.org/debian/ jessie main" > /etc/apt/sources.list 8 | echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list 9 | 10 | # install dependencies for build 11 | 12 | apt-get -qq update 13 | apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq 14 | apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml 15 | apt-get -y install ssmtp mailutils apcupsd 16 | 17 | # fetch netdata 18 | 19 | git clone https://github.com/firehol/netdata.git /netdata.git 20 | cd /netdata.git 21 | TAG=$( /usr/share/netdata/web/version.txt 6 | 7 | # set up ssmtp 8 | if [[ $SSMTP_TO ]]; then 9 | cat << EOF > /etc/ssmtp/ssmtp.conf 10 | root=$SSMTP_TO 11 | mailhub=$SSMTP_SERVER:$SSMTP_PORT 12 | UseSTARTTLS=$SSMTP_TLS 13 | hostname=$SSMTP_HOSTNAME 14 | FromLineOverride=NO 15 | EOF 16 | 17 | cat << EOF > /etc/ssmtp/revaliases 18 | netdata:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 19 | root:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT 20 | EOF 21 | fi 22 | 23 | if [[ $SSMTP_USER ]]; then 24 | cat << EOF >> /etc/ssmtp/ssmtp.conf 25 | AuthUser=$SSMTP_USER 26 | EOF 27 | fi 28 | 29 | if [[ $SSMTP_PASS ]]; then 30 | cat << EOF >> /etc/ssmtp/ssmtp.conf 31 | AuthPass=$SSMTP_PASS 32 | EOF 33 | fi 34 | 35 | if [[ $SLACK_WEBHOOK_URL ]]; then 36 | sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 37 | fi 38 | 39 | if [[ $SLACK_CHANNEL ]]; then 40 | sed -i -e "s@DEFAULT_RECIPIENT_SLACK=\"\"@DEFAULT_RECIPIENT_SLACK=\"${SLACK_CHANNEL}\"@" /etc/netdata/health_alarm_notify.conf 41 | fi 42 | 43 | if [[ $DISCORD_WEBHOOK_URL ]]; then 44 | sed -i -e "s@DISCORD_WEBHOOK_URL=\"\"@DISCORD_WEBHOOK_URL=\"${DISCORD_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf 45 | fi 46 | 47 | if [[ $DISCORD_RECIPIENT ]]; then 48 | sed -i -e "s@DEFAULT_RECIPIENT_DISCORD=\"\"@DEFAULT_RECIPIENT_DISCORD=\"${DISCORD_RECIPIENT}\"@" /etc/netdata/health_alarm_notify.conf 49 | fi 50 | 51 | if [[ $TELEGRAM_BOT_TOKEN ]]; then 52 | sed -i -e "s@TELEGRAM_BOT_TOKEN=\"\"@TELEGRAM_BOT_TOKEN=\"${TELEGRAM_BOT_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 53 | fi 54 | 55 | if [[ $TELEGRAM_CHAT_ID ]]; then 56 | sed -i -e "s@DEFAULT_RECIPIENT_TELEGRAM=\"\"@DEFAULT_RECIPIENT_TELEGRAM=\"${TELEGRAM_CHAT_ID}\"@" /etc/netdata/health_alarm_notify.conf 57 | fi 58 | 59 | if [[ $PUSHBULLET_ACCESS_TOKEN ]]; then 60 | sed -i -e "s@PUSHBULLET_ACCESS_TOKEN=\"\"@PUSHBULLET_ACCESS_TOKEN=\"${PUSHBULLET_ACCESS_TOKEN}\"@" /etc/netdata/health_alarm_notify.conf 61 | fi 62 | 63 | if [[ $PUSHBULLET_DEFAULT_EMAIL ]]; then 64 | sed -i -e "s#DEFAULT_RECIPIENT_PUSHBULLET=\"\"#DEFAULT_RECIPIENT_PUSHBULLET=\"${PUSHBULLET_DEFAULT_EMAIL}\"#" /etc/netdata/health_alarm_notify.conf 65 | fi 66 | 67 | if [[ $NETDATA_IP ]]; then 68 | NETDATA_ARGS="${NETDATA_ARGS} -i ${NETDATA_IP}" 69 | fi 70 | 71 | # on a client netdata set this destination to be the [PROTOCOL:]HOST[:PORT] of the 72 | # central netdata, and give an API_KEY that is secret and only known internally 73 | # to the netdata clients, and netdata central 74 | if [[ $NETDATA_STREAM_DESTINATION ]] && [[ $NETDATA_STREAM_API_KEY ]]; then 75 | cat << EOF > /etc/netdata/stream.conf 76 | [stream] 77 | enabled = yes 78 | destination = $NETDATA_STREAM_DESTINATION 79 | api key = $NETDATA_STREAM_API_KEY 80 | EOF 81 | fi 82 | 83 | # set 1 or more NETADATA_API_KEY_ENABLE env variables, such as NETDATA_API_KEY_ENABLE_1h213ch12h3rc1289e=1 84 | # that matches the API_KEY that you used on the client above, this will enable the netdata client 85 | # node to communicate with the netdata central 86 | if printenv | grep -q 'NETDATA_API_KEY_ENABLE_'; then 87 | printenv | grep -oe 'NETDATA_API_KEY_ENABLE_[^=]\+' | sed 's/NETDATA_API_KEY_ENABLE_//' | xargs -n1 -I{} echo '['{}$']\n\tenabled = yes' >> /etc/netdata/stream.conf 88 | fi 89 | 90 | # exec custom command 91 | if [[ $# -gt 0 ]] ; then 92 | exec "$@" 93 | exit 94 | fi 95 | 96 | if [[ -d "/fakenet/" ]]; then 97 | echo "Running fakenet config reload in background" 98 | ( sleep 10 ; curl -s http://localhost:${NETDATA_PORT}/netdata.conf | sed -e 's/# filename/filename/g' | sed -e 's/\/host\/proc\/net/\/fakenet\/proc\/net/g' > /etc/netdata/netdata.conf ; pkill -9 netdata ) & 99 | /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} 100 | # add some artificial sleep because netdata might think it can't bind to $NETDATA_PORT 101 | # and report things like "netdata: FATAL: Cannot listen on any socket. Exiting..." 102 | sleep 1 103 | fi 104 | 105 | for f in /etc/netdata/override/*; do 106 | cp -a $f /etc/netdata/ 107 | done 108 | 109 | # main entrypoint 110 | touch /etc/netdata/python.d.conf 111 | exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} "$@" 112 | -------------------------------------------------------------------------------- /update-releases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # It should go without saying, this script is for development/deployment purposes 4 | # only. If a new tag is added into `netdata/netdata`, this creates the corresponding 5 | # directory (symlink) structure. Most likely, it should be deleted because the build 6 | # steps for netdata have and will change over time. What is symlinked today, will 7 | # not be accurate in the future, as the Dockerfiles are currently maintained only 8 | # for the master branch. Results may vary. 9 | # 10 | # And of course, there's the small issue to add individual tags manually to Docker Hub. 11 | # 12 | rm update-releases.json 13 | if [ ! -f "update-releases.json" ]; then 14 | curl -s https://api.github.com/repos/netdata/netdata/tags > update-releases.json 15 | fi 16 | TAGS=$(cat update-releases.json | jq -r ".[].name" | grep -v 'rc') 17 | for TAG in $TAGS; do 18 | if [ -d "releases/$TAG" ]; then 19 | # tags are sorted, don't create older than the latest created tag 20 | echo "Done, latest tags are up to date" 21 | exit 22 | fi 23 | 24 | TAG=${TAG/v/} 25 | if [ -d ".git/refs/tags/$TAG" ]; then 26 | # tags are sorted, don't create older than the latest created tag 27 | echo "Done, latest tags are up to date" 28 | exit 29 | fi 30 | 31 | 32 | echo "Creating tag: $TAG" 33 | git tag $TAG 34 | done 35 | --------------------------------------------------------------------------------