controlling downtimes with pynag

252 views
Skip to first unread message

Tomasz Zajączkowski

unread,
Jun 11, 2014, 6:34:18 AM6/11/14
to pynag-...@googlegroups.com
Hi All,
 
I am new to pynag and I was wondering if someone can help me with one issue..
 
I am trying to use it to mass-acknowledge downtimes.. pynag downtime --list works perfectly ok but pynag downtime --remove does nothing.. Am I missing somehting?
 
Regards,
Tomasz

Páll Sigurðsson

unread,
Jun 28, 2014, 9:24:45 AM6/28/14
to pynag-...@googlegroups.com
Hey Thomasz,

It works for me, can you doublecheck that you still have a problem ? I will paste below how i use the tool, maybe your usage varies:

# Step 1 - Add localhost to downtimes
=============================

$ pynag downtime where host_name=localhost
object_type          shortname            filename            
--------------------------------------------------------------------------------
host                 localhost            /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/CPU load   /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/CPU utilization /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/CUPS Queue 2h-mid-lj9500-litur /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/CUPS Queue Canon-iP2600-series /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/CUPS Queue HP-Color-LaserJet-3800 /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Check_MK   /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Disk IO SUMMARY /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Kernel Context Switches /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Kernel Major Page Faults /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Kernel Process Creations /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Memory used /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Mount options of / /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Number of threads /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Postfix Queue /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Reverse Lookup /etc/nagios3/conf.d/check_mk/localhost-dns.cfg
service              localhost/Swap Usage /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/TCP Connections /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/Uptime     /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/fs_/       /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/http://localhost/test /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
service              localhost/nagios.cfg /etc/nagios3/conf.d/check_mk/check_mk_objects.cfg
----------22 objects matches search condition-----------------------------------
Schedule downtime for these 22 objects ? (y/N) y
Downtime host: localhost
Downtime service: localhost/CPU load
Downtime service: localhost/CPU utilization
Downtime service: localhost/CUPS Queue 2h-mid-lj9500-litur
Downtime service: localhost/CUPS Queue Canon-iP2600-series
Downtime service: localhost/CUPS Queue HP-Color-LaserJet-3800
Downtime service: localhost/Check_MK
Downtime service: localhost/Disk IO SUMMARY
Downtime service: localhost/Kernel Context Switches
Downtime service: localhost/Kernel Major Page Faults
Downtime service: localhost/Kernel Process Creations
Downtime service: localhost/Memory used
Downtime service: localhost/Mount options of /
Downtime service: localhost/Number of threads
Downtime service: localhost/Postfix Queue
Downtime service: localhost/Reverse Lookup
Downtime service: localhost/Swap Usage
Downtime service: localhost/TCP Connections
Downtime service: localhost/Uptime
Downtime service: localhost/fs_/
Downtime service: localhost/http://localhost/test
Downtime service: localhost/nagios.cfg



# Step 2) Verify that all services are in downtime:
====================================

$ pynag downtime --list where host_name=localhost
id                   host_name            service_description  comment             
--------------------------------------------------------------------------------
1532                 localhost                                 Downtime Scheduled from pynag
1533                 localhost            CPU load             Downtime Scheduled from pynag
1534                 localhost            CPU utilization      Downtime Scheduled from pynag
1535                 localhost            CUPS Queue 2h-mid-lj9500-litur Downtime Scheduled from pynag
1536                 localhost            CUPS Queue Canon-iP2600-series Downtime Scheduled from pynag
1537                 localhost            CUPS Queue HP-Color-LaserJet-3800 Downtime Scheduled from pynag
1538                 localhost            Check_MK             Downtime Scheduled from pynag
1539                 localhost            Disk IO SUMMARY      Downtime Scheduled from pynag
1540                 localhost            Kernel Context Switches Downtime Scheduled from pynag
1541                 localhost            Kernel Major Page Faults Downtime Scheduled from pynag
1542                 localhost            Kernel Process Creations Downtime Scheduled from pynag
1543                 localhost            Memory used          Downtime Scheduled from pynag
1544                 localhost            Mount options of /   Downtime Scheduled from pynag
1545                 localhost            Number of threads    Downtime Scheduled from pynag
1546                 localhost            Postfix Queue        Downtime Scheduled from pynag
1547                 localhost            Reverse Lookup       Downtime Scheduled from pynag
1548                 localhost            Swap Usage           Downtime Scheduled from pynag
1549                 localhost            TCP Connections      Downtime Scheduled from pynag
1550                 localhost            Uptime               Downtime Scheduled from pynag
1551                 localhost            fs_/                 Downtime Scheduled from pynag
1552                 localhost            http://localhost/test Downtime Scheduled from pynag
1553                 localhost            nagios.cfg           Downtime Scheduled from pynag
----------22 objects matches search condition-----------------------------------



