Skip to header Skip to main navigation Skip to main content Skip to footer

Search form

Site branding

Home
What's up, home?

Main navigation

  • Home
  • Story mode
  • About
  • Features
  • Hardware list
  • Videos
  • GitHub (opens in new tab)
  • Daily AI generated stories (opens in new tab)

Part 64: I, for one, welcome our new AI blogger overlords

Breadcrumbs

Breadcrumb

  • Home
  • Part 64: I, for one, welcome our new AI blogger overlords

Main page content

By whatsuphome | 7:45 AM EET, Wed February 21, 2024

TL;DR

I set up a daily cronjob that queries active Zabbix alerts, feeds them to GPT4All to generate a story, and then publishes the result to a Drupal website using Python requests and the JSON API. The automated blog runs every morning at 7am Finnish time and
Robot writing blog posts

As I now have GPT4All perfectly suitable for writing fascinating stories about everything, why not to utilize it even more? Please welcome the new spin-off website, What's up, home? Generative AI Edition. A cronjob running on my What's up, home? environment will run itself every morning 7am Finnish time, generate a fresh new story based on active Zabbix alerts, and post it to the new website over Drupal API.

Why,  oh why?

Just because I can. And, just because all this stupid play can be useful elsewhere. Imagine if you ask the little AI to write in a more formal manner, or filter alerts for you, or do anything that is actually useful in the business world, and soon enough you have Robin next to you (assuming you are Batman).

How?

For the alert gathering and storywriting part, look at my recent blog entry. For posting to Drupal, it's just Python's requests library.

data = {
       "data": {
       "type": "node--article",
       "attributes": 
       {"title": str(blogtitle),
         "body": { "value": str(response1), 
                   "format": "plain_text" 
                 }
        }
}
}
headers = {'Content-type':'application/vnd.api+json',
          'Accept':'application/vnd.api+json'}
r = requests.post("https://generativeai.whatsuphome.fi/jsonapi/node/article",data=json.dumps(data),headers=headers,auth=('myuser','mypassword'))

if r.status_code == 201:
   print ("Success")
else:
   print ("Fail")

Finally, I just have a cronjob scheduled to run every day at 7am.

0 7 * * * /path/to/my/script --title "Generate a blog post title based on the following Zabbix alerts" --question "Create an ongoing story based on the following Zabbix alerts" --title "Generate a title for a blog post based on following Zabbix alerts"

And it's done! Thanks to extremely rich toolset available for free for this kind of purposes makes AI really easy.

Future plans

I fear that with the same prompt used every morning things will get repetitive really soon. I'll let it run for now like that, but to make things more interesting, soon I'll try what happens if I ask GPT4All to generate a prompt for itself, and use that prompt to generate the story.

whatsuphome
zabbix
gpt4all
blog
drupal
api
developmentnews
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
I set up a daily cronjob that queries active Zabbix alerts, feeds them to GPT4All to generate a story, and then publishes the result to a Drupal website using Python requests and the JSON API. The automated blog runs every morning at 7am Finnish time and

Search

Who am I?

  • Janne Pikkarainen from Finland 🇫🇮
  • Began with computers in 1986 with C64
  • Doing IT for living since 1999
  • Principal Site Reliability Engineer at Forcepoint
  • A Zabbix Summit speaker every year since 2022
  • Walking, talking Zabbix commercial

Support my project

Buy me a coffee 

Footer menu

  • Contact

What's up, home? | Janne Pikkarainen | contact(at)whatsuphome.fi | 2022 - 2026

Developed and Designed by Janne Pikkarainen