Skip to content

Instantly share code, notes, and snippets.

@Seji64
Created June 22, 2018 07:15
Show Gist options
  • Save Seji64/748548f1a47d5baf583533bfe3a83081 to your computer and use it in GitHub Desktop.
Save Seji64/748548f1a47d5baf583533bfe3a83081 to your computer and use it in GitHub Desktop.
Manual test artifact for sensu-plugins-systemd

Call check without any arguments. should return an error message

[root@pdns ~]# /opt/sensu/embedded/bin/check-systemd.rb
CheckSystemd CRITICAL: You must define services to check!
[root@pdns ~]#

Call check with -h Paramter. should print usage/help

[root@pdns ~]# /opt/sensu/embedded/bin/check-systemd.rb -h
Usage: /opt/sensu/embedded/bin/check-systemd.rb (options)
    -f, --failed                     all services are being checked. One or more failed => CRITICAL
    -i, --failed-ignore SERVICES     comma seperated list of services which should be ignored when using --failed mode
    -s SERVICES                      comma seperated list of services to check. ignored if --failed is set
[root@pdns ~]#

Call check -s with a healthy running service as param. should return status "OK"

[root@pdns ~]# /opt/sensu/embedded/bin/check-systemd.rb -s pdns.service
CheckSystemd OK: All services are running
[root@pdns ~]#

Call check -s with a failed/stopped service as param. should return status "CRITICAL"

[root@pdns ~]# /opt/sensu/embedded/bin/check-systemd.rb -s pdns.service
CheckSystemd CRITICAL: pdns.service - Not Present
[root@pdns ~]#

Call check -s with a service as param and -f. Param -s should be igonored. In this example kdump.service is failed.

[root@pdns ~]# /opt/sensu/embedded/bin/check-systemd.rb -s pdns.service -f
CheckSystemd CRITICAL: kdump.service - failed
[root@pdns ~]#

Call check -f. Should return all failed services. In this example kdump.service is failed.

[root@pdns ~]# /opt/sensu/embedded/bin/check-systemd.rb -f
CheckSystemd CRITICAL: kdump.service - failed
[root@pdns ~]#

Call check -f. Should return all failed services. In this example no services has status failed.

[root@pdns ~]# /opt/sensu/embedded/bin/check-systemd.rb -f
CheckSystemd OK: All services are running
[root@pdns ~]#

Call check -f and -i to ignore the failed kdump.service

[root@pdns ~]# /opt/sensu/embedded/bin/check-systemd.rb -f -i kdump.service
CheckSystemd OK: All services are running
[root@pdns ~]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment