opinkerfi / adagios

Adagios - Web Based Nagios Configuration
GNU Affero General Public License v3.0
327 stars 75 forks source link

Error when rescheduling check #575

Closed eroji closed 7 years ago

eroji commented 9 years ago

When I try to reschedule checks on a host, it returns with a popup stating "Error while rescheduling checks. Error output printed in javascript console."

Running 1.6.1-1.git.149.f0e6717.el7.centos.

hakong commented 9 years ago

Error output printed in javascript console

What does the javascript console say?

eroji commented 9 years ago

My apologies I am not familiar on how to access it. Tried Googling but couldn't find any guides.

hakong commented 9 years ago

https://developer.chrome.com/devtools/docs/console https://developer.mozilla.org/en-US/docs/Tools/Browser_Console https://msdn.microsoft.com/en-us/library/gg589530(v=vs.85).aspx

eroji commented 9 years ago

This is what I got.

POST http://hostname.domain/adagios/rest/status/json/reschedule_many 500 (OK)send @ jquery-1.9.1.min.js:5b.extend.ajax @ jquery-1.9.1.min.js:5adagios.rest.status.reschedule_many @ status.js:702adagios.status.reschedule @ adagios_status.js:767onclick @ detail?host_name=nexus&backend=:345
hakong commented 9 years ago