# Step 3, remove all downtimes of host localhost:
=====================================

$ pynag downtime --remove where host_name=localhost
id                   host_name            service_description  comment             
--------------------------------------------------------------------------------
1532                 localhost                                 Downtime Scheduled from pynag
1533                 localhost            CPU load             Downtime Scheduled from pynag
1534                 localhost            CPU utilization      Downtime Scheduled from pynag
1535                 localhost            CUPS Queue 2h-mid-lj9500-litur Downtime Scheduled from pynag
1536                 localhost            CUPS Queue Canon-iP2600-series Downtime Scheduled from pynag
1537                 localhost            CUPS Queue HP-Color-LaserJet-3800 Downtime Scheduled from pynag
1538                 localhost            Check_MK             Downtime Scheduled from pynag
1539                 localhost            Disk IO SUMMARY      Downtime Scheduled from pynag
1540                 localhost            Kernel Context Switches Downtime Scheduled from pynag
1541                 localhost            Kernel Major Page Faults Downtime Scheduled from pynag
1542                 localhost            Kernel Process Creations Downtime Scheduled from pynag
1543                 localhost            Memory used          Downtime Scheduled from pynag
1544                 localhost            Mount options of /   Downtime Scheduled from pynag
1545                 localhost            Number of threads    Downtime Scheduled from pynag
1546                 localhost            Postfix Queue        Downtime Scheduled from pynag
1547                 localhost            Reverse Lookup       Downtime Scheduled from pynag
1548                 localhost            Swap Usage           Downtime Scheduled from pynag
1549                 localhost            TCP Connections      Downtime Scheduled from pynag
1550                 localhost            Uptime               Downtime Scheduled from pynag
1551                 localhost            fs_/                 Downtime Scheduled from pynag
1552                 localhost            http://localhost/test Downtime Scheduled from pynag
1553                 localhost            nagios.cfg           Downtime Scheduled from pynag
----------22 objects matches search condition-----------------------------------
Remove these 22 downtimes? (y/N) y
Removing downtime 1532: 
Removing downtime 1533: 
Removing downtime 1534: 
Removing downtime 1535: 
Removing downtime 1536: 
Removing downtime 1537: 
Removing downtime 1538: 
Removing downtime 1539: 
Removing downtime 1540: 
Removing downtime 1541: 
Removing downtime 1542: 
Removing downtime 1543: 
Removing downtime 1544: 
Removing downtime 1545: 
Removing downtime 1546: 
Removing downtime 1547: 
Removing downtime 1548: 
Removing downtime 1549: 
Removing downtime 1550: 
Removing downtime 1551: 
Removing downtime 1552: 
Removing downtime 1553: 


# Step 4) Verify all downtimes have disappeared:
=====================================
$ pynag downtime --list where host_name=localhost
id                   host_name            service_description  comment             
--------------------------------------------------------------------------------
----------0 objects matches search condition------------------------------------



--
You received this message because you are subscribed to the Google Groups "pynag-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynag-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages