Skip to content

Commit

Permalink
Merge pull request #89 from ARGOeu/devel
Browse files Browse the repository at this point in the history
Version 0.4.1
  • Loading branch information
themiszamani authored Jun 6, 2024
2 parents 6965c07 + 7b96a48 commit 2a195f1
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 28 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [0.4.1] - 2024-06-06

### Changed

* ARGO-4445 Increase cmd query size for publisher probe inspection

### Added

* ARGO-4524 ams-publisher Rocky 9 RPM

## [0.4.0] - 2022-09-1

### Changed
Expand Down
23 changes: 22 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pipeline {
}
}
steps {
echo 'Building Rpm...'
echo 'Building Centos 7 RPM...'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \
keyFileVariable: 'REPOKEY')]) {
sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d centos7 -p ${PROJECT_DIR} -s ${REPOKEY}"
Expand All @@ -34,6 +34,27 @@ pipeline {
}
}
}
stage ('Build Rocky 9') {
agent {
docker {
image 'argo.registry:5000/epel-9-ams'
args '-u jenkins:jenkins'
}
}
steps {
echo 'Building Rocky 9 RPM...'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \
keyFileVariable: 'REPOKEY')]) {
sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d rocky9 -p ${PROJECT_DIR} -s ${REPOKEY}"
}
archiveArtifacts artifacts: '**/*.rpm', fingerprint: true
}
post{
always {
cleanWs()
}
}
}
}
}
}
Expand Down
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ Complete list of features are:

## Installation

Component is supported on CentOS 7. RPM packages and all needed dependencies are available in ARGO repositories so installation of component simply narrows down to installing a package:
Component is supported on CentOS 7 and Rocky 9 Linux. RPM packages and all needed dependencies are available in ARGO repositories so installation of component simply narrows down to installing a package:

yum install -y ams-publisher
dnf install -y ams-publisher

Component relies on:
- `argo-ams-library` - interaction with ARGO Messaging
Expand All @@ -42,14 +42,13 @@ Component relies on:

| File Types | Destination |
|-------------------|----------------------------------------------------|
| Configuration | `/etc/ams-publisher/ams-publisher.conf`|
| Configuration | `/etc/ams-publisher/ams-publisher.conf` |
| Daemon component | `/usr/bin/ams-publisherd` |
| Cache delivery | `/usr/bin/ams-alarm-to-queue, ams-metric-to-queue` |
| Init script (C6) | `/etc/init.d/ams-publisher` |
| SystemD Unit (C7) | `/usr/lib/systemd/system/ams-publisher.service` |
| Local caches | `/var/spool/ams-publisher/` |
| Inspection socket | `/var/run/ams-publisher/sock` |
| Log files | `/var/log/ams-publisher/` |
| SystemD Unit (R9) | `/usr/lib/systemd/system/ams-publisher.service` |
| Local caches | `/var/spool/ams-publisher/` |
| Inspection socket | `/run/ams-publisher/sock` |
| Log files | `/var/log/ams-publisher/` |

## Configuration

Expand Down Expand Up @@ -120,12 +119,7 @@ SleepRetry = 300

Components needs to be properly configured before starting it. At least one worker must be spawned so at least one directory queue needs to exist, Nagios should deliver results to it and publisher part of the worker needs to be associated to it. Afterward, it's just a matter of starting the service.

CentOS 6:
```
/etc/init.d/ams-publisher start
```

CentOS 7:
CentOS 7 and Rocky 9:
```
systemctl start ams-publisher.service
```
Expand Down
14 changes: 13 additions & 1 deletion ams-publisher.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Name: ams-publisher
Summary: Bridge from Sensu/Nagios to the ARGO Messaging system
Version: 0.4.0
Version: 0.4.1
Release: 1%{mydist}

Group: Network/Monitoring
Expand Down Expand Up @@ -44,7 +44,12 @@ Requires: python3-argo-ams-library
Requires: python3-avro
Requires: python3-dirq
Requires: python3-messaging
%if 0%{?el7}
Requires: python36-pytz
%endif
%if 0%{?el9}
Requires: python3-pytz
%endif
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Expand Down Expand Up @@ -85,7 +90,12 @@ Requires: python3-argo-ams-library
Requires: python3-avro
Requires: python3-dirq
Requires: python3-messaging
%if 0%{?el7}
Requires: python36-pytz
%endif
%if 0%{?el9}
Requires: python3-pytz
%endif
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Expand Down Expand Up @@ -120,6 +130,8 @@ Bridge from Sensu to the ARGO Messaging system
rm -rf $RPM_BUILD_ROOT

%changelog
* Mon Mar 18 2024 Daniel Vrcic <[email protected]> - 0.4.1-1%{?dist}
- refine spec by varying pytz dependency based on whether we're building on Centos7 or Rocky9
* Thu Sep 1 2022 Daniel Vrcic <[email protected]> - 0.4.0-1%{?dist}
- ARGO-3754 Build two RPMS, Nagios and Sensu with appropriate runtime permission settings
- ARGO-3825 List requires explicitly for each ams-publisher package
Expand Down
20 changes: 10 additions & 10 deletions pymod/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ def write(self, num=0):
fp.writelines(['{0}\n'.format(str(self.inmemq[e][1]))
for e in range(self.shared.topic['bulk'])])
published.update([self.inmemq[e][0] for e in range(self.shared.topic['bulk'])])
self.shared.stats['published'] += self.shared.topic['bulk']

self.inmemq.rotate(-self.shared.topic['bulk'])

return True, published
Expand Down Expand Up @@ -150,7 +148,7 @@ def tag2dict(self, body):

return self._extract_body(body, tag_fields, body_to_tagname)

def _write(self, msgs):
def write(self):
t = 1
lck = self.events['lck-' + self.name]
published = set()
Expand All @@ -159,6 +157,15 @@ def _write(self, msgs):
while t <= self.shared.topic['retry']:
try:
lck.acquire(False)
msgs = [self.construct_msg(self.inmemq[e][1]) for e in range(self.shared.topic['bulk'])]
msgs = list(map(
lambda m:
AmsMessage(attributes={
'partition_date': m[0],
'type': self.shared.topic['msgtype']
}, data=m[1]),
msgs)
)
self.ams.publish(self.shared.topic['topic'], msgs, timeout=self.shared.topic['timeout'])
published.update([self.inmemq[e][0] for e in range(self.shared.topic['bulk'])])
self._increm_intervalcounters(self.shared.topic['bulk'])
Expand Down Expand Up @@ -206,10 +213,3 @@ def _write(self, msgs):
return False, published

return True, published

def write(self):
msgs = [self.construct_msg(self.inmemq[e][1]) for e in range(self.shared.topic['bulk'])]
msgs = list(map(lambda m: AmsMessage(attributes={'partition_date': m[0],
'type': self.shared.topic['msgtype']},
data=m[1]), msgs))
return self._write(msgs)
4 changes: 2 additions & 2 deletions pymod/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from multiprocessing import Process
from ams_publisher.shared import Shared

MAXCMDLENGTH = 128
MAXCMDLENGTH = 1024
STATSOCK = '/run/ams-publisher/sock'


Expand All @@ -30,7 +30,7 @@ def parse_result(query):

shared = Shared()

maxcmdlength = 128
maxcmdlength = 1024
query_consumed, query_published = '', ''

for w in shared.workers:
Expand Down

0 comments on commit 2a195f1

Please sign in to comment.