From ecd1edf23b263e5a88107179489b433742fb17c9 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 14 Oct 2013 01:46:55 +0200 Subject: Add an actual News page Initial support for News pages had been committed already, this commit completes that support and adds an actual News page. News pages (with up to ten articles) are auto-created from any pages that have the "date" attribute set. diff --git a/etc/nginx/site.conf b/etc/nginx/site.conf index 90ceaea..eb8c5e8 100644 --- a/etc/nginx/site.conf +++ b/etc/nginx/site.conf @@ -68,6 +68,9 @@ server { location ^~ /taxonomy/term/2 { return 301 /doc/presentation.html; } + location ~ ^/doc/release-notes/(.*)$ { + return 301 /news/release-$1; + } location ~ ^/(?:man.*|guidelines|extra-opts)$ { return 301 /doc$request_uri.html; } diff --git a/web/input/development.md b/web/input/development.md index ddff634..9a1a72f 100644 --- a/web/input/development.md +++ b/web/input/development.md @@ -1,6 +1,6 @@ title: Development parent: Home -menu-position: 5 +menu: 6 --- # Development diff --git a/web/input/doc/index.md b/web/input/doc/index.md index 7b2d098..8f22011 100644 --- a/web/input/doc/index.md +++ b/web/input/doc/index.md @@ -1,6 +1,6 @@ title: Documentation parent: Home -menu-position: 3 +menu: 4 --- # Documentation diff --git a/web/input/doc/release-notes/1-5.md b/web/input/doc/release-notes/1-5.md deleted file mode 100644 index f68222f..0000000 --- a/web/input/doc/release-notes/1-5.md +++ /dev/null @@ -1,97 +0,0 @@ -title: Version 1.5 -parent: Download -post: Version 1.5 Released -date: 2013-10-02 ---- - -# Version 1.5 Released - -*Wednesday, October 2, 2013* - -The Nagios Plugins Development Team is proud to announce version 1.5 of the -Nagios Plugins! This release comes with the new `check_dbi` plugin written by -Sebastian Harl, and includes lots of enhancements and fixes provided by more -than forty contributors. Many thanks to all of you! - -Special kudos go to Sven Nierlein for fixing numerous bugs, reviewing many -pull requests, bringing our test suite back into shape, and setting up -automated tests on a variety of platforms. This helped us spotting lots of -bugs *before* the release. Let me also thank Ton Voon for doing the -unenviable work of updating the bundled Perl modules; and our newest team -member Jan Wagner for all his help with patch review. - -See below for a list of major changes. Note that the new `check_http` version -introduces two minor backwards incompatibilities mentioned at the end of that -list, so please be sure to check whether they might affect you. - -You can get the tarball from our [download page][download]. - -## Enhancements - -* New `check_dbi` plugin for checking an (SQL) database using DBI -* Let OpenSSL load its configuration file (see the `OPENSSL_config(3)` man - page) -* Add performance data to `check_apt` -* Add performance data to `check_procs` -* Added `-4`/`-6` options to `check_dig` -* New `check_oracle` `--connect` option to perform real login -* New `check_nagios` `-t` option to override the default timeout -* New `check_disk` `-f`/`--freespace-ignore-reserved` option to ignore space - reserved for root -* New `check_disk` `-N`/`--include-type` option to limit the filesystem types - to check -* Allow for building the plugins in parallel -* Add `--without-{dbi,ldap,radius}` options to `./configure` -* Made Verbose output of `check_sensors` compliant -* New switch `-E`/`--extended-perfdata` for `check_http` to print additional - performance data -* New `check_http` `-d` option to specify a string to expect within the - response headers -* New `check_http` `-J`/`-K` options for client certificate authentication - support -* Add support for executing queries to `check_pgsql` -* Let `check_pgsql` accept a UNIX socket directory as hostname -* New `check_pgsql` `-o` option to specify additional connection parameters -* New `check_fping` `-S` option to specify the source IP address -* New `check_fping` `-I` option to specify the interface to bind to -* Let `check_fping` support IPv6 -* New `check_procs` `-k` option to ignore kernel threads (on Linux) -* Let `check_procs` use `/proc//exe` (if available) instead of - `getpid(2)`, unless `-T` is specified -* Let `check_mysql` support SSL -* Let `check_mysql` add perfromance metrics for all checks -* New `check_mysql` `-f` option to specify a client options file -* New `check_mysql` `-g` option to specify a client options group -* New `check_snmp` `--offset` option to allow for adding/substracting an - offset value to sensor data -* Let `check_snmp` support an arbitrary number of OIDs -* Let `check_ide_smart` support NetBSD - -## Fixes - -* Change the MAIL FROM command generated by `check_smtp` to be RFC compliant -* Fix compilation of `check_http` without SSL support -* Fix `check_snmp` reversed threshold ranges (backward-compatibility) -* Fix `check_snmp` memory violation when using more than 8 OIDs -* Fix `check_apt` security regular expression -* Fix `check_http` handling extra header (`-k`) containing semicolons -* Fix `check_apt` handling unknown exit codes from apt-get -* Fix deprecated imports of `check_nmap.py` - -## Warnings - -* `check_http` behaviour of `-k`/`--header` changed since it does not separate - multiple headers by semicolons anymore. Use multiple `-k` switches instead. -* `check_http`'s `--proxy_authorization` option is now called - `--proxy-authorization` (it was always documented this way) -* The [contrib directory][contrib] has been removed. These days, sites such - as [Nagios Exchange][nag-exchange] and [Monitoring Exchange][mon-exchange] - serve as much better places for publishing plugins not maintained by the - Nagios Plugins Development Team. - -[download]: /download.html -[contrib]: https://github.com/nagios-plugins/nagios-plugins/tree/7a80e27fb38b26713ac5a1f6810b99519a31dbf3/contrib -[nag-exchange]: http://exchange.nagios.org/ -[mon-exchange]: https://www.monitoringexchange.org/ - - diff --git a/web/input/download.md b/web/input/download.md index 4d46cf5..9c3d65b 100644 --- a/web/input/download.md +++ b/web/input/download.md @@ -1,6 +1,6 @@ title: Download parent: Home -menu-position: 2 +menu: 3 --- # Download diff --git a/web/input/index.md b/web/input/index.md index 8ab186c..b860177 100644 --- a/web/input/index.md +++ b/web/input/index.md @@ -1,5 +1,5 @@ title: Home -menu-position: 1 +menu: 1 --- # The Nagios Plugins Project diff --git a/web/input/news/release-1-5.md b/web/input/news/release-1-5.md new file mode 100644 index 0000000..58d0822 --- /dev/null +++ b/web/input/news/release-1-5.md @@ -0,0 +1,93 @@ +title: Version 1.5 Released +date: 2013-10-02 +--- + +The Nagios Plugins Development Team is proud to announce version 1.5 of the +Nagios Plugins! This release comes with the new `check_dbi` plugin written by +Sebastian Harl, and includes lots of enhancements and fixes provided by more +than forty contributors. Many thanks to all of you! + + + +Special kudos go to Sven Nierlein for fixing numerous bugs, reviewing many +pull requests, bringing our test suite back into shape, and setting up +automated tests on a variety of platforms. This helped us spotting lots of +bugs *before* the release. Let me also thank Ton Voon for doing the +unenviable work of updating the bundled Perl modules; and our newest team +member Jan Wagner for all his help with patch review. + +See below for a list of major changes. Note that the new `check_http` version +introduces two minor backwards incompatibilities mentioned at the end of that +list, so please be sure to check whether they might affect you. + +You can get the tarball from our [download page][download]. + +## Enhancements + +* New `check_dbi` plugin for checking an (SQL) database using DBI +* Let OpenSSL load its configuration file (see the `OPENSSL_config(3)` man + page) +* Add performance data to `check_apt` +* Add performance data to `check_procs` +* Added `-4`/`-6` options to `check_dig` +* New `check_oracle` `--connect` option to perform real login +* New `check_nagios` `-t` option to override the default timeout +* New `check_disk` `-f`/`--freespace-ignore-reserved` option to ignore space + reserved for root +* New `check_disk` `-N`/`--include-type` option to limit the filesystem types + to check +* Allow for building the plugins in parallel +* Add `--without-{dbi,ldap,radius}` options to `./configure` +* Made Verbose output of `check_sensors` compliant +* New switch `-E`/`--extended-perfdata` for `check_http` to print additional + performance data +* New `check_http` `-d` option to specify a string to expect within the + response headers +* New `check_http` `-J`/`-K` options for client certificate authentication + support +* Add support for executing queries to `check_pgsql` +* Let `check_pgsql` accept a UNIX socket directory as hostname +* New `check_pgsql` `-o` option to specify additional connection parameters +* New `check_fping` `-S` option to specify the source IP address +* New `check_fping` `-I` option to specify the interface to bind to +* Let `check_fping` support IPv6 +* New `check_procs` `-k` option to ignore kernel threads (on Linux) +* Let `check_procs` use `/proc//exe` (if available) instead of + `getpid(2)`, unless `-T` is specified +* Let `check_mysql` support SSL +* Let `check_mysql` add perfromance metrics for all checks +* New `check_mysql` `-f` option to specify a client options file +* New `check_mysql` `-g` option to specify a client options group +* New `check_snmp` `--offset` option to allow for adding/substracting an + offset value to sensor data +* Let `check_snmp` support an arbitrary number of OIDs +* Let `check_ide_smart` support NetBSD + +## Fixes + +* Change the MAIL FROM command generated by `check_smtp` to be RFC compliant +* Fix compilation of `check_http` without SSL support +* Fix `check_snmp` reversed threshold ranges (backward-compatibility) +* Fix `check_snmp` memory violation when using more than 8 OIDs +* Fix `check_apt` security regular expression +* Fix `check_http` handling extra header (`-k`) containing semicolons +* Fix `check_apt` handling unknown exit codes from apt-get +* Fix deprecated imports of `check_nmap.py` + +## Warnings + +* `check_http` behaviour of `-k`/`--header` changed since it does not separate + multiple headers by semicolons anymore. Use multiple `-k` switches instead. +* `check_http`'s `--proxy_authorization` option is now called + `--proxy-authorization` (it was always documented this way) +* The [contrib directory][contrib] has been removed. These days, sites such + as [Nagios Exchange][nag-exchange] and [Monitoring Exchange][mon-exchange] + serve as much better places for publishing plugins not maintained by the + Nagios Plugins Development Team. + +[download]: /download.html +[contrib]: https://github.com/nagios-plugins/nagios-plugins/tree/7a80e27fb38b26713ac5a1f6810b99519a31dbf3/contrib +[nag-exchange]: http://exchange.nagios.org/ +[mon-exchange]: https://www.monitoringexchange.org/ + + diff --git a/web/input/resources/plugins.css b/web/input/resources/plugins.css index 552284f..7b44e7a 100644 --- a/web/input/resources/plugins.css +++ b/web/input/resources/plugins.css @@ -132,3 +132,9 @@ div#breadcrumb a:hover, div#footer a:hover { border-bottom: 1px solid #696969; } + +p#news-footer { + color: #696969; + text-align: center; + font-size: small; +} diff --git a/web/input/support.md b/web/input/support.md index c6d8b3d..538f320 100644 --- a/web/input/support.md +++ b/web/input/support.md @@ -1,6 +1,6 @@ title: Support parent: Home -menu-position: 4 +menu: 5 --- # Support diff --git a/web/macros.py b/web/macros.py index f3b6ec6..5918195 100644 --- a/web/macros.py +++ b/web/macros.py @@ -8,9 +8,13 @@ page = { "description": "Standard monitoring plugins for Nagios and compatible monitoring solutions.", "keywords": "Nagios, Icinga, Shinken, Monitoring, Official, Plugins, Open, Source, Free, Software" } -release_notes = 'doc/release-notes/' + plugins_release.replace('.', '-') + '.html' +release_notes = 'news/release-%s.html' % plugins_release.replace('.', '-') site_url = 'https://www.nagios-plugins.org/' +# +# RSS Feed +# + _RSS = """ @@ -40,15 +44,14 @@ _RSS_ITEM = """ def hook_postconvert_rss(): items = [] - posts = [p for p in pages if 'post' in p] + posts = [p for p in pages if 'date' in p] posts.sort(key=lambda p: p.date, reverse=True) for p in posts: - title = p.post link = '%s/%s' % (site_url.rstrip('/'), p.url) desc = hx(p.html) date = time.mktime(time.strptime('%s 12' % p.date, '%Y-%m-%d %H')) date = email.utils.formatdate(date) - items.append(_RSS_ITEM % (title, link, desc, link, date)) + items.append(_RSS_ITEM % (p.title, link, desc, date, link)) items = ''.join(items) title = 'Nagios Plugins' link = '%s/news/index.html' % site_url.rstrip('/') @@ -59,23 +62,84 @@ def hook_postconvert_rss(): fp.write(rss) fp.close() -def list_posts(max_posts=-1): - posts = [p for p in pages if 'post' in p] +# +# News +# + +def hook_preconvert_news(): + posts_per_page = 10 + posts = [p for p in pages if 'date' in p] posts.sort(key=lambda p: p.date, reverse=True) - if max_posts == -1: - max_posts = len(posts) - for p in posts[:max_posts]: - date = time.strftime('%B %d, %Y', time.strptime(p['date'], '%Y-%m-%d')) - print '* **[%s](%s)** (%s)' % (p.post, p.url, date) + n_news_pages = len(posts) / posts_per_page + if len(posts) % posts_per_page > 0: + n_news_pages += 1 + for i, chunk in enumerate(next_news_chunk(posts, posts_per_page)): + content = make_news_page(chunk, i) + make_news_footer(n_news_pages, i) + if i == 0: + p = Page('news/index.md', + virtual=content, + menu=2, + title='News', + parent='Home') + else: + p = Page('news/%d.md' % (i + 1), + virtual=content, + title='News Page %d' % (i + 1), + parent='News') + pages.append(p) -def list_kids(): - kids = [(p.url, p.title) for p in pages if p.get('parent') == page.title] - for kid in sorted(kids): - print('* [%s](%s)' % (kid[1], kid[0])) +def make_news_page(posts, current_index): + marker = '' + source = list() + if current_index == 0: + title = 'News' + else: + title = 'News Page %d' % (current_index + 1) + abstract = ['# ' + title] + for p in posts: + timestamp = time.strptime(p.date, '%Y-%m-%d') + date = time.strftime('%A, %B %-e, %Y', timestamp) + abstract.append('## %s' % p.title) + abstract.append('*%s*' % date) + abstract.append('%s' % p.source.split(marker, 1)[0]) + abstract.append('[Read more]' % p.url) + source.append('# %s' % p.title) + source.append('*%s*' % date) + source.append(p.source.replace(marker, '', 1)) + p.source = '\n'.join(source) + p['parent'] = title + return '\n'.join(abstract) + '\n\n' + +def make_news_footer(n_news_pages, current_index): + footer = list() + if current_index != 0: + previous = 'index' if current_index == 1 else str(current_index) + footer.append('[First](news/index.html)') + footer.append('[Previous](news/%s.html)' % previous) + if n_news_pages <= 20: + for i in range(n_news_pages): + if i == current_index: + footer.append('%d' % (i + 1)) + else: + footer.append('[%d](news/%d.html)' % (i + 1, i + 1)) + if current_index != n_news_pages - 1: + footer.append('[Next](news/%d.html)' % (current_index + 2)) + footer.append('[Last](news/%d.html)' % n_news_pages) + return ' '.join(footer) + '\n{: #news-footer }\n' + +def next_news_chunk(posts, posts_per_page): + index = 0 + while len(posts[index:]) > 0: + yield posts[index:index + posts_per_page] + index += posts_per_page + +# +# Menu and Breadcrumb Navigation +# def menu(): - menu_pages = [p for p in pages if 'menu-position' in p] - menu_pages.sort(key=lambda p: int(p['menu-position'])) + menu_pages = [p for p in pages if 'menu' in p] + menu_pages.sort(key=lambda p: int(p['menu'])) for p in menu_pages: if p.title == page.title: print('%s' % hx(p.title)) @@ -96,6 +160,15 @@ def breadcrumb(): crumbs = ' ' + stable return crumbs +# +# Miscellaneous +# + +def list_kids(): + kids = [(p.url, p.title) for p in pages if p.get('parent') == page.title] + for kid in sorted(kids): + print('* [%s](%s)' % (kid[1], kid[0])) + def copyright_years(since=None): this_year = time.gmtime().tm_year if since is not None and int(since) != this_year: -- cgit v0.10-9-g596f