Skip to content

Commit 5e0099f

Browse files
authored
Merge pull request #562 from google/sighup
mtail doesn't automatically reload programmes.
2 parents b306aff + e6d8806 commit 5e0099f

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

docs/Deploying.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mtail is intended to run one per machine, and serve as monitoring glue for multi
66

77
## Configuration Overview
88

9-
mtail is configured through commandline flags.
9+
mtail is configured with commandline flags.
1010

1111
The `--help` flag will print a list of flags for configuring `mtail`.
1212

@@ -99,6 +99,26 @@ Read the [Programming Guide](Programming-Guide.md) for instructions on how to wr
9999

100100
`mtail` does not automatically reload programmes after it starts up. To ask `mtail` to scan for and reload programmes from the supplied `--progs` directory, send it a `SIGHUP` signal on UNIX-like systems.
101101

102+
For example, if configs are being delivered by a configuration management tool like Puppet, then program Puppet to send a SIGHUP when it has copied a new config file over.
103+
104+
```puppet
105+
exec { 'reload_mtail_programmes':
106+
command => "killall -HUP mtail",
107+
refreshonly = True,
108+
}
109+
110+
file { mtail_programme:
111+
source => mtail_programme,
112+
notify => Exec['reload_mtail_programmes'],
113+
}
114+
```
115+
116+
Alternatively, if you're using `scp` or some similiar method to copy the programme files without a receiver, then either follow it with a `ssh $host 'killall -HUP mtail'` or use a tool like [`inotifywait`](https://linux.die.net/man/1/inotifywait) in a side process next to mtail to watch for changes and send the reload signal.
117+
118+
```shell
119+
inotifywait /etc/mtail/progs | while read event; do killall -HUP mtail; done
120+
```
121+
102122
## Getting the Metrics Out
103123

104124
### Pull based collection

docs/faq.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,11 @@ So, given that the monitoring system needs to handle missing and resetting data
8787
already in a distributed system, there is no compelling reason to implement
8888
metric checkpointing in `mtail` as well. It just adds complexity for little
8989
overall gain.
90+
91+
## Why doesn't `mtail` automatically reload programme files?
92+
93+
`mtail` will reload programme files when it receives a `SIGHUP` signal.
94+
95+
It's assumed that programmes do not change very often, so it relies on an external trigger rather than spend resourecs of its own polling for changes at all. `inotify` is not used either, as programme reloads would be the only use of that library, and the benefit does not seem worth the cost of including the extra dependency.
96+
97+
See the [Deployment](Deployment.md) guide for suggestions for "automatic" programme reloads.

0 commit comments

Comments
 (0)