8 Commits

Author SHA1 Message Date
a0733f70e5 handle negative values, fix 1
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-04-09 13:07:28 +02:00
53dc8a68a3 handle negative values
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-04-09 13:01:57 +02:00
a8ab382216 Merge branch 'master' of gitea.hottis.de:wn/snmp-mqtt
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-03-19 08:34:37 +01:00
8d6b6eaa3c changes in config 2025-03-19 08:34:33 +01:00
ea948d0bb3 fix config
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-03-18 21:37:55 +01:00
30c64cde60 test
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-03-18 21:30:26 +01:00
36699bd248 Merge branch 'master' of gitea.hottis.de:wn/snmp-mqtt 2025-03-11 20:32:25 +01:00
3ab6814c16 fix 2025-03-11 20:32:17 +01:00
3 changed files with 25 additions and 43 deletions

View File

@ -11,42 +11,6 @@ steps:
when: when:
- event: [push, tag] - event: [push, tag]
scan:
image: quay.io/wollud1969/woodpecker-helper:0.5.1
environment:
TRIVY_TOKEN:
from_secret: trivy_token
TRIVY_URL:
from_secret: trivy_url
DTRACK_API_KEY:
from_secret: dtrack_api_key
DTRACK_API_URL:
from_secret: dtrack_api_url
commands:
- export GOPATH=/woodpecker/go # the export is required, otherwise trivy will not consider the variable
- HOME=/home/`id -nu`
- TAG="${CI_COMMIT_TAG:-$CI_COMMIT_SHA}"
- |
trivy fs \
--server $TRIVY_URL \
--token $TRIVY_TOKEN \
--format cyclonedx \
--scanners license \
--output /tmp/sbom.xml \
.
- cat /tmp/sbom.xml
- |
curl -X "POST" \
-H "Content-Type: multipart/form-data" \
-H "X-Api-Key: $DTRACK_API_KEY" \
-F "autoCreate=true" \
-F "projectName=$CI_REPO" \
-F "projectVersion=$TAG" \
-F "bom=@/tmp/sbom.xml"\
"$DTRACK_API_URL/api/v1/bom"
when:
- event: [push, tag]
dockerize: dockerize:
image: plugins/kaniko image: plugins/kaniko
settings: settings:
@ -73,5 +37,5 @@ steps:
- export KUBECONFIG=/tmp/kubeconfig - export KUBECONFIG=/tmp/kubeconfig
- ./deployment/deploy.sh - ./deployment/deploy.sh
when: when:
- event: tag - event: [tag]

View File

@ -16,6 +16,26 @@
"label": "load1", "label": "load1",
"diff": "false" "diff": "false"
}, },
{
"oid": ".1.3.6.1.4.1.9676.123.1.4",
"label": "stratum",
"diff": "false"
},
{
"oid": ".1.3.6.1.4.1.9676.123.1.7",
"label": "rootdisp",
"diff": "false"
},
{
"oid": ".1.3.6.1.4.1.9676.123.2.3",
"label": "ss-reset",
"diff": "false"
},
{
"oid": ".1.3.6.1.4.1.9676.123.2.10",
"label": "processed-pkts",
"diff": "true"
},
{ {
"oid": ".1.3.6.1.2.1.31.1.1.1.6.2", "oid": ".1.3.6.1.2.1.31.1.1.1.6.2",
"label": "lan-in", "label": "lan-in",
@ -35,11 +55,6 @@
"oid": ".1.3.6.1.2.1.31.1.1.1.11.2", "oid": ".1.3.6.1.2.1.31.1.1.1.11.2",
"label": "lan-out-pkts", "label": "lan-out-pkts",
"diff": "true" "diff": "true"
},
{
"oid": ".1.3.6.1.4.1.9676.1",
"label": "time-req-pkts",
"diff": "true"
} }
] ]
}, },
@ -101,7 +116,7 @@
"community": "public", "community": "public",
"oidTopics": [ "oidTopics": [
{ {
"oid": "1.3.6.1.2.1.25.3.3.1.2.1", "oid": ".1.3.6.1.2.1.25.3.3.1.2.1",
"label": "load1", "label": "load1",
"diff": "false" "diff": "false"
}, },

View File

@ -56,6 +56,9 @@ func calculateDifference(key string, newValue string) (string, error) {
Timestamp: currentTime, Timestamp: currentTime,
Value: newValue, Value: newValue,
} }
if diffValuePerSecond < 0 {
return "", fmt.Errorf("negative difference value: %d", diffValuePerSecond)
}
return strconv.Itoa(diffValuePerSecond), nil return strconv.Itoa(diffValuePerSecond), nil
} else { } else {
log.Printf("create lvv for %s", key) log.Printf("create lvv for %s", key)