-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
264 lines (228 loc) · 11.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<!doctype html>
<!-- The Time Machine GitHub pages theme was designed and developed by Jon Rohan, on Feb 7, 2012. -->
<!-- Follow him for fun. http://twitter.com/jonrohan. Tail his code on http://github.com/jonrohan -->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="stylesheets/stylesheet.css" media="screen"/>
<link rel="stylesheet" href="stylesheets/local.css" media="screen"/>
<link rel="stylesheet" href="stylesheets/pygment_trac.css"/>
<link href="google-code-prettify/sunburst.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="google-code-prettify/prettify.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="javascripts/script.js"></script>
<title>pynag.org</title>
<meta name="description" content="Pynag - Nagios Configuration, Status and Plugin development for Python">
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body onload="prettyPrint()">
<div class="wrapper">
<header>
<h1 class="title">pynag.org</h1><script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
</header>
<div id="container">
<p class="tagline">Python Modules for parsing Nagios configuration and writing plugins <g:plusone></g:plusone></p>
<div id="main" role="main">
<div class="download-bar">
<div class="inner">
<a href="https://github.com/pynag/pynag" class="code">View pynag.org on GitHub</a>
</div>
<span class="blc"></span><span class="trc"></span>
</div>
<article class="markdown-body">
<h3>What is pynag?</h3>
<p>
<small>py, as in python. nag, as in nagios</small>
</p>
<p>
<strong>Latest</strong> <strong class="emphasize"><a href="#news">0.8.2</a></strong>
</p>
<p>
<strong class="emphasize"><a href="https://github.com/pynag/pynag/wiki">Install Instructions</a></strong>
</p>
<h4>OK, but what does it do?</h4>
<p>
<ul>
<li><strong class="emphasize"><a href="#parse">Parse</a></strong> Nagios Configuration trees</li>
<li><strong class="emphasize"><a href="#manipulate">Manipulate</a></strong> Nagios Configurations</li>
<li><strong class="emphasize"><a href="#cli">Command Line</a></strong> tool for viewing and updating Nagios Configurations</li>
<li>Provides a <strong class="emphasize">Plugin</strong> writing framework</li>
<br/>
More info and documentation on <a href="https://github.com/pynag/pynag/wiki">https://github.com/pynag/pynag/wiki</a>
</ul>
</p>
<a name="parse"><h3>Let's Parse some configs!</h3></a>
<p>Parse the configuration, print information on hosts</p>
<pre class="prettyprint linenums">from pynag import Model
# Get all hosts
all_hosts = Model.Host.objects.all
for i in all_hosts:
print i.host_name, i.contact_groups </pre>
<a name="manipulate"><h3>We can also change Configs!</h3></a>
<p>Find all services belonging to "examplehost" and change contactgroups</p>
<pre class="prettyprint linenums">from pynag import Model
services = Model.Service.objects.filter(host_name='examplehost')
for i in services:
i.contactgroups = "mycontactgroup"
i.save() </pre>
<a name="cli"><h3>Command Line Interface</h3></a>
<p><strong class="emphasize">List</strong> objects by hostname</p>
<pre class="">$ pynag list object_type shortname where host_name="pynag.github.com"
object_type shortname
--------------------------------------------------------------------
host pynag.github.com
service pynag.github.com/Ping
service pynag.github.com/http://pynag.github.com
service pynag.github.com/SSH Connectivity
----------5 objects matches search condition------------------------</pre>
<br/>
<p><strong class="emphasize">Update</strong> hostname</p>
<pre class="">
$ pynag update host_name="www1" where host_name="www1.example.com"
object_type shortname
------------------------------------------------------------------
host www1.example.com
service www1.example.com/Ping
service www1.example.com/http://www1.example.com
service www1.example.com/SSH Connectivity
----------4 objects matches search condition----------------------
Update these 4 objects ? (y/N)
</pre>
<a name="news"><h3>News</h3></a>
<p><strong class="emphasize"><small>28. Jun 2013</small> Released 0.5.0</strong></p>
<p>
<p>pynag 0.5.0 is out!</p>
<p>Many enhancements and bugfixes, most notably towards unit testing, parsing performance and mk-livestatus tcp support</p>
<h6>New Features:</h6>
<ul>
<li>pynag cli - new action "unset" to remove attributes when updating</li>
<li>PluginHelper - New option --pnp-compatible-perfdata</li>
<li>TCP Support for mk-livestatus</li>
<li>ObjectDefinitions now have new method: set_macro()</li>
<li>Vast improvements to unit testing</li>
<li>Fix unhandled tracebacks if invalid templates are defined</li>
<li>Utils.GitRepo has new method: show()</li>
<li>Vast performance improvement in parsing</li>
<li>ObjectDefinition now iterable</li>
<li>New Utility Class pynag.Utils.PluginOutput</li>
<li>ObjectDefinition: magic fields like shortname are now part of keys()</li>
<li>mk_livestatus new utility methods: get_servicegroups,hostgroups,etc</li>
</ul>
<h6>Noteworthy bug fixes:</h6>
<ul>
<li>travis-ci and coveralls.io support</li>
<li>Macroresolving when ARG1 contains other macros</li>
<li>get_suggested_filename() no longer returns filenames with invalid characters</li>
<li>check_range(): Always return True on invalid range_format</li>
<li>check_range(): raise exception on invalid input thresholds</li>
</ul>
</p>
<p><strong class="emphasize"><small>30. Apr 2013</small> Released 0.4.9</strong></p>
<p>The major changes in this release is mk-livestatus integration into the command line interface, the addition of a Parsers.LogFiles which gives API access to the Nagios logfiles:</p>
<p>
<pre class="prettyprint linenums">
$ pynag livestatus --get hosts --columns "name state last_state_change" --limit 10
name state last_state_change
--------------------------------------------------------------------------------
Aftonian.example.com 0 1364979198
Ariminum.example.com 0 1364979198
Bashee.example.com 0 1364979198
Bernina.example.com 0 1364978625
Branchiopoda.example.com 0 1364979198
CRFMP.example.com 0 1364978626
Cassadaga.example.com 0 1364979198
Dieri.example.com 0 1364979198
Dorididae.example.com 0 1364978627
Drago.example.com 0 1364979198
----------10 objects matches search condition-----------------------------------
</pre>
<h6>New Features:</h6>
<ul>
<li>pynag cli now has livestatus subcommand</li>
<li>pynag cli multiple changes to make it more friendly to bash scripts</li>
<li>pynag cli has acknowledge and downtime subcommands</li>
<li>pynag.Model.*.delete() now are more context aware and remove references from other objects</li>
<li>More features in pynag.Utils.GitRepo</li>
<li>Parser for retention.dat created</li>
<li>pynag.utils.grep_to_livestatus() to convert from pynag style filters to livestatus style filters</li>
<li>add_to_contactgroup() created for pynag.Model.Services, Hosts, and Contacts</li>
<li>New functions pynag.Utils.grep(). Model filter() will use this in the future</li>
<li>pynag.Model - object definitions now implement sort()</li>
<li>pynag.Parsers.Logfiles added to parse nagios log files</li>
</ul>
<h6>Bugfixes:</h6>
<ul>
<li>Multiple doctest and unittest fixes and improvements to code quality</li>
<li>send_nsca - revert back to tabs instead of spaces</li>
<li>Fix unhandled traceback with pynag copy</li>
<li>Fix bug where directories with ending .cfg were parsed as files</li>
<li>PluginHelper fixed in accordance to <a href="http://nagiosplugins.org/rfc/new_threshold_syntax">http://nagiosplugins.org/rfc/new_threshold_syntax</a></li>
</ul>
</p>
<p><strong class="emphasize"><small>12. Dec 2012</small> Released 0.4.8</strong></p>
<p>
<p>We are happy to announce release 0.4.8 version of pynag.</p>
<p>The major change in this release is the inclusion of mklivestatus interface which allows for faster access to nagios status information:</p>
</p>
<p>
<pre class="prettyprint linenums">
from pynag.Plugins import mk_livestatus
livestatus = mk_livestatus()
for service in livestatus.get_services():
print service['host_name'], service['description'], service['state']
</pre>
<h6>New Features:</h6>
<ul>
<li>MK Livestatus integration in pynag.Parsers.mk_livestatus</li>
<li>Testing framework for plugins in scripts/plugintest</li>
<li>Control.Command now uses livestatus if available.</li>
<li>pynag.Plugins.PluginHelper() prototype</li>
<li>Support for Nagios plugins new threshold format</li>
</ul>
<h6>Bugfixes:</h6>
<ul>
<li>New Service() objects with no host_name are not saved in None/service_description anymore.</li>
<li>GitEventHandler could not list files with spaces</li>
<li>pynag.Plugins.simple.check_range was very broken, fixed and added testing framework
for pynag.Plugins</li>
<li>Fix for correctly returning exit codes in Control.daemon()</li>
<li>Static file parser now skips line not in format of key=value</li>
<li>pynag.Parsers.status.get_hoststatus() and pynag.Parsers.status.get_servicestatus() should raise a ValueError rather than return it.</li>
<li>timeperiod_name and alias were incorrectly saved </li>
<li>Unhandled exception in contact.get_effective_services()</li>
</ul>
</p>
</div>
</div>
<footer>
<div class="owner">
<p><a href="https://github.com/pynag/pynag" class="avatar"><img src="https://secure.gravatar.com/avatar/468441cbfa533b173db0ce098336d617?s=30&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" width="48" height="48"/></a>View <a href="https://github.com/pynag/pynag">pynag</a> on <a href="https://www.github.com">GitHub</a></p>
</div>
<div class="creds">
<small>This page generated using <a href="https://pages.github.com/">GitHub Pages</a><br/>theme by <a href="http://twitter.com/jonrohan/">Jon Rohan</a></small>
</div>
</footer>
</div>
<div class="current-section">
<a href="#top">Scroll to top</a>
<a href="https://github.com/pynag/pynag.github.com/tarball/master" class="tar">tar</a><a href="https://github.com/pynag/pynag.github.com/zipball/master" class="zip">zip</a><a href="" class="code">source code</a>
<p class="name"></p>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36997265-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!--[if !(lt IE 8)]><!-->
<script type="text/javascript">
var tdwfb_config={greeting:"Dear Internet Users",disableDate:false,callOnly:true};(function(){var e=document.createElement("script");e.type="text/javascript";e.async=true;e.src=document.location.protocol+"//d1agz031tafz8n.cloudfront.net/thedaywefightback.js/widget.min.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})()
</script>
<!--<![endif]-->
</body>
</html>