What do the server-side logs say? Try tail -f /var/log/httpd/*_log and then reschedule.

Note: I edited your comment and removed the hostname because I could login with the default user/pass combo to your nagios server. You can change it with: htpasswd /etc/nagios/passwd nagiosadmin Also consider closing the port to the outside world and enabling SSL :)

eroji commented 9 years ago

Lol thanks. I'll remove that from the load balancer for now so it wont be external facing.

eroji commented 9 years ago

Nothing was being generated into the error_log, although I had these entries in there. Not sure if it's related.

[Fri Aug 07 18:44:39.797570 2015] [mpm_prefork:notice] [pid 1359] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
[Fri Aug 07 18:44:39.797796 2015] [core:notice] [pid 1359] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Fri Aug 07 20:17:58.674436 2015] [core:notice] [pid 1350] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Fri Aug 07 20:17:58.688062 2015] [suexec:notice] [pid 1350] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00557: httpd: apr_sockaddr_info_get() failed for odin
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
[Fri Aug 07 20:17:58.708303 2015] [auth_digest:notice] [pid 1350] AH01757: generating secret for digest authentication ...
[Fri Aug 07 20:17:58.715683 2015] [lbmethod_heartbeat:notice] [pid 1350] AH02282: No slotmem from mod_heartmonitor
[Fri Aug 07 20:17:58.805764 2015] [mpm_prefork:notice] [pid 1350] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
[Fri Aug 07 20:17:58.805784 2015] [core:notice] [pid 1350] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

The access_log only shows the 500 errors.

10.8.10.29 - nagiosadmin [08/Aug/2015:14:07:11 -0700] "POST /adagios/rest/status/json/reschedule_many HTTP/1.1" 500 53080 "http://10.7.10.10/adagios/status/detail?host_name=nexus&service_description=CPU%20Utilization&backend=" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36"
hakong commented 9 years ago

Is SELinux enabled?

eroji commented 9 years ago

Enabled but permissive mode.

hakong commented 9 years ago

What OS/version are you running? Can you look through the install instructions again and see if you missed anything? Try the yum install, chown, setfacl, pynag config, usermod commands again? Also restart httpd and nagios.

Edit: I'm guessing you are running CentOS 7?

eroji commented 9 years ago

Using CentOS7 and I followed the exact installation steps from the site.

hakong commented 9 years ago

Strange. Is this through a loadbalancer? If so, try bypassing it.

eroji commented 9 years ago

I am hitting it directly. Loadbalancer was just acting as front end since I only have 1 public IP. Rescheduling the check when I access it on LAN behaves the same way. I did see another bug report that has the identical error, but that seemed to have been related to python package older than 2.7.3. I have 2.7.5 on mine.

hakong commented 9 years ago

@tomas-edwardsson can you comment on this?

hakong commented 9 years ago

Can you join #adagios on freenode irc?

eroji commented 9 years ago

I'm on.

eroji commented 9 years ago

Just to confirm something, based on the 500 error, is there supposed to be a file called reschedule_many under adagios/rest/status/json/?

Files for the site is located under /usr/lib/python2.7/site-packages/adagios on my system but I don't see anything named status/json/reschedule_many. Furthermore, locating that file on the system indicates there are no file with that name.

hakong commented 9 years ago

at my end its just: /usr/lib/python2.6/site-packages/adagios/rest/status.py, no reschedule_many file or even a json folder. i'm on centos 6.7

eroji commented 9 years ago

Same here, this is a status.py, but no json or reschedule_many.

I take it your system does not error on reschedule?

hakong commented 9 years ago

Nope. Works fine :)

eroji commented 9 years ago

Just did a fresh install (OS and Adagios). Still exact same error.

hakong commented 9 years ago

@palli ?

eroji commented 9 years ago

Here is the full error output.

Failed to load resource: the server responded with a status of 500 (OK)
adagios_status.js:774 <!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="utf-8">
    <title>Adagios -Error</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Adagios - Nagios Configuration Made Easy">
    <meta name="author" content="Tomas Edwardsson, Pall Sigurdsson">
    <meta http-equiv="X-UA-Compatible" content="IE=9">
    <link href="/adagios/media/themes/default/style.css" rel="stylesheet">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="/adagios/media/html5shim/html5.js"></script>
    <![endif]-->

    <!-- fav and touch icons -->
    <link rel="shortcut icon" href="/adagios/media/img/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="114x114"
          href="/adagios/media/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72"
          href="/adagios/media/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed"
          href="/adagios/media/ico/apple-touch-icon-57-precomposed.png">

    <!-- Block header starts -->

    <!-- Block header ends -->
    <script>
        var BASE_URL = "/adagios/";
    </script>
    <script type="text/javascript" src="/adagios/jsi18n/"></script>

</head>

<body>

<!-- begin serverside includes from common-header.ssi and adagios.rest.views.handle_request-header.ssi -->

<!-- end of serverside includes -->

<!-- block top_navigation starts -->

    <!-- snippets/header.html starts. This is the top navigation header on our page -->

<div id="top_navigation_bar" class="navbar navbar-fixed-top" xmlns="http://www.w3.org/1999/html">
    <div class="navbar-inner">
        <div class="container-fluid" style="padding-right: 0;">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>

            <!-- Logo in top nav -->
            <img class=brand src=/adagios/media/img/adagios-logo-32.png>
            <a class="brand" href="/adagios/">
                Adagios
            </a>
            <div class="nav-collapse">
                <ul class="nav" id="top_navigation_menuitems">

                    <li class="">

                          <a href="/adagios/objectbrowser/" >

                        <i class="glyph-grey glyph-edit"></i> Configure
                        </a>

                    </li>

                    <li class="">

                          <a href="/adagios/misc/nagios" >

                        <i class="glyph-grey glyph-list"></i> Nagios
                        </a>

                    </li>

                    <!-- Any extra plugins can put an entry in the menubar -->

                        <!-- Plugin menubar for status_menubar.html -->

<li class="">
  <a href="/adagios/status"><i class="glyph-grey glyph-table"></i> Status</a>
</li>

                        <!-- End of plugin menubar status_menubar.html -->

                        <!-- Plugin menubar for okconfig_menubar.html -->
                        <!--
okconfig_menubar.html is responsible for creating the menuitems in top_navigation_bar of adagios
-->

<li class="dropdown">
    <a class="dropdown-toggle"
       data-toggle="dropdown"
       href="#"><i class="glyph-edit glyph-grey"></i> Okconfig <b class="caret"></b>
    </a>
    <ul class="dropdown-menu">
        <li><a href="/adagios/okconfig/addhost">Add Host</a></li>
        <li><a href="/adagios/okconfig/addtemplate">Add Template to Host</a></li>
        <li><a href="/adagios/okconfig/addservice">Add Service</a></li>
        <li><a href="/adagios/okconfig/edit">Edit Host</a></li>
        <li><a href="/adagios/okconfig/addgroup">Add Group</a></li>
        <li><a href="/adagios/okconfig/install_agent">Install Agent</a></li>
        <li><a href="/adagios/okconfig/scan_network">Scan Network</a></li>
    </ul>
</li>

                        <!-- End of plugin menubar okconfig_menubar.html -->

                </ul>

                <!-- Right aligned navbar - MISC -->

                <ul class="nav pull-right">

                    <li class="nagios_needs_reload">
                        <a  title="Nagios Service needs a reload for configuration changes to take effect." href="#">
                            <span id="nagios_needs_reload_button" class="hide">
                            <i  class="glyph-white glyph-refresh" onclick="adagios.misc.reload_nagios();"></i>
                            </span>
                        </a>
                    </li>

                    <li class="dropdown"><a><i class="glyph-grey glyph-clock"></i> Aug 10 10:21</a></li>

                    <li class="dropdown" id="user-drop-down">
                        <a class="dropdown-toggle"
                           data-toggle="dropdown"
                           href="#"><i class="glyph-user glyph-grey"></i> nagiosadmin (en)

                        </a>
                        <ul class="dropdown-menu">

                                <li><a href="/adagios/status/detail?contact_name=nagiosadmin">My Profile</a></li>

                            <li><a href="/adagios/misc/preferences">Preferences</a></li>
                            <li><a href="#" onclick="adagios.misc.logout(); return false;">Sign Out</a></li>
                        </ul>
                    </li>

                    <li class="dropdown">
                        <a class="dropdown-toggle"
                           data-toggle="dropdown"
                           href="#"><i class="glyph-cogwheel glyph-grey"></i>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="https://github.com/opinkerfi/adagios/issues">Report Bug</a></li>
                            <li><a href="https://github.com/opinkerfi/adagios/issues">Make Suggestion</a></li>
                            <li><a href="http://adagios.org/">Project Webpage</a></li>
                            <li class="divider"></li>
                            <li><a href="/adagios/objectbrowser/plugins">Missing Plugins</a></li>
                            <li><a href="/adagios/objectbrowser/nagios.cfg">Edit nagios.cfg</a></li>
                            <li><a href="/adagios/objectbrowser/import">Import Objects</a></li>
                            <li><a href="/adagios/misc/service">Nagios Service</a></li>
                            <li><a href="/adagios/misc/gitlog">Object History</a></li>
                            <li><a href="/adagios/misc/settings">Settings</a></li>
                            <li class="divider"></li>

                                <li><a href="/adagios/misc/pnp4nagios">PNP Integration</a></li>

                            <!-- Any extra plugins can put an entry in the menubar -->

                        </ul>
                   </li>
                </ul>
            </div>
        </div>
    </div>
</div>

<!-- snippets/header.html ends -->

<!-- block top_navigation ends -->

<!-- block page_content starts -->

    <!-- block left_sidebar starts -->

    <div class="pull-left visible-desktop container-fluid well" id="left_sidebar">
      <ul class="nav nav-list">
        <li class="nav-header" style="color: black;">Shortcuts</li>
        <li><a href="/adagios/status">Status Overview </a></li>
        <li>
          <a  href="/adagios/status/problems?unhandled">Open Problems </a>
        </li>
        <li>
          <a href="/adagios/status/problems">All Problems </a>
        </li>
        <li><a href="/adagios/status/hosts">Hosts</a></li>
        <li><a href="/adagios/status/services">Services </a></li>
        <li><a href="/adagios/status/contacts">Contacts</a></li>
        <li><a href="/adagios/status/parents">Network Parents </a></li>
        <li><a href="/adagios/objectbrowser/">Configuration</a></li>

        <li class="nav-header" style="color: black;">Reports</li>

        <li><a href="/adagios/status/state_history">State History </a></li>
        <li><a href="/adagios/status/log">Log</a></li>
        <li><a href="/adagios/status/comments">Comments</a></li>
        <li><a href="/adagios/status/downtimes">Downtimes</a></li>

        <li class="nav-header" style="color: black;">Groups</li>

        <li><a href="/adagios/status/hostgroups">Hostgroups</a></li>
        <li><a href="/adagios/status/servicegroups">Servicegroups</a></li>
        <li><a href="/adagios/status/contactgroups">Contactgroups</a></li>

        <li class="nav-header" style="color: black;">Experimental</li>

        <li><a href="/adagios/status/map">Map</a></li>
        <li><a href="/adagios/status/perfdata">Performance Data 1</a></li>
        <li><a href="/adagios/status/perfdata2">Performance Data 2</a></li>
        <li><a href="/adagios/bi">Business Intelligence</a></li>
        <li><a href="/adagios/status/dashboard">Dashboard</a></li>

        <li class="nav-header" style="color: black">
            Saved Searches
            <a class="pull-right" href="#"  id="save_search_button" data-toggle="modal" data-target="#save_search_modal" style="padding: 0">(+)</a>
        </li>
    </ul>
    <ul class="nav nav-list" id="saved_searches_list"></ul>
</div>

    <!-- block left_sidebar ends -->

    <div id="main_content">

        <!-- page_header contains stuff breadcrumbs and title of the current page -->

            <div class="pull-right" id="top_right">

            </div>
            <div id="page_header" class="page_header" >
                <h3 class="nowrap">

                    Oh no, something went wrong ☹
                </h3>
            </div>

        <!-- block page_header ends -->

        <!-- block toolbar starts -->

        <!-- block toolbar ends -->

        <!-- block content starts -->

    <div id="friendly_livestatus_message" class=hide>

            Adagios cannot connect to livestatus. Don't worry, you can still use the other parts of Adagios, but to get the status part to work check the following:
            <ul>
                <li>Is <a href="http://mathias-kettner.de/checkmk_livestatus.html\">mk-livestatus</a> installed ?</li>
                <li>Does <a href="/adagios/objectbrowser/nagios.cfg">nagios.cfg</a> have a broker_module= line that loads mk-livestatus ?</li>
                <li>Are there any errors related to livestatus in  <a href="/adagios/status/log?search=livestatus">nagios logfiles</a> ?</li>
            </ul>

            Install instructions for rpm-based systems:
            <pre>
yum --enablerepo=ok-testing install mk-livestatus
pynag config --append "broker_module=/usr/lib64/mk-livestatus/livestatus.o /var/spool/nagios/cmd/livestatus"
service nagios reload
            </pre>
            Install instructions for debian-based systems:
            <pre>
apt-get install check-mk-livestatus
pynag config --append "broker_module=/usr/lib/check_mk/livestatus.o /var/lib/nagios3/rw/livestatus"
service nagios3 reload
            </pre>

    </div>

        <hr>

        <div id="error_message" class="alert alert-danger">
            <b>TypeError</b>: int() argument must be a string or a number, not &#39;NoneType&#39;
        </div>

    <button id="debug_button" class="btn" onclick="$('#traceback').toggle(); $('#debug_button').toggle();">show debug information</button>
    <div id="traceback" class="hide">

            <p>If you think this is a bug. Send the following information to the <a href="https://github.com/opinkerfi/adagios/issues">developers</a>:</p>
            <pre>Traceback (most recent call last):
  File &quot;/usr/lib/python2.7/site-packages/adagios/views.py&quot;, line 43, in wrapper
    result = view_func(request, *args, **kwargs)
  File &quot;/usr/lib/python2.7/site-packages/adagios/rest/views.py&quot;, line 91, in handle_request
    result = item(**arguments)
  File &quot;/usr/lib/python2.7/site-packages/adagios/status/rest.py&quot;, line 267, in reschedule_many
    reschedule(request, host_name=i, service_description=None, check_time=int(check_time))
TypeError: int() argument must be a string or a number, not &#39;NoneType&#39;
</pre>

    </div>

        <!-- block content ends -->

    </div>

<!-- block page_content ends -->

    <div id="page_footer">
        <hr>
        <div class="pull-left" id="bottom_left">

        </div>
        <div class="pull-left" id="glyphicons-attribution">
          <p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
        </div>
        <div class="pull-right" id="make_a_wish" >
            <label class=hide for="id_wish_input"></label>
            <input id=id_wish_input type="text" class="input-large" placeholder="I wish this page could..." onclick='$("#wish_modal").modal("show");'/>
            <button class="btn btn-" style="margin-bottom: 9px;" onclick='$("#wish_modal").modal("show");'>Make a wish</button>
        </div>
    </div>

<!-- Miscellaneous stuff starts here -->
<!-- Wish modal -->
<div class="modal hide fade" id="wish_modal">
    <form class="form-horizontal" action="https://opensource.ok.is/cgi-bin/wish.cgi" >
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h3>Make a wish</h3>
        </div>
        <div class="modal-body">
            <p>Anything cool you think Adagios could be doing for you?
            </p>
            <p>
            Sweet! Ask for it here, and we'll see what we can do.
            </p>
            <p>
                    We'd love to hear from you, but we cannot guarantee that your wish will come true.
            </p>
            <label class="hide" for="wish_textarea"></label>
            <textarea  id="wish_textarea" style="width:100%;" cols="200" rows="10" name="wish" placeholder="I wish this page could..."></textarea>
            <hr>
            <input name="bribes" id="id_bribes" class="pull-left" type="checkbox"  />
            <label class="pull-left" for="id_bribes">I'll back it up with bribes.</label>
        </div>

        <div class="modal-footer">
            <a href="#" class="btn" onclick='$("#wish_modal").modal("hide");'>Cancel</a>
            <button type="submit" id="wish_submit_button" class="btn">Make a wish</button>
        </div>
    </form>
</div>
<!-- Wish modal ends -->

<!-- Misc - General purpose modal modal, originally destined to show error messages -->
<div class="modal hide fade" id="misc_modal">
    <form class="form-horizontal" action="https://opensource.ok.is/cgi-bin/wish.cgi" >
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
        </div>
        <div class="modal-body">
            <div id="misc_modal_body">

            </div>
        </div>

        <div class="modal-footer">
            <a href="#" class="btn" onclick='$("#misc_modal").modal("hide");'>Close</a>
        </div>
    </form>
</div>
<!-- Misc modal ends -->

<!-- error_messages -->
<div id="error_messages"  class="message_overlay">

    <div id="nagios_is_reloading" class="hide alert alert-success"><img src="/adagios/media/external/select2/spinner.gif"> Nagios is reloading...</div>
</div>

<!-- This is a template markup for a typical notification -->
<div id="typical_notification" class="hide fade">
    <div id="NOTIFICATION_ID" class="notification alert alert-LEVEL">
        <button id="NOTIFICATION_ID-close" class="close notification" data-dismiss="alert" onclick='adagios.rest.adagios.clear_notification({"notification_id": "NOTIFICATION_ID"});'>×</button>
        MESSAGE
    </div>
</div>

<!--  javascripts start here -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/adagios/rest/pynag.js"></script>
<script src="/adagios/rest/status.js"></script>
<script src="/adagios/rest/adagios.js"></script>

<script src="/adagios/rest/okconfig.js"></script>

<script src="/adagios/media/external/jquery/jquery-1.9.1.min.js"></script>
<script src="/adagios/media/external/bootstrap/js/bootstrap.min.js"></script>

<script src="/adagios/media/external/datatables/js/jquery.dataTables.min.js"></script>
<script src="/adagios/media/external/datatables/DT_bootstrap.js"></script>

<script src="/adagios/media/external/select2/select2.min.js" type="text/javascript"></script>
<script src="/adagios/media/js/adagios.js"></script>
<script src="/adagios/media/js/adagios_status.js"></script>

<script src="/adagios/media/external/datepicker/js/bootstrap-datepicker.js"></script>

<!-- block footer starts -->

    <div id="modals">

        <!-- Acknowledge modal -->
        <div class="modal hide fade" id="acknowledge_modal">
            <form class="form-horizontal" onsubmit='$("#acknowledge_modal").modal("hide");  adagios.status.acknowledge(); return false;' >
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h3>Acknowledge problem</h3>
                </div>
                <div class="modal-body">
                    <p>Acknowledge means that someone is handling this problem. It will no longer be marked as unhandled and Nagios will stop sending notifications about it until it goes back to OK status.</p>
                    <div class="control-group">
                        <label class="control-label" for="id_acknowledgement_author">
                            Author
                        </label>
                        <div class="controls" id="author_field">
                            <input id="id_acknowledgement_author" type="text" class="required" disabled=disabled value="nagiosadmin" name="author" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="id_comment">
                            Comment
                        </label>
                        <div class="controls" id="host_name_field">
                            <input id="id_comment" type="text" class="required" placeholder="Write some comment" name="comment" />
                            <label class="help-block">Other people looking at this service will see this comment.</label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <a href="#" class="btn" onclick='$("#acknowledge_modal").modal("hide");'>Cancel</a>
                    <button type="submit" id="acknowledge_submit_button" class="btn btn-primary">Acknowledge Problem</button>
                </div>
            </form>
        </div>
        <!-- Acknowledge modal ends -->

        <!-- downtime modal -->
        <div class="modal hide fade" id="downtime_modal">
            <form name="downtime" class="form-horizontal">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h3>Schedule Downtime</h3>
                </div>
                <div class="modal-body">
                    <p>Putting hosts and services into scheduled downtime means they are expected to fail during that period. Nagios will not send out any notifications during scheduled downtime and problems will not show up as unhandled problems.</p>
                    <div class="control-group">
                        <label class="control-label" for="id_downtime_author">
                            Author
                        </label>
                        <div class="controls" id="downtime_author_field">
                            <input id="id_downtime_author" type="text" class="required" disabled=disabled value="nagiosadmin" name="author" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="id_downtime_start_time">
                            Start Time
                        </label>
                        <div class="controls" id="downtime_start_time_field">
                            <div id="datepicker_start_time" class="date pull-left">
                                <label class="hide" for="id_start_time_picker"></label>
                                <input id="id_start_time_picker" name="start_time_picker" style="width: 70px" type="text">
                            </div>
                            <div class="control-group pull-left">
                                <label class="hide" for="id_input_start_hours"></label>
                                <input id="id_input_start_hours" name="start_hours" style="width: 40px" type="text">&nbsp;
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="id_downtime_end_time">
                            End Time
                        </label>
                        <div class="controls" id="id_downtime_end_time_field">
                            <div id="datepicker_end_time" class="date pull-left">
                                <label class="hide" for="id_end_time_picker"></label>
                                <input id="id_end_time_picker" name="end_time_picker" style="width: 70px" type="text">
                            </div>
                            <div class="control-group pull-left">
                                <label class="hide" for="id_end_hours"></label>
                                <input id="id_end_hours" name="end_hours" style="width: 40px" type="text">&nbsp;
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="id_downtime_comment">
                            Comment
                        </label>
                        <div class="controls" id="downtime_comment_field">
                            <input id="id_downtime_comment" type="text" class="required" placeholder="Write some comment" name="comment" />
                            <label class="help-block">Other people looking at this service will see this comment.</label>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="id_downtime_recursive">
                        </label>
                        <div class="controls" id="id_downtime_recursive_field">
                            <input type="checkbox" name="recursive" id="id_downtime_recursive" />
                            Apply to selected hosts and all their services
                        </div>
                    </div>

                </div>

                <div class="modal-footer">
                    <a href="#" class="btn" onclick='$("#downtime_modal").modal("hide");'>Cancel</a>
                    <button type="submit" class="btn btn-primary">Schedule Downtime</button>
                </div>
            </form>
        </div>
        <!-- Downtime modal ends -->

        <!-- Mail modal -->
        <div class="modal hide fade" id="mail_modal">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h3>Mail</h3>
                </div>
                <div class="modal-body">
                    <p>You can send manual e-mail notification to a specified email address.</p>

                    <div class="control-group">
                        <label class="control-label" for="id_mail_to">
                            To:
                        </label>
                        <div class="controls" id="mail_to_field">
                            <input id="id_mail_to" type="text" class="required" value="" name="to" style="width: 100%" />
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="id_mail_message">
                            Message
                        </label>
                        <div class="controls" id="id_mail_message_field">
                            <textarea id="id_mail_message"
                            class="required" placeholder="Hey everyone, please check the link and services below." name="message" ></textarea>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="id_add_myself_to_cc">
                        </label>
                        <div class="controls" id="id_add_myself_to_cc_field">
                            <input type="checkbox" checked="checked" name="add_myself_to_cc" value="on" id="id_add_myself_to_cc" />
                            Add myself to CC
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="id_acknowledge_all_problems">
                        </label>
                        <div class="controls" id="id_acknowledge_all_problems_field">
                            <input type="checkbox" checked="checked" name="acknowledge_all_problems" value="on" id="id_acknowledge_all_problems" />
                            Acknowledge Unhandled Problems
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <a href="#" class="btn" onclick='$("#mail_modal").modal("hide");'>Cancel</a>
                    <button type="submit" class="btn btn-primary" onclick='$("#mail_modal").modal("hide"); adagios.status.send_mail();'>Send</button>
                </div>
        </div>
        <!-- Mail modal ends -->

        <!-- Advanced search Modal -->
        <div class="modal hide fade" id="search_modal">
            <form class="form-horizontal" action="/adagios/status/services" >
                <div class="modal-header">

                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h3>Advanced search</h3>
                </div>
                <div class="modal-body">

                    <div id="search_dialog">
                        <div class="control-group">
                            <input id="id_search_modal_q" value="" type="text" placeholder="Has the words" name="q" style="width: 100%"/>
                        </div>

                        <div class="control-group">
                            <table>
                                <tr>
                                    <th class="pull-left">Service state:</th>
                                    <td><input type="checkbox" name="state" value="0" /> OK</td>
                                    <td><input type="checkbox" name="state" value="1" /> Warning</td>
                                    <td><input type="checkbox" name="state" value="2" /> Critical</td>
                                    <td><input type="checkbox" name="state" value="3" /> Unknown</td>
                                </tr>
                                <tr>
                                    <th class="pull-left">Host state:</th>
                                    <td><input type="checkbox" name="host_state" value="0" />Up</td>
                                    <td><input type="checkbox" name="host_state" value="1" />Down</td>
                                    <td><input type="checkbox" name="host_state" value="2" />Unreachable</td>
                                    <td></td>
                                </tr>
                            </table>
                        </div>

                        <div class="control-group">

                            <div class="pull-left">
                                <table>
                                    <tr>
                                        <th class="pull-left">Service Properties:</th>
                                        <th>Yes</th>
                                        <th>No</th>
                                    </tr>
                                    <tr>
                                        <td>In Scheduled Downtime:</td>
                                        <td><input type="checkbox"  name="in_scheduled_downtime" value="1" /></td>
                                        <td><input type="checkbox"  name="in_scheduled_downtime" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Acknowledged:</td>
                                        <td><input type="checkbox"  name="acknowledged" value="1" /></td>
                                        <td><input type="checkbox"  name="acknowledged" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Active Checks Enabled:</td>
                                        <td><input type="checkbox"  name="active_checks_enabled" value="1" /></td>
                                        <td><input type="checkbox"  name="active_checks_enabled" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Event Handler Enabled:</td>
                                        <td><input type="checkbox"  name="event_handler_enabled" value="1" /></td>
                                        <td><input type="checkbox"  name="event_handler_enabled" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Flap Detection Enabled:</td>
                                        <td><input type="checkbox"  name="flap_detection_enabled" value="1" /></td>
                                        <td><input type="checkbox"  name="flap_detection_enabled" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Notifications Enabled:</td>
                                        <td><input type="checkbox"  name="notifications_enabled" value="1" /></td>
                                        <td><input type="checkbox"  name="notifications_enabled" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Accepts Passive Checks:</td>
                                        <td><input type="checkbox"  name="accept_passive_checks" value="1" /></td>
                                        <td><input type="checkbox"  name="accept_passive_checks" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>In Hard State:</td>
                                        <td><input type="checkbox"  name="state_type" value="1" /></td>
                                        <td><input type="checkbox"  name="state_type" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>In Check Period:</td>
                                        <td><input type="checkbox"  name="in_check_period" value="1" /></td>
                                        <td><input type="checkbox"  name="in_check_period" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>In Notification Period:</td>
                                        <td><input type="checkbox"  name="in_notification_period" value="1" /></td>
                                        <td><input type="checkbox"  name="in_notification_period" value="0" /></td>
                                    </tr>
                                </table>
                            </div>

                            <div class="pull-right">
                                <table>
                                    <tr>
                                        <th class="pull-left">Host Properties:</th>
                                        <th>Yes</th>
                                        <th>No</th>
                                    </tr>
                                    <tr>
                                        <td>In Scheduled Downtime:</td>
                                        <td><input type="checkbox"  name="in_scheduled_downtime" value="1" /></td>
                                        <td><input type="checkbox"  name="in_scheduled_downtime" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Acknowledged:</td>
                                        <td><input type="checkbox"  name="host_acknowledged" value="1" /></td>
                                        <td><input type="checkbox"  name="host_acknowledged" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Active Checks Enabled:</td>
                                        <td><input type="checkbox"  name="host_active_checks_enabled" value="1" /></td>
                                        <td><input type="checkbox"  name="host_active_checks_enabled" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Event Handler Enabled:</td>
                                        <td><input type="checkbox"  name="host_event_handler_enabled" value="1" /></td>
                                        <td><input type="checkbox"  name="host_event_handler_enabled" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Flap Detection Enabled:</td>
                                        <td><input type="checkbox"  name="host_flap_detection_enabled" value="1" /></td>
                                        <td><input type="checkbox"  name="host_flap_detection_enabled" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Notifications Enabled:</td>
                                        <td><input type="checkbox"  name="host_notifications_enabled" value="1" /></td>
                                        <td><input type="checkbox"  name="host_notifications_enabled" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>Accepts Passive Checks:</td>
                                        <td><input type="checkbox"  name="host_accept_passive_checks" value="1" /></td>
                                        <td><input type="checkbox"  name="host_accept_passive_checks" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>In Hard State:</td>
                                        <td><input type="checkbox"  name="host_state_type" value="1" /></td>
                                        <td><input type="checkbox"  name="host_state_type" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>In Check Period:</td>
                                        <td><input type="checkbox"  name="host_in_check_period" value="1" /></td>
                                        <td><input type="checkbox"  name="host_in_check_period" value="0" /></td>
                                    </tr>
                                    <tr>
                                        <td>In Notification Period:</td>
                                        <td><input type="checkbox"  name="host_in_notification_period" value="1" /></td>
                                        <td><input type="checkbox"  name="host_in_notification_period" value="0" /></td>
                                    </tr>
                                </table>
                            </div>

                        </div>

                    </div>

                </div>

                <div class="modal-footer">
                    <a href="#" class="btn" onclick='$("#search_modal").modal("hide");'>Cancel</a>
                   <button type="submit" class="btn btn-primary">Search</button>
                 </div>
            </form>
        </div>
        <!-- Advanced search modal ends -->

        <!-- Save search modal -->
        <div class="modal hide fade" id="save_search_modal">
            <form class="form-horizontal" id="save_search_form">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h3>Save Current View as a search</h3>
                </div>

                <div class="modal-body">
                    <div class="control-group">
                        <label class="control-label" for="id_save_search_name">
                            Name
                        </label>
                        <div class="controls">
                            <input id="id_save_search_name" type="text" class="required" value="" name="name" />
                        </div>
                        <div class=hide>
                            <input type="text" id="id_save_search_url" value="">
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <a href="#" class="btn" onclick='$("#save_search_modal").modal("hide");'>Cancel</a>
                    <button type="submit" id="wish_submit_button" class="btn">Save this search</button>
                </div>
            </form>
        </div>
        <!-- Save search modal ends -->
    </div>

    <script type="text/javascript" xmlns="http://www.w3.org/1999/html">

        // When this function is called, gather all selected objects and add them to a specific group
        function add_to_group(group_type) {
            var object_type, value;
            var querystring = '';
            $( ".selectable :checked").each(function() {
                object_type = $(this).attr('name');
                value = $(this).attr('value');
                querystring += "&" + object_type + "=" + value;
            });
            window.location.href = "/adagios/objectbrowser/add_to_group/" + group_type + "?" + querystring;
        }

        // When this function is called, delete all selected objects
        function delete_selected_objects() {
            var object_type, value;
            var querystring = '';
            $( ".selectable :checked").each(function() {
                object_type = $(this).attr('name');
                value = $(this).attr('value');
                querystring += "&" + object_type + "=" + value;
            });
            window.location.href = "/adagios/objectbrowser/bulk_delete" + "?" + querystring;
        }

        // When this function is called, go to the edit page for all selected objects
        function edit_selected_objects() {
            var object_type, value;
            var querystring = '';
            $( ".selectable :checked").each(function() {
                object_type = $(this).attr('name');
                value = $(this).attr('value');
                querystring += "&" + object_type + "=" + value;
            });
            window.location.href = "/adagios/objectbrowser/bulk_edit" + "?" + querystring;
        }

        // When this function is called. Go to the copy object page
        function copy_selected_objects() {
            var object_type, value;
            var querystring = '';
            $( ".selectable :checked").each(function() {
                object_type = $(this).attr('name');
                value = $(this).attr('value');
                querystring += "&" + object_type + "=" + value;
            });
            window.location.href = "/adagios/objectbrowser/bulk_copy" + "?" + querystring;
        }
        // When this function is called. Gather all selected services and add them to a specific business process
        adagios.bi.add_to_business_process = function() {
            var object_type = [];
            var value;
            var querystring = "?";
            // special hack, change destination url if we are adding graphs
            var doing_graphs = false;
            $( ".selectable :checked").each(function() {
                object_type = $(this).attr('name');
                value = $(this).attr('value');
                querystring += "&" + object_type + "=" + value;
                if (object_type == 'graph') {
                    doing_graphs = true;
                }
            });
            if (doing_graphs == true) {
                window.location.href = "/adagios/bi/add/graph/?" + querystring;
            }
            else {
                window.location.href = "/adagios/bi/add/subprocess/?" + querystring;
            }

            return false;
        };
    </script>

    <script type="text/javascript" xmlns="http://www.w3.org/1999/html">

        $(document).ready(function() {

            // Prepare dates in the downtime modal
            adagios.status.prepare_downtime_modal();

            // When somebody clicks the acknowledge button, lets focus on the comment field
            $('#acknowledge_modal').on('shown', function () {
                document.getElementById('id_comment').focus()
            });

            // When somebody clicks the downtime button, lets focus on the comment field
            $('#downtime_modal').on('shown', function () {
                document.getElementById('id_downtime_comment').focus()
            });

            // When somebody clicks the notification button, lets load contact email addresses
            $('#mail_modal').on('shown', function () {
                adagios.rest.status.emails()
                        .done(function(data) {
                            $("#id_mail_to").select2({
                                tags:data,
                                tokenSeparators: [","],
                                placeholder:gettext("Comma seperated list of email addresses to send to")
                            });
                        });
            });

        });

        // Prepare dates and other stuff for the downtime modal
        adagios.status.prepare_downtime_modal = function() {
            var start_time = (new Date).valueOf() / 1000;
            var end_time = (new Date);
            end_time.setHours(end_time.getHours() + 2);
            end_time = end_time.valueOf() / 1000;
            var downtime_form = $("form[name='downtime']");
            downtime_form.adagios_datetimepicker(start_time, end_time);
            downtime_form.submit(function(e) {
                $("#downtime_modal").modal("hide");
                adagios.status.downtime();
                e.preventDefault();
                return false;
            });
        };

        // This function responsible for acknowledge on all selected rows
        adagios.status.acknowledge = function() {
            $('#acknowledge_modal').modal('hide');
            var comment = document.getElementById("id_comment").value;
            if (comment == '') {
                comment = gettext("No comment was entered...");
            }
            var selected_objects = adagios.status.get_selected_objects();
            var objects_done = 0;
            var my_data;
            var hostlist = '';
            var servicelist = '';

            $.each(selected_objects, function(i, item) {
                var host_name =  item['host_name'];
                var service_description = item['service_description'];
                var object_type = item['object_type'];
                if (object_type == 'host') {
                    hostlist += ';' + host_name;
                }
                else if (object_type == 'service') {
                    servicelist += ';' + host_name + ',' + service_description;
                }
            });
            my_data = {
                "hostlist": hostlist,
                "servicelist": servicelist,
                "comment":comment,
                "author":"nagiosadmin",
                "sticky":"1",
                "persistent":"0",
                "notify":"1"
            };
            adagios.misc.info(gettext("Sending Command to server"), 'acknowledgement');
            adagios.rest.status.acknowledge_many(my_data)
                    .done(function(data) {
                        adagios.misc.success(gettext("Acknowledgement has been set. You should reload your browser."), "acknowledgement", 5000);
                        adagios.status.clear_all_selections();
                    })
                    .fail(function(data) {
                        adagios.misc.error(gettext("Error while sending acknowledge command to the server."), "acknowledgement");
                    })
                    .always(function(data) {
                    });
            return false;

        };

        // This function responsible for downtime on all selected rows
        adagios.status.downtime = function() {
            var $form_downtime = $("form[name='downtime']");
            $('#downtime_modal').modal('hide');
            var comment = document.getElementById("id_downtime_comment").value;
            var recursive = document.getElementById("id_downtime_recursive").checked;
            if (comment == '') { comment = "No comment was entered..."; }
            var start_time = $form_downtime.find("input[name='start_time']").val();
            var end_time = $form_downtime.find("input[name='end_time']").val();
            var host_name, service_description, hostgroup_name, object_type;
            var my_data;
            var selected_objects = adagios.status.get_selected_objects();
            var services_done = 0;
            var hostlist = '';
            var hostgrouplist = '';
            var servicelist = '';
            $.each(selected_objects, function(i, item) {
                host_name =  item['host_name'];
                service_description = item['service_description'];
                hostgroup_name = item['hostgroup_name'];
                object_type = item['object_type'];
                if (object_type == 'host') {
                    hostlist = hostlist + ';' + host_name;
                }
                else if (object_type == 'service') {
                    servicelist = servicelist + ';' + host_name + ',' + service_description
                }
                else if (object_type == 'hostgroup') {
                    hostgrouplist = hostgrouplist + ';' + hostgroup_name;
                }

            });
            my_data = {
                "hostgrouplist":hostgrouplist,
                "hostlist":hostlist,
                "servicelist":servicelist,
                "comment":comment,
                "author":"nagiosadmin",
                "all_services_on_host":recursive,
                "start_time":start_time,
                "end_time":end_time
            };
            adagios.misc.info(gettext("Sending downtime command to server."), 'downtime');
            adagios.rest.status.downtime_many(my_data)
                    .done(function(data) {
                        adagios.misc.success(gettext("Downtime command has been sent. You should refresh your browser."), 'downtime');
                    })
                    .fail(function(data) {
                        adagios.misc.error(gettext("Could not send downtime command to the server."), 'downtime');
                    });

        };

        // This function sends email to selected recipients for all selected rows
        adagios.status.send_mail = function() {
            $('#mail_modal').modal('hide');
            var my_data = {
                "to":document.getElementById("id_mail_to").value,
                "csrfmiddlewaretoken": window.csrftoken,
                "add_myself_to_cc": document.getElementById("id_add_myself_to_cc").checked,
                "acknowledge_all_problems": document.getElementById("id_acknowledge_all_problems").checked,
                "message":document.getElementById("id_mail_message").value,
                "service": [],
                "host": []
            };

            var selected_objects = adagios.status.get_selected_objects();
            var shortname;
            for (var i=0;i<selected_objects.length;i++){
                if (selected_objects[i]['object_type'] == 'service') {
                    shortname = selected_objects[i]["host_name"] + "/" + selected_objects[i]["service_description"];
                    my_data['service'].push( shortname);
                }
                if (selected_objects[i]['object_type'] == 'host') {
                    my_data['host'].push(selected_objects[i]["host_name"]);
                }
            }
            jQuery.param( my_data["service"], true);
            $.ajax({
                type: 'POST',
                url: '/adagios/misc/mail',
                data: my_data,
                async: true,
                success: function(data) {
                    adagios.misc.success(gettext("Mail has been sent"), "mail_sent", 5000);
                },
                error: function(data) {
                  adagios.misc.error(gettext("Error sending mail"), "mail_sent");
                },
                contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            });

        };

        // Send a comment about specific service to our monitoring engine
        adagios.status.comment = function(comment,host_name, service_description, persistent ) {
            if (comment == '') {
                comment = gettext("No comment was entered...");
            }
            if (service_description == '_HOST_')
                service_description = undefined;
            var my_data  = {
                "host_name":host_name,
                "service_description":service_description,
                "comment":comment,
                "author":"nagiosadmin",
                "persistent":"1"
            };
            return adagios.rest.status.comment(my_data)
                    .done(function(data) {
                        adagios.misc.success(gettext("Comment has been sent to server."));

                    })
                    .fail(function(data) {
                        adagios.misc.error(gettext("Problem sending comment to server."))
                    });

        }

    </script>

    <script>
        $(document).ready(function() {
            var error = $('#error_message').text();
            if ( error.search("livestatus") > 0) { $('#friendly_livestatus_message').show(); }
        });
    </script>

<!-- block footer ends -->

<!-- begin serverside includes for common-footer.ssi and adagios.rest.views.handle_request-footer.ssi -->

<!-- end of serverside includes -->

<!--
GLYPHICONS FREE are released under the Creative Commons Attribution 3.0 Unported (CC BY 3.0). The Glyphicons FREE can
be used both commercially and for personal use, but you must always add a link to www.glyphicons.com in a prominent
place (e.g. the footer of a website), include the CC-BY license and the reference to www.glyphicons.com on every page
using Glyphicons.

All logos and trademarks in social icons are the property of the respective trademark owners.®
-->

</body>

</html>
palli commented 9 years ago

Looks like the relevant part here is:

Traceback (most recent call last):
  File &quot;/usr/lib/python2.7/site-packages/adagios/views.py&quot;, line 43, in wrapper
    result = view_func(request, *args, **kwargs)
  File &quot;/usr/lib/python2.7/site-packages/adagios/rest/views.py&quot;, line 91, in handle_request
    result = item(**arguments)
  File &quot;/usr/lib/python2.7/site-packages/adagios/status/rest.py&quot;, line 267, in reschedule_many
    reschedule(request, host_name=i, service_description=None, check_time=int(check_time))
TypeError: int() argument must be a string or a number, not &#39;NoneType&#39;
</pre>
palli commented 9 years ago

Looks like this was fixed already in 89b44fd6e89d7a365ee521927d2c8802c3b8c785 .. can you try with latest adagios from testing repositories ?

palli commented 9 years ago

Yeah I believe this is fixed already so I am marking the bug as closed.

Don't hesitate to reopen if you have any further issues.

eroji commented 9 years ago

Yum update from ok-testing repo does not show anything available newer than 1.6.1-1.git.149.f0e6717.el7.centos? Is there somewhere else I am supposed to get the package from?

Starseed6 commented 9 years ago

I have exactly the same problem - running CentOS7, and latest version available from ok-testing is 1.6.1-1.git.149.f0e6717.el7.centos. Is ok-testing the correct repo to upgrade from? Thanks in advance!

eroji commented 9 years ago

It does not appear to be updated in the el7 section of the repo for update from yum.

hakong commented 8 years ago

@tryggvi can you update the el7 repo to include the latest version?

hakong commented 8 years ago

@palli @tomas-edwardsson ? I'm running the latest from ok-testing and this bug is still in that rpm.

mandriss commented 8 years ago

I have the same problem. Has anybody a solution?

mandriss commented 8 years ago

Adagios upgrade helped me: rpm -Uvh https://github.com/opinkerfi/adagios/releases/download/adagios-1.6.3-1/adagios-1.6.3-1.el7.centos.noarch.rpm

hakong commented 8 years ago

Duplicate of #558