lsfilter: Add support for non-timestamp date formats
[ninja.git] / install_scripts / nacoma_hooks.py
blob832e835eb935c7ff95f67d2d7813f82f6975977b
1 #!/usr/bin/env python
3 import sys, subprocess
4 from nacoma.hooks import Change
6 reportable_types = ['host', 'service', 'hostgroup', 'servicegroup']
8 for line in sys.stdin:
9 change = Change(line)
10 if change.type not in reportable_types:
11 continue
12 if change.is_renamed():
13 output = subprocess.Popen(['/usr/bin/php', '/opt/monitor/op5/ninja/index.php', 'cli/handle_rename/%s/%s/%s' % (change.type, change.oldname, change.newname)], stdout=subprocess.PIPE).communicate()[0]
14 elif change.is_deleted():
15 output = subprocess.Popen(['/usr/bin/php', '/opt/monitor/op5/ninja/index.php', 'cli/handle_deletion/%s/%s' % (change.type, change.oldname)], stdout=subprocess.PIPE).communicate()[0]