def test_checkProcessInvalidMsgForQuorum(self, mock_send_to_nsca, mock_getNagiosClusterName): mock_getNagiosClusterName.return_value = "test-cluster" message = ("-/DAEMON/CRIT/ETC-GLUSTERFS-GLUSTERD.VOL " "[2014-05-02T12:40:14.562509+00:00] " "[2014-05-02 12:40:14.559662] C " "[glusterd-utils.c:3376:glusterd_do_volume_quorum_action] " "0-management: Random quorum message ") check_gluster_syslog.processMsg(message) assert not mock_send_to_nsca.called, "send nsca should not be called"
def test_checkProcessMsg(self, mock_send_to_nsca, mock_getNagiosClusterName): mock_getNagiosClusterName.return_value = "test-cluster" message = ("-/USER/CRIT/GLUSTERFSD [2014-04-06T21:45:33.378443+05:30] " "glusterfsd: [2014-04-06 15:46:59.390038] " "A [quota.c:3670:quota_log_usage] 0-test-vol-quota:" "Usage is above soft limit: 300.0KB used by /test/") check_gluster_syslog.processMsg(message) mock_send_to_nsca.assert_called_with( "test-cluster", "Volume Quota - test-vol", utils.PluginStatusCode.WARNING, "QUOTA: Usage is " "above soft limit: " "300.0KB used by /test/")
def test_checkProcessMsg(self, mock_send_to_nsca, mock_getNagiosClusterName): mock_getNagiosClusterName.return_value = "test-cluster" message = ("-/USER/CRIT/GLUSTERFSD [2014-04-06T21:45:33.378443+05:30] " "glusterfsd: [2014-04-06 15:46:59.390038] " "A [quota.c:3670:quota_log_usage] 0-test-vol-quota:" "Usage is above soft limit: 300.0KB used by /test/") check_gluster_syslog.processMsg(message) mock_send_to_nsca.assert_called_with("test-cluster", "Volume Quota - test-vol", utils.PluginStatusCode.WARNING, "QUOTA: Usage is " "above soft limit: " "300.0KB used by /test/")
def test_checkProcessMsgForQuorum(self, mock_send_to_nsca, mock_getNagiosClusterName): mock_getNagiosClusterName.return_value = "test-cluster" message = ("-/DAEMON/CRIT/ETC-GLUSTERFS-GLUSTERD.VOL " "[2014-05-02T12:40:14.562509+00:00] " "[2014-05-02 12:40:14.559662] C [MSGID: 106002] " "[glusterd-utils.c:3376:glusterd_do_volume_quorum_action] " "0-management: Server quorum lost for volume dist. " "Stopping local bricks. ") check_gluster_syslog.processMsg(message) mock_send_to_nsca.assert_called_with( "test-cluster", "Cluster - Quorum Status", utils.PluginStatusCode.CRITICAL, "QUORUM: Cluster server-side " "quorum lost.")
def test_checkProcessMsgForQuorum(self, mock_send_to_nsca, mock_getNagiosClusterName): mock_getNagiosClusterName.return_value = "test-cluster" message = ("-/DAEMON/CRIT/ETC-GLUSTERFS-GLUSTERD.VOL " "[2014-05-02T12:40:14.562509+00:00] " "[2014-05-02 12:40:14.559662] C [MSGID: 106002] " "[glusterd-utils.c:3376:glusterd_do_volume_quorum_action] " "0-management: Server quorum lost for volume dist. " "Stopping local bricks. ") check_gluster_syslog.processMsg(message) mock_send_to_nsca.assert_called_with("test-cluster", "Cluster - Quorum Status", utils.PluginStatusCode.CRITICAL, "QUORUM: Cluster server-side " "quorum lost.")